mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 13:01:41 +00:00
Add arbfp1 and fp40 barrel fragment programs, see #43
This commit is contained in:
parent
118340d821
commit
e3784571cd
2 changed files with 70 additions and 11 deletions
|
@ -67,6 +67,7 @@ using namespace std;
|
|||
|
||||
namespace NL3D {
|
||||
|
||||
extern const char *g_StereoOVR_fp40;
|
||||
extern const char *g_StereoOVR_arbfp1;
|
||||
extern const char *g_StereoOVR_ps_2_0;
|
||||
|
||||
|
@ -239,16 +240,15 @@ void CStereoOVR::setDriver(NL3D::UDriver *driver)
|
|||
nlassert(!m_PixelProgram);
|
||||
|
||||
NL3D::IDriver *drvInternal = (static_cast<CDriverUser *>(driver))->getDriver();
|
||||
static const char *program_arbfp1 =
|
||||
"!!ARBfp1.0\n"
|
||||
"PARAM c[1] = { { 1, 0 } };\n"
|
||||
"MOV result.color.xzw, c[0].xyyx;\n"
|
||||
"TEX result.color.y, fragment.texcoord[0], texture[0], 2D;\n"
|
||||
"END\n";
|
||||
if (drvInternal->supportPixelProgram(CPixelProgram::arbfp1) && drvInternal->supportBloomEffect() && drvInternal->supportNonPowerOfTwoTextures())
|
||||
if (drvInternal->supportPixelProgram(CPixelProgram::fp40) && drvInternal->supportBloomEffect() && drvInternal->supportNonPowerOfTwoTextures())
|
||||
{
|
||||
nldebug("VR: fp40");
|
||||
m_PixelProgram = new CPixelProgram(g_StereoOVR_fp40);
|
||||
}
|
||||
else if (drvInternal->supportPixelProgram(CPixelProgram::arbfp1) && drvInternal->supportBloomEffect() && drvInternal->supportNonPowerOfTwoTextures())
|
||||
{
|
||||
nldebug("VR: arbfp1");
|
||||
m_PixelProgram = new CPixelProgram(program_arbfp1);
|
||||
m_PixelProgram = new CPixelProgram(g_StereoOVR_arbfp1);
|
||||
}
|
||||
else if (drvInternal->supportPixelProgram(CPixelProgram::ps_2_0))
|
||||
{
|
||||
|
|
|
@ -21,6 +21,65 @@ limitations under the License.
|
|||
************************************************************************************/
|
||||
|
||||
namespace NL3D {
|
||||
const char *g_StereoOVR_fp40 =
|
||||
"!!ARBfp1.0\n"
|
||||
"OPTION NV_fragment_program2;\n"
|
||||
//# cgc version 3.1.0013, build date Apr 18 2012
|
||||
//# command line args: -profile fp40
|
||||
//# source file: pp_oculus_vr.cg
|
||||
//#vendor NVIDIA Corporation
|
||||
//#version 3.1.0.13
|
||||
//#profile fp40
|
||||
//#program pp_oculus_vr
|
||||
//#semantic pp_oculus_vr.cLensCenter
|
||||
//#semantic pp_oculus_vr.cScreenCenter
|
||||
//#semantic pp_oculus_vr.cScale
|
||||
//#semantic pp_oculus_vr.cScaleIn
|
||||
//#semantic pp_oculus_vr.cHmdWarpParam
|
||||
//#semantic pp_oculus_vr.cTex0 : TEX0
|
||||
//#var float2 texCoord : $vin.TEXCOORD0 : TEX0 : 0 : 1
|
||||
//#var float2 cLensCenter : : c[0] : 1 : 1
|
||||
//#var float2 cScreenCenter : : c[1] : 2 : 1
|
||||
//#var float2 cScale : : c[2] : 3 : 1
|
||||
//#var float2 cScaleIn : : c[3] : 4 : 1
|
||||
//#var float4 cHmdWarpParam : : c[4] : 5 : 1
|
||||
//#var sampler2D cTex0 : TEX0 : texunit 0 : 6 : 1
|
||||
//#var float4 oCol : $vout.COLOR : COL : 7 : 1
|
||||
//#const c[5] = 0.25 0.5 0
|
||||
"PARAM c[6] = { program.env[0..4],\n" // program.local->program.env!
|
||||
" { 0.25, 0.5, 0 } };\n"
|
||||
"TEMP R0;\n"
|
||||
"TEMP R1;\n"
|
||||
"SHORT TEMP H0;\n"
|
||||
"TEMP RC;\n"
|
||||
"TEMP HC;\n"
|
||||
"OUTPUT oCol = result.color;\n"
|
||||
"ADDR R0.xy, fragment.texcoord[0], -c[0];\n"
|
||||
"MULR R0.xy, R0, c[3];\n"
|
||||
"MULR R0.z, R0.y, R0.y;\n"
|
||||
"MADR R1.x, R0, R0, R0.z;\n"
|
||||
"MULR R0.zw, R1.x, c[4].xywz;\n"
|
||||
"MADR R1.y, R1.x, c[4], c[4].x;\n"
|
||||
"MADR R0.w, R0, R1.x, R1.y;\n"
|
||||
"MULR R0.z, R0, R1.x;\n"
|
||||
"MADR R0.z, R0, R1.x, R0.w;\n"
|
||||
"MULR R1.xy, R0, R0.z;\n"
|
||||
"MOVR R0.xy, c[5];\n"
|
||||
"ADDR R1.zw, R0.xyxy, c[1].xyxy;\n"
|
||||
"MOVR R0.zw, c[0].xyxy;\n"
|
||||
"MADR R0.zw, R1.xyxy, c[2].xyxy, R0;\n"
|
||||
"MINR R1.xy, R0.zwzw, R1.zwzw;\n"
|
||||
"ADDR R0.xy, -R0, c[1];\n"
|
||||
"MAXR R0.xy, R0, R1;\n"
|
||||
"SEQR H0.xy, R0, R0.zwzw;\n"
|
||||
"MULXC HC.x, H0, H0.y;\n"
|
||||
"IF EQ.x;\n"
|
||||
"MOVR oCol, c[5].z;\n"
|
||||
"ELSE;\n"
|
||||
"TEX oCol, R0.zwzw, texture[0], 2D;\n"
|
||||
"ENDIF;\n"
|
||||
"END\n";
|
||||
//# 24 instructions, 2 R-regs, 1 H-regs
|
||||
const char *g_StereoOVR_arbfp1 =
|
||||
"!!ARBfp1.0\n"
|
||||
//# cgc version 3.1.0013, build date Apr 18 2012
|
||||
|
@ -45,7 +104,7 @@ const char *g_StereoOVR_arbfp1 =
|
|||
//#var sampler2D cTex0 : TEX0 : texunit 0 : 6 : 1
|
||||
//#var float4 oCol : $vout.COLOR : COL : 7 : 1
|
||||
//#const c[5] = 0.25 0.5 0 1
|
||||
"PARAM c[6] = { program.local[0..4],\n"
|
||||
"PARAM c[6] = { program.env[0..4],\n"
|
||||
" { 0.25, 0.5, 0, 1 } };\n"
|
||||
"TEMP R0;\n"
|
||||
"TEMP R1;\n"
|
||||
|
@ -78,8 +137,8 @@ const char *g_StereoOVR_arbfp1 =
|
|||
"CMP R1.x, -R1, c[5].z, c[5].w;\n"
|
||||
"CMP result.color, -R1.x, R0, c[5].z;\n"
|
||||
"END\n";
|
||||
const char *g_StereoOVR_ps_2_0 =
|
||||
//# 28 instructions, 2 R-regs
|
||||
const char *g_StereoOVR_ps_2_0 =
|
||||
"ps_2_0\n"
|
||||
// cgc version 3.1.0013, build date Apr 18 2012
|
||||
// command line args: -profile ps_2_0
|
||||
|
|
Loading…
Reference in a new issue