mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 04:51:52 +00:00
Add support for fp40 with opengl
--HG-- branch : multipass-stereo
This commit is contained in:
parent
bc25be05ba
commit
be33bbc70f
5 changed files with 43 additions and 9 deletions
|
@ -155,9 +155,9 @@ public:
|
||||||
|
|
||||||
// opengl - 0x0610,bitfield
|
// opengl - 0x0610,bitfield
|
||||||
arbfp1 = 0x06100001, // ARB_fragment_program
|
arbfp1 = 0x06100001, // ARB_fragment_program
|
||||||
// fp20 = 0x061B0002,
|
// fp20 = 0x061B0002, // very limited and outdated, unnecessary
|
||||||
fp30 = 0x06100004, // NV_fragment_program
|
// fp30 = 0x06100004, // NV_fragment_program, now arbfp1, redundant
|
||||||
fp40 = 0x06100008, // NV_fragment_program2
|
fp40 = 0x06100008, // NV_fragment_program2, arbfp1 with "OPTION NV_fragment_program2;\n"
|
||||||
gp4fp = 0x06100010, // NV_gpu_program4
|
gp4fp = 0x06100010, // NV_gpu_program4
|
||||||
gp5fp = 0x06100020, // NV_gpu_program5
|
gp5fp = 0x06100020, // NV_gpu_program5
|
||||||
};
|
};
|
||||||
|
|
|
@ -1225,6 +1225,15 @@ static bool setupARBFragmentProgram(const char *glext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *********************************
|
||||||
|
static bool setupNVFragmentProgram2(const char *glext)
|
||||||
|
{
|
||||||
|
H_AUTO_OGL(setupNVFragmentProgram2);
|
||||||
|
CHECK_EXT("GL_NV_fragment_program2");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
static bool setupARBVertexBufferObject(const char *glext)
|
static bool setupARBVertexBufferObject(const char *glext)
|
||||||
{
|
{
|
||||||
|
@ -1563,13 +1572,15 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
|
|
||||||
// Check pixel program
|
// Check pixel program
|
||||||
// Disable feature ???
|
// Disable feature ???
|
||||||
if(!ext.DisableHardwarePixelProgram)
|
if (!ext.DisableHardwarePixelProgram)
|
||||||
{
|
{
|
||||||
ext.ARBFragmentProgram= setupARBFragmentProgram(glext);
|
ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
|
||||||
|
ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ext.ARBFragmentProgram = false;
|
ext.ARBFragmentProgram = false;
|
||||||
|
ext.NVFragmentProgram2 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.OESDrawTexture = setupOESDrawTexture(glext);
|
ext.OESDrawTexture = setupOESDrawTexture(glext);
|
||||||
|
@ -1582,14 +1593,12 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
ext.NVTextureShader = setupNVTextureShader(glext);
|
ext.NVTextureShader = setupNVTextureShader(glext);
|
||||||
ext.ATIEnvMapBumpMap = setupATIEnvMapBumpMap(glext);
|
ext.ATIEnvMapBumpMap = setupATIEnvMapBumpMap(glext);
|
||||||
ext.ATIFragmentShader = setupATIFragmentShader(glext);
|
ext.ATIFragmentShader = setupATIFragmentShader(glext);
|
||||||
ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ext.ATIEnvMapBumpMap = false;
|
ext.ATIEnvMapBumpMap = false;
|
||||||
ext.NVTextureShader = false;
|
ext.NVTextureShader = false;
|
||||||
ext.ATIFragmentShader = false;
|
ext.ATIFragmentShader = false;
|
||||||
ext.ARBFragmentProgram = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For now, the only way to know if emulation, is to test some extension which exist only on GeForce3.
|
// For now, the only way to know if emulation, is to test some extension which exist only on GeForce3.
|
||||||
|
|
|
@ -103,6 +103,9 @@ struct CGlExtensions
|
||||||
bool ARBTextureNonPowerOfTwo;
|
bool ARBTextureNonPowerOfTwo;
|
||||||
bool ARBMultisample;
|
bool ARBMultisample;
|
||||||
|
|
||||||
|
// NV Pixel Programs
|
||||||
|
bool NVFragmentProgram2;
|
||||||
|
|
||||||
bool OESDrawTexture;
|
bool OESDrawTexture;
|
||||||
bool OESMapBuffer;
|
bool OESMapBuffer;
|
||||||
|
|
||||||
|
@ -208,6 +211,7 @@ public:
|
||||||
result += NVTextureShader ? "NVTextureShader " : "";
|
result += NVTextureShader ? "NVTextureShader " : "";
|
||||||
result += ATIFragmentShader ? "ATIFragmentShader " : "";
|
result += ATIFragmentShader ? "ATIFragmentShader " : "";
|
||||||
result += ARBFragmentProgram ? "ARBFragmentProgram " : "";
|
result += ARBFragmentProgram ? "ARBFragmentProgram " : "";
|
||||||
|
result += NVFragmentProgram2 ? "NVFragmentProgram2 " : "";
|
||||||
result += ARBVertexProgram ? "ARBVertexProgram " : "";
|
result += ARBVertexProgram ? "ARBVertexProgram " : "";
|
||||||
result += NVVertexProgram ? "NVVertexProgram " : "";
|
result += NVVertexProgram ? "NVVertexProgram " : "";
|
||||||
result += EXTVertexShader ? "EXTVertexShader " : "";
|
result += EXTVertexShader ? "EXTVertexShader " : "";
|
||||||
|
|
|
@ -71,7 +71,13 @@ bool CDriverGL::isPixelProgramSupported() const
|
||||||
bool CDriverGL::isPixelProgramSupported(TPixelProgramProfile profile) const
|
bool CDriverGL::isPixelProgramSupported(TPixelProgramProfile profile) const
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported_profile)
|
H_AUTO_OGL(CPixelProgamDrvInfosGL_isPixelProgramSupported_profile)
|
||||||
return profile == arbfp1 && _Extensions.ARBFragmentProgram;
|
switch (profile)
|
||||||
|
{
|
||||||
|
case arbfp1:
|
||||||
|
return _Extensions.ARBFragmentProgram;
|
||||||
|
case fp40:
|
||||||
|
return _Extensions.NVFragmentProgram2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -304,6 +304,16 @@ void initCommands()
|
||||||
"MOV result.color.xzw, c[0].xyyx;\n"
|
"MOV result.color.xzw, c[0].xyyx;\n"
|
||||||
"TEX result.color.y, fragment.texcoord[0], texture[0], 2D;\n"
|
"TEX result.color.y, fragment.texcoord[0], texture[0], 2D;\n"
|
||||||
"END\n";
|
"END\n";
|
||||||
|
static const char *program_fp40 =
|
||||||
|
"!!ARBfp1.0\n"
|
||||||
|
"OPTION NV_fragment_program2;\n"
|
||||||
|
"PARAM c[1] = { { 1, 0 } };\n"
|
||||||
|
"TEMP RC;\n"
|
||||||
|
"TEMP HC;\n"
|
||||||
|
"OUTPUT oCol = result.color;\n"
|
||||||
|
"MOVR oCol.xzw, c[0].xyyx;\n"
|
||||||
|
"TEX oCol.y, fragment.texcoord[0], texture[0], 2D;\n"
|
||||||
|
"END\n";
|
||||||
static const char *program_ps_1_1 =
|
static const char *program_ps_1_1 =
|
||||||
"ps.1.1\n"
|
"ps.1.1\n"
|
||||||
"def c0, 0.000000, 0.000000, 1.000000, 0.000000\n"
|
"def c0, 0.000000, 0.000000, 1.000000, 0.000000\n"
|
||||||
|
@ -329,7 +339,12 @@ void initCommands()
|
||||||
"mov oC0.xzw, c0.xyyx\n"
|
"mov oC0.xzw, c0.xyyx\n"
|
||||||
"texld oC0.y, v0, s0\n";
|
"texld oC0.y, v0, s0\n";
|
||||||
NL3D::IDriver *d = dynamic_cast<NL3D::CDriverUser *>(Driver)->getDriver();
|
NL3D::IDriver *d = dynamic_cast<NL3D::CDriverUser *>(Driver)->getDriver();
|
||||||
if (d->isPixelProgramSupported(IDriver::arbfp1))
|
if (d->isPixelProgramSupported(IDriver::fp40))
|
||||||
|
{
|
||||||
|
nldebug("fp40");
|
||||||
|
a_DevPixelProgram = new CPixelProgram(program_fp40);
|
||||||
|
}
|
||||||
|
else if (d->isPixelProgramSupported(IDriver::arbfp1))
|
||||||
{
|
{
|
||||||
nldebug("arbfp1");
|
nldebug("arbfp1");
|
||||||
a_DevPixelProgram = new CPixelProgram(program_arbfp1);
|
a_DevPixelProgram = new CPixelProgram(program_arbfp1);
|
||||||
|
|
Loading…
Reference in a new issue