Registers?
by Entr0py · in Torque Game Engine Advanced · 12/06/2006 (4:37 pm) · 4 replies
Looking at shdrConsts.h, I see #define VC_WORLD_PROJ C0, which is world projection.
I don't see object projection or view projection. What are the registers for these? Can we get a complete list of registers for both PS and VS? I have looked all over the site and can't find a complete list. Looking in code didn't help me either.
I don't see object projection or view projection. What are the registers for these? Can we get a complete list of registers for both PS and VS? I have looked all over the site and can't find a complete list. Looking in code didn't help me either.
#2
(continued)
12/06/2006 (5:08 pm)
(continuation)./lightingSystem/sgDynamicRangeLighting.cc:220: GFX->setPixelShaderConstF(1, temp, 1); ./lightingSystem/sgDynamicRangeLighting.cc:224: GFX->setPixelShaderConstF(2, temp, 1); ./lightingSystem/sgDynamicRangeLighting.cc:243: GFX->setVertexShaderConstF(0, stride, 1); ./lightingSystem/sgDynamicRangeLighting.cc:244: GFX->setPixelShaderConstF(0, stride, 1); ./lightingSystem/sgDynamicRangeLighting.cc:280: GFX->setVertexShaderConstF(0, stride, 1); ./lightingSystem/sgDynamicRangeLighting.cc:281: GFX->setPixelShaderConstF(0, stride, 1); ./lightingSystem/sgDynamicRangeLighting.cc:285: GFX->setPixelShaderConstF(1, temp, 1); ./lightingSystem/sgDynamicRangeLighting.cc:448: GFX->setPixelShaderConstF(0, temp, 1); ./lightingSystem/sgObjectBasedProjector.cc:450: GFX->setVertexShaderConstF(vertconstindex1, mat, 4); ./lightingSystem/sgObjectBasedProjector.cc:459: GFX->setVertexShaderConstF(vertconstindex2, mat, 4); ./lightingSystem/sgObjectBasedProjector.cc:506: GFX->setVertexShaderConstF(4, sgProjectionInfo, 1); ./lightingSystem/sgObjectBasedProjector.cc:507: GFX->setPixelShaderConstF(1, Point4F(1.0, 0.0, 0.0, 0.0), 1); ./lightingSystem/sgObjectBasedProjector.cc:692: GFX->setPixelShaderConstF(0, stride, 1); ./lightingSystem/sgObjectBasedProjector.cc:693: GFX->setVertexShaderConstF(12, Point4F(0.0, -1.0, 0.0, 0.0), 1); ./lightingSystem/sgObjectBasedProjector.cc:707: GFX->setPixelShaderConstF(3, color, 1); ./lightingSystem/sgObjectBasedProjector.cc:710: GFX->setVertexShaderConstF(0, transposetemp, 4); ./lightingSystem/sgObjectBasedProjector.cc:713: GFX->setVertexShaderConstF(4, transposetemp, 4); ./lightingSystem/sgObjectBasedProjector.cc:714: GFX->setVertexShaderConstF(8, sgProjectionInfo, 1); ./lightingSystem/sgObjectBasedProjector.cc:715: GFX->setVertexShaderConstF(9, stride, 1); ./lightingSystem/sgObjectBasedProjector.cc:723: GFX->setVertexShaderConstF(10, bias, 1); ./lightingSystem/sgObjectBasedProjector.cc:775: GFX->setPixelShaderConstF(3, color, 1); ./materials/customMaterial.cpp:481: setShaderConstants( sgData, 0 ); ./materials/customMaterial.cpp:565:void CustomMaterial::setShaderConstants( const SceneGraphData &sgData, ./materials/customMaterial.cpp:568: Parent::setShaderConstants( sgData, stageNum ); ./materials/customMaterial.cpp:570: GFX->setPixelShaderConstF( PC_ACCUM_TIME, (float*)&mAccumTime, 1 ); ./materials/customMaterial.cpp:573: //GFX->setPixelShaderConstF(PC_EXPOSURE, (float*)&exp, 1); ./materials/customMaterial.h:88: virtual void setShaderConstants( const SceneGraphData &sgData, U32 stageNum ); ./materials/material.cpp:246:void Material::setShaderConstants( const SceneGraphData &sgData, U32 stageNum ) ./materials/material.cpp:255: GFX->setVertexShaderConstF( VC_OBJ_TRANS, (float*)&objTrans, 4 ); ./materials/material.cpp:260: GFX->setVertexShaderConstF( VC_EYE_POS, (float*)&eyePos, 1 ); ./materials/material.cpp:271: GFX->setVertexShaderConstF(VC_LIGHT_POS1, (float*)&lightPosModel, 1); ./materials/material.cpp:272: GFX->setVertexShaderConstF(VC_LIGHT_DIR1, (float*)&lightDir, 1); ./materials/material.cpp:273: GFX->setVertexShaderConstF(VC_LIGHT_DIFFUSE1, (float*)&sgData.light.mColor, 1); ./materials/material.cpp:274: GFX->setPixelShaderConstF(PC_AMBIENT_COLOR, (float*)&sgData.light.mAmbient, 1); ./materials/material.cpp:277: GFX->setPixelShaderConstF(PC_DIFF_COLOR, (float*)&sgData.light.mColor, 1); ./materials/material.cpp:281: GFX->setPixelShaderConstF(PC_DIFF_COLOR, (float*)&selfillum, 1); ./materials/material.cpp:285: GFX->setVertexShaderConstF(VC_LIGHT_TRANS, (float*)&lightingmat, 4); ./materials/material.cpp:296: GFX->setVertexShaderConstF(VC_LIGHT_POS2, (float*)&lightPosModel, 1); ./materials/material.cpp:297: GFX->setPixelShaderConstF(PC_DIFF_COLOR2, (float*)&sgData.lightSecondary.mColor, 1); ./materials/material.cpp:300: GFX->setVertexShaderConstF(VC_LIGHT_TRANS2, (float*)&lightingmat, 4); ./materials/material.cpp:308: GFX->setVertexShaderConstF( VC_CUBE_EYE_POS, (float*)&cubeEyePos, 1 ); ./materials/material.cpp:313: GFX->setVertexShaderConstF( VC_CUBE_TRANS, (float*)&cubeTrans, 3 ); ./materials/material.cpp:319: GFX->setPixelShaderConstF( PC_MAT_SPECCOLOR, (float*)&specular[stageNum], 1 ); ./materials/material.cpp:320: GFX->setPixelShaderConstF( PC_MAT_SPECPOWER, (float*)&specularPower[stageNum], 1 ); ./materials/material.cpp:321: GFX->setVertexShaderConstF( VC_MAT_SPECPOWER, (float*)&specularPower[stageNum], 1 ); ./materials/material.cpp:329: GFX->setVertexShaderConstF( VC_FOGDATA, (float*)&fogData, 1 ); ./materials/material.cpp:333:// GFX->setVertexShaderConstF( VC_DETAIL_SCALE, &scale, 1 ); ./materials/material.h:188: virtual void setShaderConstants( const SceneGraphData &sgData, U32 stageNum ); ./materials/matInstance.cpp:652: mMaterial->setShaderConstants( sgData, mPasses[mCurPass].stageNum ); ./materials/matInstance.cpp:815: GFX->setVertexShaderConstF( VC_TEX_TRANS1, (float*) &texMat, 4 ); ./renderInstance/renderElemMgr.cpp:37: GFX->setVertexShaderConstF(VC_LIGHT_POS1, (float*)&lightPosModel, 1);
(continued)
#3
Whew! That's a lot of references to shader constants. ;-)
Tom
12/06/2006 (5:08 pm)
(continuation)./renderInstance/renderElemMgr.cpp:38: GFX->setVertexShaderConstF(VC_LIGHT_DIR1, (float*)&lightDir, 1); ./renderInstance/renderElemMgr.cpp:39: GFX->setVertexShaderConstF(VC_LIGHT_DIFFUSE1, (float*)&data.light.mColor, 1); ./renderInstance/renderElemMgr.cpp:40: GFX->setPixelShaderConstF(PC_AMBIENT_COLOR, (float*)&data.light.mAmbient, 1); ./renderInstance/renderElemMgr.cpp:46: GFX->setPixelShaderConstF(PC_DIFF_COLOR, (float*)&data.light.mColor, 1); ./renderInstance/renderElemMgr.cpp:51: GFX->setPixelShaderConstF(PC_DIFF_COLOR, (float*)&selfillum, 1); ./renderInstance/renderElemMgr.cpp:56: GFX->setPixelShaderConstF(PC_DIFF_COLOR, (float*)&data.light.mColor, 1); ./renderInstance/renderElemMgr.cpp:60: GFX->setVertexShaderConstF(VC_LIGHT_TRANS, (float*)&lightingmat, 4); ./renderInstance/renderElemMgr.cpp:71: GFX->setVertexShaderConstF(VC_LIGHT_POS2, (float*)&lightPosModel, 1); ./renderInstance/renderElemMgr.cpp:72: GFX->setPixelShaderConstF(PC_DIFF_COLOR2, (float*)&data.lightSecondary.mColor, 1); ./renderInstance/renderElemMgr.cpp:75: GFX->setVertexShaderConstF(VC_LIGHT_TRANS2, (float*)&lightingmat, 4); ./renderInstance/renderGlowMgr.cpp:118: GFX->setVertexShaderConstF( 0, (float*)passRI->worldXform, 4 ); ./renderInstance/renderGlowMgr.cpp:123: GFX->setVertexShaderConstF( VC_OBJ_TRANS, (float*)&objTrans, 4 ); ./renderInstance/renderGlowMgr.cpp:130: GFX->setVertexShaderConstF( VC_EYE_POS, (float*)&eyePos, 1 ); ./renderInstance/renderGlowMgr.cpp:135: //GFX->setVertexShaderConstF( VC_LIGHT_DIR1, (float*)&lightDir, 1 ); ./renderInstance/renderGlowMgr.cpp:141: GFX->setVertexShaderConstF( VC_CUBE_EYE_POS, (float*)&cubeEyePos, 1 ); ./renderInstance/renderGlowMgr.cpp:146: GFX->setVertexShaderConstF( VC_CUBE_TRANS, (float*)&cubeTrans, 3 ); ./renderInstance/renderInteriorMgr.cpp:163: GFX->setVertexShaderConstF( 0, (float*)passRI->worldXform, 4 ); ./renderInstance/renderInteriorMgr.cpp:168: GFX->setVertexShaderConstF( VC_OBJ_TRANS, (float*)&objTrans, 4 ); ./renderInstance/renderInteriorMgr.cpp:175: GFX->setVertexShaderConstF( VC_EYE_POS, (float*)&eyePos, 1 ); ./renderInstance/renderInteriorMgr.cpp:181: GFX->setVertexShaderConstF( VC_CUBE_EYE_POS, (float*)&cubeEyePos, 1 ); ./renderInstance/renderInteriorMgr.cpp:186: GFX->setVertexShaderConstF( VC_CUBE_TRANS, (float*)&cubeTrans, 3 ); ./renderInstance/renderMeshMgr.cpp:177: GFX->setVertexShaderConstF( 0, (float*)passRI->worldXform, 4 ); ./renderInstance/renderMeshMgr.cpp:182: GFX->setVertexShaderConstF( VC_OBJ_TRANS, (float*)&objTrans, 4 ); ./renderInstance/renderMeshMgr.cpp:189: GFX->setVertexShaderConstF( VC_EYE_POS, (float*)&eyePos, 1 ); ./renderInstance/renderMeshMgr.cpp:196: GFX->setVertexShaderConstF( VC_CUBE_EYE_POS, (float*)&cubeEyePos, 1 ); ./renderInstance/renderMeshMgr.cpp:201: GFX->setVertexShaderConstF( VC_CUBE_TRANS, (float*)&cubeTrans, 3 ); ./renderInstance/renderRefractMgr.cpp:117: GFX->setVertexShaderConstF( 0, (float*)passRI->worldXform, 4 ); ./renderInstance/renderRefractMgr.cpp:122: GFX->setVertexShaderConstF( VC_OBJ_TRANS, (float*)&objTrans, 4 ); ./renderInstance/renderRefractMgr.cpp:129: GFX->setVertexShaderConstF( VC_EYE_POS, (float*)&eyePos, 1 ); ./renderInstance/renderRefractMgr.cpp:133: //GFX->setVertexShaderConstF( VC_LIGHT_DIR1, (float*)&lightDir, 1 ); ./renderInstance/renderRefractMgr.cpp:140: GFX->setVertexShaderConstF( VC_CUBE_EYE_POS, (float*)&cubeEyePos, 1 ); ./renderInstance/renderRefractMgr.cpp:145: GFX->setVertexShaderConstF( VC_CUBE_TRANS, (float*)&cubeTrans, 3 ); ./renderInstance/renderTranslucentMgr.cpp:247: GFX->setVertexShaderConstF( 0, (float*)passRI->worldXform, 4 ); ./renderInstance/renderTranslucentMgr.cpp:251: GFX->setVertexShaderConstF( VC_OBJ_TRANS, (float*)&objTrans, 4 ); ./renderInstance/renderTranslucentMgr.cpp:257: GFX->setVertexShaderConstF( VC_EYE_POS, (float*)&eyePos, 1 ); ./renderInstance/renderTranslucentMgr.cpp:261: //GFX->setVertexShaderConstF( VC_LIGHT_DIR1, (float*)&lightDir, 1 ); ./renderInstance/renderTranslucentMgr.cpp:269: GFX->setVertexShaderConstF( VC_CUBE_EYE_POS, (float*)&cubeEyePos, 1 ); ./renderInstance/renderTranslucentMgr.cpp:274: GFX->setVertexShaderConstF( VC_CUBE_TRANS, (float*)&cubeTrans, 3 ); ./terrain/terrData.cpp:893: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./terrain/terrRender.cpp:1323: GFX->setVertexShaderConstF(54, (float *)terrainsize, 1); ./terrain/waterBlock.cpp:447: GFX->setVertexShaderConstF( V_SHADER_PARAM_OFFSET + i, (float*)reg, 1 ); ./terrain/waterBlock.cpp:455: GFX->setVertexShaderConstF( V_SHADER_PARAM_OFFSET + 4, (float*)reg, 1 ); ./terrain/waterBlock.cpp:470: GFX->setVertexShaderConstF( V_SHADER_PARAM_OFFSET + 5 + i, (float*)&texScale, 1 ); ./terrain/waterBlock.cpp:474: GFX->setVertexShaderConstF( V_SHADER_PARAM_OFFSET + 9, (float*)reg, 1 ); ./terrain/waterBlock.cpp:483: GFX->setPixelShaderConstF( PC_USERDEF1, (float*)reg, 1 ); ./terrain/waterBlock.cpp:488: GFX->setPixelShaderConstF( 10, (float*)reg, 1 ); ./terrain/waterBlock.cpp:556: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./terrain/waterBlock.cpp:647: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./terrain/waterBlock.cpp:706: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./terrain/waterBlock.cpp:939: GFX->setVertexShaderConstF( 0, (float*)&newMat, 4 ); ./terrain/waterBlock.cpp:947: GFX->setVertexShaderConstF( 54, (float*)&timeScale, 1 );
Whew! That's a lot of references to shader constants. ;-)
Tom
#4
12/06/2006 (8:32 pm)
Nice! Thanks ;)
Torque Owner Thomas Phillips
All of the shader constants (registers, that is) referenced within TSE (that I am aware of) are listed below. Distilling this into a friendly guide is left as an exercise for the reader... ;-)
./atlas/atlasInstance.cpp:252: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./atlas/atlasInstanceEntry.cpp:190: GFX->setVertexShaderConstF(44, &texGen[0], 4); ./atlas/atlasInstanceEntry.cpp:191: GFX->setVertexShaderConstF(45, &scaleOff[0], 4); ./atlas/runtime/atlasClipMapBatcher.cpp:187: GFX->setVertexShaderConstF(50, &shaderConsts[0].x, rn->levelCount); ./atlas/runtime/atlasClipMapBatcher.cpp:188: //GFX->setPixelShaderConstF(0, &shaderConsts[0].x, 4); ./atlas/runtime/atlasClipMapBatcher.cpp:197: GFX->setVertexShaderConstF(49, &chunkConsts.x, 1); ./atlas/runtime/atlasClipMapBatcher.cpp:236: GFX->setVertexShaderConstF(50, &fogConst[0], 1); ./atlas/runtime/atlasClipMapBatcher.cpp:262: GFX->setVertexShaderConstF(49, &chunkConsts.x, 1); ./atlas/runtime/atlasClipMapBlenderCache.cpp:305: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./atlas/runtime/atlasClipMapBlenderCache.cpp:633: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./atlas/runtime/atlasInstance2.cpp:345: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./atlas/runtime/atlasInstance2.cpp:348: GFX->setVertexShaderConstF(46, (float*)&terrainsize, 1); ./atlas/runtime/atlasInstance2.cpp:414: GFX->setVertexShaderConstF( VC_OBJ_TRANS, (float*)&objTrans, 4 ); ./atlas/runtime/atlasInstance2.cpp:419: GFX->setVertexShaderConstF( VC_EYE_POS, (float*)&eyePos, 1 ); ./game/fx/fxFoliageReplicator.cpp:1490: GFX->setVertexShaderConstF(0, (float*)&proj, 4); ./game/fx/fxFoliageReplicator.cpp:1494: GFX->setVertexShaderConstF(4, (float*)&world, 4); ./game/fx/fxFoliageReplicator.cpp:1496: GFX->setVertexShaderConstF(8, (float*) &mGlobalSwayPhase, 1); ./game/fx/fxFoliageReplicator.cpp:1498: GFX->setVertexShaderConstF(9, (float*) &mFieldData.mSwayMagnitudeSide, 1); ./game/fx/fxFoliageReplicator.cpp:1499: GFX->setVertexShaderConstF(10, (float*) &mFieldData.mSwayMagnitudeFront, 1); ./game/fx/fxFoliageReplicator.cpp:1501: GFX->setVertexShaderConstF(11, (float*) &mGlobalLightPhase, 1); ./game/fx/fxFoliageReplicator.cpp:1502: GFX->setVertexShaderConstF(12, (float*) &LuminanceMagnitude, 1); ./game/fx/fxFoliageReplicator.cpp:1503: GFX->setVertexShaderConstF(13, (float*) &LuminanceMidPoint, 1); ./game/fx/fxFoliageReplicator.cpp:1506: GFX->setVertexShaderConstF(14, (float*) &MaximumViewDistance, 1); ./game/fx/fxFoliageReplicator.cpp:1507: GFX->setVertexShaderConstF(15, (float*) &camPos, 1); ./game/fx/fxFoliageReplicator.cpp:1509: GFX->setPixelShaderConstF(1, (float*) &mFieldData.mGroundAlpha, 1); ./game/fx/precipitation.cpp:1267: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./game/fx/precipitation.cpp:1339: GFX->setVertexShaderConstF( 4, (float*)&fadeStartEnd, 2 ); ./game/fx/precipitation.cpp:1340: GFX->setVertexShaderConstF( 5, (float*)&camPos, 3 ); ./game/fx/precipitation.cpp:1341: GFX->setVertexShaderConstF( 6, (float*)&ambient, 3 ); ./gfx/D3D/gfxD3DDevice.cpp:602: setVertexShaderConstF( VC_WORLD_PROJ, (F32 *)&mTempMatrix, 4 ); ./gfx/D3D/gfxD3DDevice.cpp:1349:void GFXD3DDevice::setVertexShaderConstF( U32 reg, const float *data, U32 size ) ./gfx/D3D/gfxD3DDevice.cpp:1351: mD3DDevice->SetVertexShaderConstantF( reg, data, size ); ./gfx/D3D/gfxD3DDevice.cpp:1357:void GFXD3DDevice::setPixelShaderConstF( U32 reg, const float *data, U32 size ) ./gfx/D3D/gfxD3DDevice.cpp:1359: mD3DDevice->SetPixelShaderConstantF( reg, data, size ); ./gfx/D3D/gfxD3DDevice.h:174: virtual void setVertexShaderConstF( U32 reg, const float *data, U32 size ); ./gfx/D3D/gfxD3DDevice.h:175: virtual void setPixelShaderConstF( U32 reg, const float *data, U32 size ); ./gfx/gfxDevice.h:531: virtual void setVertexShaderConstF( U32 reg, const float *data, U32 size ){}; ./gfx/gfxDevice.h:532: virtual void setPixelShaderConstF( U32 reg, const float *data, U32 size ){}; ./gfx/gfxTransformSaver.h:111: GFX->setVertexShaderConstF( VC_WORLD_PROJ, (F32 *)&final, 4 ); ./gfx/glowBuffer.cpp:147: GFX->setVertexShaderConstF( 0, (float*)&newMat, 4 ); ./gfx/glowBuffer.cpp:192: GFX->setVertexShaderConstF( 4, (float*)offsetConsts[0], 1 ); ./gfx/glowBuffer.cpp:193: GFX->setVertexShaderConstF( 5, (float*)offsetConsts[1], 1 ); ./gfx/glowBuffer.cpp:194: GFX->setVertexShaderConstF( 6, (float*)offsetConsts[2], 1 ); ./gfx/glowBuffer.cpp:195: GFX->setVertexShaderConstF( 7, (float*)offsetConsts[3], 1 ); ./gfx/glowBuffer.cpp:286: GFX->setPixelShaderConstF( 0, (float*)kernel, 1 ); ./interior/interiorDebug.cpp:246: GFX->setPixelShaderConstF( PC_USERDEF1, (F32*)&col, 1 ); ./interior/interiorDebug.cpp:289: GFX->setPixelShaderConstF( PC_USERDEF1, (F32*)&c, 1 ); ./interior/interiorDebug.cpp:390: GFX->setPixelShaderConstF( PC_USERDEF1, (F32*)&col, 1 ); ./interior/interiorDebug.cpp:405: GFX->setPixelShaderConstF( PC_USERDEF1, (F32*)&col, 1 ); ./interior/interiorDebug.cpp:586: GFX->setPixelShaderConstF( PC_USERDEF1, (F32*)&texSizeColor, 1 ); ./interior/interiorInstance.cpp:653: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 ); ./interior/interiorRender.cpp:315: GFX->setVertexShaderConstF( 0, (float*)&proj, 4 );(continued)