From 49130dbd714032575aeb69ceb6ce301474b6dd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Monta=C3=B1=C3=A9s=20Garc=C3=ADa?= Date: Wed, 22 Feb 2017 19:27:08 +0100 Subject: [PATCH 1/5] Proposed fix for Issue #1951. Checked with IP4. IP6 should work as wel but not checked yet. --- Engine/source/platform/platformNet.cpp | 35 ++++++++++++++++---------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 4d5b6ca18..a96a0d06b 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -809,7 +809,7 @@ NetSocket Net::openConnectTo(const char *addressString) error = Net::WrongProtocolType; } - if (error != NoError || error == NeedHostLookup) + if (error == NoError || error == NeedHostLookup) { handleFd = openSocket(); } @@ -823,13 +823,16 @@ NetSocket Net::openConnectTo(const char *addressString) if (socketFd != InvalidSocketHandle) { setBlocking(handleFd, false); - if (::connect(socketFd, (struct sockaddr *)&ipAddr, sizeof(ipAddr)) == -1 && - errno != EINPROGRESS) + if (::connect(socketFd, (struct sockaddr *)&ipAddr, sizeof(ipAddr)) == -1) { - Con::errorf("Error connecting %s: %s", - addressString, strerror(errno)); - closeSocket(handleFd); - handleFd = NetSocket::INVALID; + Net::Error err = PlatformNetState::getLastError(); + if (err != Net::WouldBlock) + { + Con::errorf("Error connecting to %s: %u", + addressString, err); + closeSocket(handleFd); + handleFd = NetSocket::INVALID; + } } } else @@ -849,14 +852,20 @@ NetSocket Net::openConnectTo(const char *addressString) sockaddr_in6 ipAddr6; NetAddressToIPSocket6(&address, &ipAddr6); SOCKET socketFd = PlatformNetState::smReservedSocketList.activate(handleFd, AF_INET6, false, true); - if (::connect(socketFd, (struct sockaddr *)&ipAddr6, sizeof(ipAddr6)) == -1 && - errno != EINPROGRESS) + if (socketFd != InvalidSocketHandle) { setBlocking(handleFd, false); - Con::errorf("Error connecting %s: %s", - addressString, strerror(errno)); - closeSocket(handleFd); - handleFd = NetSocket::INVALID; + if (::connect(socketFd, (struct sockaddr *)&ipAddr6, sizeof(ipAddr6)) == -1) + { + Net::Error err = PlatformNetState::getLastError(); + if (err != Net::WouldBlock) + { + Con::errorf("Error connecting to %s: %u", + addressString, err); + closeSocket(handleFd); + handleFd = NetSocket::INVALID; + } + } } else { From af8fbf0e3a405a285c8d7365a0eff89083e03396 Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 11 Apr 2017 00:23:14 -0500 Subject: [PATCH 2/5] Goes and replaces the references/names that use Prepass to be Deferred, since we're actually using deferred. --- Engine/source/T3D/decal/decalManager.cpp | 2 +- Engine/source/T3D/fx/groundCover.cpp | 2 +- Engine/source/T3D/levelInfo.cpp | 2 +- Engine/source/environment/VolumetricFog.cpp | 36 +-- Engine/source/environment/VolumetricFog.h | 4 +- Engine/source/environment/decalRoad.cpp | 2 +- Engine/source/environment/waterObject.cpp | 2 +- .../advanced/advancedLightBinManager.cpp | 26 +-- .../advanced/advancedLightBinManager.h | 6 +- .../advanced/advancedLightManager.cpp | 32 +-- .../lighting/advanced/advancedLightManager.h | 4 +- .../advanced/advancedLightingFeatures.cpp | 16 +- .../advanced/advancedLightingFeatures.h | 2 +- .../glsl/advancedLightingFeaturesGLSL.cpp | 42 ++-- .../glsl/advancedLightingFeaturesGLSL.h | 6 +- .../glsl/deferredShadingFeaturesGLSL.cpp | 2 +- .../advanced/glsl/gBufferConditionerGLSL.cpp | 22 +- .../hlsl/advancedLightingFeaturesHLSL.cpp | 48 ++-- .../hlsl/advancedLightingFeaturesHLSL.h | 6 +- .../hlsl/deferredShadingFeaturesHLSL.cpp | 2 +- .../advanced/hlsl/gBufferConditionerHLSL.cpp | 44 ++-- .../lighting/basic/basicLightManager.cpp | 26 +-- .../source/lighting/basic/basicLightManager.h | 4 +- Engine/source/lighting/lightManager.cpp | 8 +- Engine/source/lighting/lightManager.h | 4 +- .../lighting/shadowMap/lightShadowMap.cpp | 2 +- .../lighting/shadowMap/lightShadowMap.h | 2 +- .../lighting/shadowMap/shadowMatHook.cpp | 2 +- Engine/source/materials/baseMatInstance.h | 2 +- .../source/materials/materialFeatureTypes.cpp | 4 +- .../source/materials/materialFeatureTypes.h | 4 +- Engine/source/materials/materialManager.cpp | 2 +- Engine/source/materials/materialManager.h | 10 +- Engine/source/materials/processedMaterial.cpp | 6 +- .../materials/processedShaderMaterial.cpp | 6 +- Engine/source/materials/sceneData.h | 6 +- ...erPrePassMgr.cpp => renderDeferredMgr.cpp} | 218 +++++++++--------- ...renderPrePassMgr.h => renderDeferredMgr.h} | 60 ++--- .../renderInstance/renderImposterMgr.cpp | 20 +- .../source/renderInstance/renderImposterMgr.h | 6 +- .../source/renderInstance/renderMeshMgr.cpp | 2 +- .../source/renderInstance/renderObjectMgr.cpp | 2 +- .../renderInstance/renderParticleMgr.cpp | 38 +-- .../source/renderInstance/renderParticleMgr.h | 10 +- .../renderInstance/renderTerrainMgr.cpp | 2 +- .../renderTexTargetBinManager.cpp | 2 +- Engine/source/shaderGen/GLSL/bumpGLSL.cpp | 4 +- Engine/source/shaderGen/GLSL/depthGLSL.cpp | 2 +- .../shaderGen/GLSL/shaderFeatureGLSL.cpp | 8 +- Engine/source/shaderGen/HLSL/bumpHLSL.cpp | 4 +- Engine/source/shaderGen/HLSL/depthHLSL.cpp | 2 +- .../shaderGen/HLSL/shaderFeatureHLSL.cpp | 8 +- .../shaderGen/HLSL/shaderGenHLSLInit.cpp | 2 +- .../source/terrain/glsl/terrFeatureGLSL.cpp | 10 +- .../source/terrain/hlsl/terrFeatureHLSL.cpp | 10 +- Engine/source/terrain/terrCell.cpp | 2 +- Engine/source/terrain/terrCellMaterial.cpp | 40 ++-- Engine/source/terrain/terrCellMaterial.h | 8 +- .../BaseGame/game/core/gfxData/shaders.cs | 6 +- Templates/BaseGame/game/core/gfxData/water.cs | 12 +- .../core/lighting/advanced/deferredShading.cs | 6 +- .../game/core/lighting/advanced/shaders.cs | 12 +- Templates/BaseGame/game/core/postFX/MLAA.cs | 4 +- .../BaseGame/game/core/postFX/MotionBlurFx.cs | 4 +- .../BaseGame/game/core/postFX/caustics.cs | 4 +- Templates/BaseGame/game/core/postFX/dof.cs | 4 +- Templates/BaseGame/game/core/postFX/edgeAA.cs | 4 +- Templates/BaseGame/game/core/postFX/fog.cs | 8 +- Templates/BaseGame/game/core/postFX/hdr.cs | 2 +- .../BaseGame/game/core/postFX/lightRay.cs | 4 +- Templates/BaseGame/game/core/postFX/ssao.cs | 14 +- .../core/shaders/VolumetricFog/VFogP.hlsl | 4 +- .../core/shaders/VolumetricFog/VFogPreP.hlsl | 2 +- .../core/shaders/VolumetricFog/VFogPreV.hlsl | 2 +- .../core/shaders/VolumetricFog/gl/VFogP.glsl | 4 +- .../game/core/shaders/gl/particlesP.glsl | 4 +- .../advanced/deferredClearGBufferP.hlsl | 2 +- .../lighting/advanced/deferredShadingP.hlsl | 8 +- .../advanced/gl/deferredClearGBufferP.glsl | 2 +- .../advanced/gl/deferredShadingP.glsl | 8 +- .../lighting/advanced/gl/pointLightP.glsl | 6 +- .../lighting/advanced/gl/spotLightP.glsl | 6 +- .../lighting/advanced/gl/vectorLightP.glsl | 6 +- .../advanced/particlePointLightP.hlsl | 6 +- .../lighting/advanced/pointLightP.hlsl | 6 +- .../shaders/lighting/advanced/spotLightP.hlsl | 6 +- .../lighting/advanced/vectorLightP.hlsl | 6 +- .../game/core/shaders/particlesP.hlsl | 4 +- .../shaders/postFX/caustics/causticsP.hlsl | 4 +- .../shaders/postFX/caustics/gl/causticsP.glsl | 4 +- .../postFX/dof/gl/DOF_DownSample_P.glsl | 8 +- .../shaders/postFX/dof/gl/DOF_Final_P.glsl | 2 +- .../shaders/postFX/edgeaa/edgeDetectP.hlsl | 4 +- .../shaders/postFX/edgeaa/gl/edgeDetectP.glsl | 8 +- .../game/core/shaders/postFX/fogP.hlsl | 6 +- .../game/core/shaders/postFX/gl/fogP.glsl | 6 +- .../core/shaders/postFX/gl/motionBlurP.glsl | 8 +- .../shaders/postFX/gl/underwaterFogP.glsl | 6 +- .../postFX/lightRay/gl/lightRayOccludeP.glsl | 4 +- .../postFX/lightRay/lightRayOccludeP.hlsl | 4 +- .../shaders/postFX/mlaa/edgeDetectionP.hlsl | 14 +- .../postFX/mlaa/gl/edgeDetectionP.glsl | 14 +- .../game/core/shaders/postFX/motionBlurP.hlsl | 8 +- .../core/shaders/postFX/ssao/SSAO_Blur_P.hlsl | 6 +- .../game/core/shaders/postFX/ssao/SSAO_P.hlsl | 12 +- .../shaders/postFX/ssao/gl/SSAO_Blur_P.glsl | 6 +- .../core/shaders/postFX/ssao/gl/SSAO_P.glsl | 12 +- .../core/shaders/postFX/underwaterFogP.hlsl | 6 +- .../game/core/shaders/shaderModelAutoGen.hlsl | 4 +- .../core/shaders/water/gl/waterBasicP.glsl | 2 +- .../game/core/shaders/water/gl/waterP.glsl | 32 +-- .../game/core/shaders/water/waterBasicP.hlsl | 2 +- .../game/core/shaders/water/waterP.hlsl | 32 +-- .../tools/worldEditor/scripts/lightViz.cs | 14 +- .../scripts/shaders/dbgDepthVisualizeP.glsl | 4 +- .../scripts/shaders/dbgDepthVisualizeP.hlsl | 4 +- .../shaders/dbgLightColorVisualizeP.glsl | 4 +- .../shaders/dbgLightColorVisualizeP.hlsl | 4 +- .../shaders/dbgLightSpecularVisualizeP.glsl | 4 +- .../shaders/dbgLightSpecularVisualizeP.hlsl | 4 +- .../scripts/shaders/dbgNormalVisualizeP.glsl | 4 +- .../scripts/shaders/dbgNormalVisualizeP.hlsl | 4 +- 122 files changed, 641 insertions(+), 641 deletions(-) rename Engine/source/renderInstance/{renderPrePassMgr.cpp => renderDeferredMgr.cpp} (84%) rename Engine/source/renderInstance/{renderPrePassMgr.h => renderDeferredMgr.h} (76%) diff --git a/Engine/source/T3D/decal/decalManager.cpp b/Engine/source/T3D/decal/decalManager.cpp index 812fa099d..ab53842e5 100644 --- a/Engine/source/T3D/decal/decalManager.cpp +++ b/Engine/source/T3D/decal/decalManager.cpp @@ -1214,7 +1214,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // Make it the sort distance the max distance so that // it renders after all the other opaque geometry in - // the prepass bin. + // the deferred bin. baseRenderInst.sortDistSq = F32_MAX; Vector batches; diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 483ba75ce..d67fd1d71 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -47,7 +47,7 @@ #include "materials/sceneData.h" #include "materials/materialFeatureTypes.h" #include "materials/matInstance.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "console/engineAPI.h" /// This is used for rendering ground cover billboards. diff --git a/Engine/source/T3D/levelInfo.cpp b/Engine/source/T3D/levelInfo.cpp index 519b705e3..947172836 100644 --- a/Engine/source/T3D/levelInfo.cpp +++ b/Engine/source/T3D/levelInfo.cpp @@ -353,7 +353,7 @@ void LevelInfo::_onLMActivate(const char *lm, bool enable) { AssertFatal(dynamic_cast(LIGHTMGR), "Bad light manager type!"); AdvancedLightManager *lightMgr = static_cast(LIGHTMGR); - lightMgr->getLightBinManager()->MRTLightmapsDuringPrePass(mAdvancedLightmapSupport); + lightMgr->getLightBinManager()->MRTLightmapsDuringDeferred(mAdvancedLightmapSupport); } #endif } diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index c4f895fe9..d3314f4c9 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -100,7 +100,7 @@ VolumetricFog::VolumetricFog() mTypeMask |= EnvironmentObjectType | StaticObjectType; - mPrepassTarget = NULL; + mDeferredTarget = NULL; mDepthBufferTarget = NULL; mFrontBufferTarget = NULL; @@ -771,17 +771,17 @@ void VolumetricFog::_leaveFog(ShapeBase *control) bool VolumetricFog::setupRenderer() { - // Search for the prepass rendertarget and shadermacros. - mPrepassTarget = NamedTexTarget::find("prepass"); - if (!mPrepassTarget.isValid()) + // Search for the deferred rendertarget and shadermacros. + mDeferredTarget = NamedTexTarget::find("deferred"); + if (!mDeferredTarget.isValid()) { - Con::errorf("VolumetricFog::setupRenderer - could not find PrepassTarget"); + Con::errorf("VolumetricFog::setupRenderer - could not find DeferredTarget"); return false; } Vector macros; - if (mPrepassTarget) - mPrepassTarget->getShaderMacros(¯os); + if (mDeferredTarget) + mDeferredTarget->getShaderMacros(¯os); // Search the depth and frontbuffers which are created by the VolumetricFogRTManager @@ -799,27 +799,27 @@ bool VolumetricFog::setupRenderer() return false; } - // Find and setup the prepass Shader + // Find and setup the deferred Shader ShaderData *shaderData; - mPrePassShader = Sim::findObject("VolumetricFogPrePassShader", shaderData) ? + mDeferredShader = Sim::findObject("VolumetricFogDeferredShader", shaderData) ? shaderData->getShader() : NULL; - if (!mPrePassShader) + if (!mDeferredShader) { - Con::errorf("VolumetricFog::setupRenderer - could not find VolumetricFogPrePassShader"); + Con::errorf("VolumetricFog::setupRenderer - could not find VolumetricFogDeferredShader"); return false; } // Create ShaderConstBuffer and Handles - mPPShaderConsts = mPrePassShader->allocConstBuffer(); + mPPShaderConsts = mDeferredShader->allocConstBuffer(); if (mPPShaderConsts.isNull()) { Con::errorf("VolumetricFog::setupRenderer - could not allocate ShaderConstants 1."); return false; } - mPPModelViewProjSC = mPrePassShader->getShaderConstHandle("$modelView"); + mPPModelViewProjSC = mDeferredShader->getShaderConstHandle("$modelView"); // Find and setup the VolumetricFog Shader @@ -878,7 +878,7 @@ bool VolumetricFog::setupRenderer() mReflFogDensitySC = mReflectionShader->getShaderConstHandle("$fogDensity"); mReflFogStrengthSC = mReflectionShader->getShaderConstHandle("$reflStrength"); - // Create the prepass StateBlock + // Create the deferred StateBlock desc_preD.setCullMode(GFXCullCW); desc_preD.setBlend(true); @@ -895,7 +895,7 @@ bool VolumetricFog::setupRenderer() descD.setBlend(true); descD.setZReadWrite(false, false);// desc.setZReadWrite(true, false); - // prepassBuffer sampler + // deferredBuffer sampler descD.samplersDefined = true; descD.samplers[0].addressModeU = GFXAddressClamp; descD.samplers[0].addressModeV = GFXAddressClamp; @@ -1063,7 +1063,7 @@ void VolumetricFog::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMa mat.scale(mObjScale); GFX->multWorld(mat); - GFX->setShader(mPrePassShader); + GFX->setShader(mDeferredShader); GFX->setShaderConstBuffer(mPPShaderConsts); GFX->setStateBlock(mStateblock_preD); @@ -1127,9 +1127,9 @@ void VolumetricFog::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMa mShaderConsts->setSafe(mTexScaleSC, mTexScale * mFOV); mShaderConsts->setSafe(mTexTilesSC, mTexTiles); - GFXTextureObject *prepasstex = mPrepassTarget ? mPrepassTarget->getTexture(0) : NULL; + GFXTextureObject *deferredtex = mDeferredTarget ? mDeferredTarget->getTexture(0) : NULL; - GFX->setTexture(0, prepasstex); + GFX->setTexture(0, deferredtex); GFX->setTexture(1, mDepthBuffer); GFX->setTexture(2, mFrontBuffer); diff --git a/Engine/source/environment/VolumetricFog.h b/Engine/source/environment/VolumetricFog.h index ef2f39929..ce06aafaf 100644 --- a/Engine/source/environment/VolumetricFog.h +++ b/Engine/source/environment/VolumetricFog.h @@ -80,7 +80,7 @@ class VolumetricFog : public SceneObject protected: // Rendertargets; GFXTextureTargetRef z_buf; - NamedTexTargetRef mPrepassTarget; + NamedTexTargetRef mDeferredTarget; NamedTexTargetRef mDepthBufferTarget; NamedTexTargetRef mFrontBufferTarget; @@ -89,7 +89,7 @@ class VolumetricFog : public SceneObject // Shaders GFXShaderRef mShader; - GFXShaderRef mPrePassShader; + GFXShaderRef mDeferredShader; GFXShaderRef mReflectionShader; // Stateblocks diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index 10a93ca06..edf4c725b 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/Engine/source/environment/decalRoad.cpp @@ -739,7 +739,7 @@ void DecalRoad::prepRenderImage( SceneRenderState* state ) // Make it the sort distance the max distance so that // it renders after all the other opaque geometry in - // the prepass bin. + // the deferred bin. coreRI.sortDistSq = F32_MAX; // If we need lights then set them up. diff --git a/Engine/source/environment/waterObject.cpp b/Engine/source/environment/waterObject.cpp index 20df80258..45f4fc4d6 100644 --- a/Engine/source/environment/waterObject.cpp +++ b/Engine/source/environment/waterObject.cpp @@ -161,7 +161,7 @@ ConsoleDocClass( WaterObject, "\t- Paramable water fog and color shift.\n\n" "It will, however, look significantly different depending on the LightingManager " - "that is active. With Basic Lighting, we do not have a prepass texture to " + "that is active. With Basic Lighting, we do not have a deferred texture to " "lookup per-pixel depth and therefore cannot use our rendering techniques that depend on it.\n\n" "In particular, the following field groups are not used under Basic Lighting:\n" diff --git a/Engine/source/lighting/advanced/advancedLightBinManager.cpp b/Engine/source/lighting/advanced/advancedLightBinManager.cpp index 0dd9f59c8..802a8545d 100644 --- a/Engine/source/lighting/advanced/advancedLightBinManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightBinManager.cpp @@ -29,7 +29,7 @@ #include "lighting/shadowMap/shadowMapPass.h" #include "lighting/shadowMap/lightShadowMap.h" #include "lighting/common/lightMapParams.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "gfx/gfxTransformSaver.h" #include "scene/sceneManager.h" #include "scene/sceneRenderState.h" @@ -130,7 +130,7 @@ AdvancedLightBinManager::AdvancedLightBinManager( AdvancedLightManager *lm /* = // We want a full-resolution buffer mTargetSizeType = RenderTexTargetBinManager::WindowSize; - mMRTLightmapsDuringPrePass = false; + mMRTLightmapsDuringDeferred = false; Con::NotifyDelegate callback( this, &AdvancedLightBinManager::_deleteLightMaterials ); Con::addVariableNotify( "$pref::Shadows::filterMode", callback ); @@ -253,7 +253,7 @@ void AdvancedLightBinManager::render( SceneRenderState *state ) return; // Clear as long as there isn't MRT population of light buffer with lightmap data - if ( !MRTLightmapsDuringPrePass() ) + if ( !MRTLightmapsDuringDeferred() ) GFX->clear(GFXClearTarget, ColorI(0, 0, 0, 0), 1.0f, 0); // Restore transforms @@ -550,23 +550,23 @@ void AdvancedLightBinManager::setupSGData( SceneData &data, const SceneRenderSta } } -void AdvancedLightBinManager::MRTLightmapsDuringPrePass( bool val ) +void AdvancedLightBinManager::MRTLightmapsDuringDeferred( bool val ) { // Do not enable if the GFX device can't do MRT's if ( GFX->getNumRenderTargets() < 2 ) val = false; - if ( mMRTLightmapsDuringPrePass != val ) + if ( mMRTLightmapsDuringDeferred != val ) { - mMRTLightmapsDuringPrePass = val; + mMRTLightmapsDuringDeferred = val; - // Reload materials to cause a feature recalculation on prepass materials + // Reload materials to cause a feature recalculation on deferred materials if(mLightManager->isActive()) MATMGR->flushAndReInitInstances(); - RenderPrePassMgr *prepass; - if ( Sim::findObject( "AL_PrePassBin", prepass ) && prepass->getTargetTexture( 0 ) ) - prepass->updateTargets(); + RenderDeferredMgr *deferred; + if ( Sim::findObject( "AL_DeferredBin", deferred ) && deferred->getTargetTexture( 0 ) ) + deferred->updateTargets(); } } @@ -834,21 +834,21 @@ bool LightMatInstance::init( const FeatureSet &features, const GFXVertexFormat * // in the same way. litState.separateAlphaBlendDefined = true; litState.separateAlphaBlendEnable = false; - litState.stencilMask = RenderPrePassMgr::OpaqueDynamicLitMask | RenderPrePassMgr::OpaqueStaticLitMask; + litState.stencilMask = RenderDeferredMgr::OpaqueDynamicLitMask | RenderDeferredMgr::OpaqueStaticLitMask; mLitState[DynamicLight] = GFX->createStateBlock(litState); // StaticLightNonLMGeometry State: This will treat non-lightmapped geometry // in the usual way, but will not effect lightmapped geometry. litState.separateAlphaBlendDefined = true; litState.separateAlphaBlendEnable = false; - litState.stencilMask = RenderPrePassMgr::OpaqueDynamicLitMask; + litState.stencilMask = RenderDeferredMgr::OpaqueDynamicLitMask; mLitState[StaticLightNonLMGeometry] = GFX->createStateBlock(litState); // StaticLightLMGeometry State: This will add specular information (alpha) but // multiply-darken color information. litState.blendDest = GFXBlendSrcColor; litState.blendSrc = GFXBlendZero; - litState.stencilMask = RenderPrePassMgr::OpaqueStaticLitMask; + litState.stencilMask = RenderDeferredMgr::OpaqueStaticLitMask; litState.separateAlphaBlendDefined = true; litState.separateAlphaBlendEnable = true; litState.separateAlphaBlendSrc = GFXBlendOne; diff --git a/Engine/source/lighting/advanced/advancedLightBinManager.h b/Engine/source/lighting/advanced/advancedLightBinManager.h index 879d62cbb..1b94c10c7 100644 --- a/Engine/source/lighting/advanced/advancedLightBinManager.h +++ b/Engine/source/lighting/advanced/advancedLightBinManager.h @@ -121,8 +121,8 @@ public: // ConsoleObject interface DECLARE_CONOBJECT(AdvancedLightBinManager); - bool MRTLightmapsDuringPrePass() const { return mMRTLightmapsDuringPrePass; } - void MRTLightmapsDuringPrePass(bool val); + bool MRTLightmapsDuringDeferred() const { return mMRTLightmapsDuringDeferred; } + void MRTLightmapsDuringDeferred(bool val); typedef Signal RenderSignal; @@ -195,7 +195,7 @@ protected: Vector mLightBin; typedef Vector::iterator LightBinIterator; - bool mMRTLightmapsDuringPrePass; + bool mMRTLightmapsDuringDeferred; /// Used in setupSGData to set the object transform. MatrixF mLightMat; diff --git a/Engine/source/lighting/advanced/advancedLightManager.cpp b/Engine/source/lighting/advanced/advancedLightManager.cpp index baefa15b5..de984894a 100644 --- a/Engine/source/lighting/advanced/advancedLightManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightManager.cpp @@ -30,7 +30,7 @@ #include "lighting/common/sceneLighting.h" #include "lighting/common/lightMapParams.h" #include "core/util/safeDelete.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "materials/materialManager.h" #include "math/util/sphereMesh.h" #include "console/consoleTypes.h" @@ -115,27 +115,27 @@ void AdvancedLightManager::activate( SceneManager *sceneManager ) mLightBinManager = new AdvancedLightBinManager( this, SHADOWMGR, blendTargetFormat ); mLightBinManager->assignName( "AL_LightBinMgr" ); - // First look for the prepass bin... - RenderPrePassMgr *prePassBin = _findPrePassRenderBin(); + // First look for the deferred bin... + RenderDeferredMgr *prePassBin = _findDeferredRenderBin(); - // If we didn't find the prepass bin then add one. + // If we didn't find the deferred bin then add one. if ( !prePassBin ) { - prePassBin = new RenderPrePassMgr( true, blendTargetFormat ); - prePassBin->assignName( "AL_PrePassBin" ); + prePassBin = new RenderDeferredMgr( true, blendTargetFormat ); + prePassBin->assignName( "AL_DeferredBin" ); prePassBin->registerObject(); getSceneManager()->getDefaultRenderPass()->addManager( prePassBin ); - mPrePassRenderBin = prePassBin; + mDeferredRenderBin = prePassBin; } - // Tell the material manager that prepass is enabled. - MATMGR->setPrePassEnabled( true ); + // Tell the material manager that deferred is enabled. + MATMGR->setDeferredEnabled( true ); // Insert our light bin manager. mLightBinManager->setRenderOrder( prePassBin->getRenderOrder() + 0.01f ); getSceneManager()->getDefaultRenderPass()->addManager( mLightBinManager ); - AdvancedLightingFeatures::registerFeatures(mPrePassRenderBin->getTargetFormat(), mLightBinManager->getTargetFormat()); + AdvancedLightingFeatures::registerFeatures(mDeferredRenderBin->getTargetFormat(), mLightBinManager->getTargetFormat()); // Last thing... let everyone know we're active. smActivateSignal.trigger( getId(), true ); @@ -151,14 +151,14 @@ void AdvancedLightManager::deactivate() // removing itself from the render passes. if( mLightBinManager ) { - mLightBinManager->MRTLightmapsDuringPrePass(false); + mLightBinManager->MRTLightmapsDuringDeferred(false); mLightBinManager->deleteObject(); } mLightBinManager = NULL; - if ( mPrePassRenderBin ) - mPrePassRenderBin->deleteObject(); - mPrePassRenderBin = NULL; + if ( mDeferredRenderBin ) + mDeferredRenderBin->deleteObject(); + mDeferredRenderBin = NULL; SHADOWMGR->deactivate(); @@ -348,8 +348,8 @@ void AdvancedLightManager::setLightInfo( ProcessedMaterial *pmat, U32 pass, GFXShaderConstBuffer *shaderConsts) { - // Skip this if we're rendering from the prepass bin. - if ( sgData.binType == SceneData::PrePassBin ) + // Skip this if we're rendering from the deferred bin. + if ( sgData.binType == SceneData::DeferredBin ) return; PROFILE_SCOPE(AdvancedLightManager_setLightInfo); diff --git a/Engine/source/lighting/advanced/advancedLightManager.h b/Engine/source/lighting/advanced/advancedLightManager.h index efdf4fa32..ac03bad48 100644 --- a/Engine/source/lighting/advanced/advancedLightManager.h +++ b/Engine/source/lighting/advanced/advancedLightManager.h @@ -54,7 +54,7 @@ class AvailableSLInterfaces; class AdvancedLightBinManager; -class RenderPrePassMgr; +class RenderDeferredMgr; class BaseMatInstance; class MaterialParameters; class MaterialParameterHandle; @@ -115,7 +115,7 @@ protected: SimObjectPtr mLightBinManager; - SimObjectPtr mPrePassRenderBin; + SimObjectPtr mDeferredRenderBin; LightConstantMap mConstantLookup; diff --git a/Engine/source/lighting/advanced/advancedLightingFeatures.cpp b/Engine/source/lighting/advanced/advancedLightingFeatures.cpp index bac201b2d..d70202ab4 100644 --- a/Engine/source/lighting/advanced/advancedLightingFeatures.cpp +++ b/Engine/source/lighting/advanced/advancedLightingFeatures.cpp @@ -44,7 +44,7 @@ bool AdvancedLightingFeatures::smFeaturesRegistered = false; -void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetFormat, const GFXFormat &lightInfoTargetFormat ) +void AdvancedLightingFeatures::registerFeatures( const GFXFormat &deferredTargetFormat, const GFXFormat &lightInfoTargetFormat ) { AssertFatal( !smFeaturesRegistered, "AdvancedLightingFeatures::registerFeatures() - Features already registered. Bad!" ); @@ -56,8 +56,8 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF if(GFX->getAdapterType() == OpenGL) { #if defined( TORQUE_OPENGL ) - cond = new GBufferConditionerGLSL( prepassTargetFormat, GBufferConditionerGLSL::ViewSpace ); - FEATUREMGR->registerFeature(MFT_PrePassConditioner, cond); + cond = new GBufferConditionerGLSL( deferredTargetFormat, GBufferConditionerGLSL::ViewSpace ); + FEATUREMGR->registerFeature(MFT_DeferredConditioner, cond); FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatGLSL()); FEATUREMGR->registerFeature(MFT_NormalMap, new DeferredBumpFeatGLSL()); FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularGLSL()); @@ -68,8 +68,8 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF else { #if defined( TORQUE_OS_WIN ) - cond = new GBufferConditionerHLSL( prepassTargetFormat, GBufferConditionerHLSL::ViewSpace ); - FEATUREMGR->registerFeature(MFT_PrePassConditioner, cond); + cond = new GBufferConditionerHLSL( deferredTargetFormat, GBufferConditionerHLSL::ViewSpace ); + FEATUREMGR->registerFeature(MFT_DeferredConditioner, cond); FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatHLSL()); FEATUREMGR->registerFeature(MFT_NormalMap, new DeferredBumpFeatHLSL()); FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularHLSL()); @@ -78,7 +78,7 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF #endif } - NamedTexTarget *target = NamedTexTarget::find( "prepass" ); + NamedTexTarget *target = NamedTexTarget::find( "deferred" ); if ( target ) target->setConditioner( cond ); @@ -87,11 +87,11 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF void AdvancedLightingFeatures::unregisterFeatures() { - NamedTexTarget *target = NamedTexTarget::find( "prepass" ); + NamedTexTarget *target = NamedTexTarget::find( "deferred" ); if ( target ) target->setConditioner( NULL ); - FEATUREMGR->unregisterFeature(MFT_PrePassConditioner); + FEATUREMGR->unregisterFeature(MFT_DeferredConditioner); FEATUREMGR->unregisterFeature(MFT_RTLighting); FEATUREMGR->unregisterFeature(MFT_NormalMap); FEATUREMGR->unregisterFeature(MFT_PixSpecular); diff --git a/Engine/source/lighting/advanced/advancedLightingFeatures.h b/Engine/source/lighting/advanced/advancedLightingFeatures.h index 7cbfe1761..26831af4c 100644 --- a/Engine/source/lighting/advanced/advancedLightingFeatures.h +++ b/Engine/source/lighting/advanced/advancedLightingFeatures.h @@ -31,7 +31,7 @@ class AdvancedLightingFeatures { public: - static void registerFeatures( const GFXFormat &prepassTargetFormat, const GFXFormat &lightInfoTargetFormat ); + static void registerFeatures( const GFXFormat &deferredTargetFormat, const GFXFormat &lightInfoTargetFormat ); static void unregisterFeatures(); private: diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp index c97fbbcf5..513b3e2af 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp @@ -27,7 +27,7 @@ #include "shaderGen/langElement.h" #include "shaderGen/shaderOp.h" #include "shaderGen/conditionerFeature.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "materials/processedMaterial.h" #include "materials/materialFeatureTypes.h" @@ -144,7 +144,7 @@ void DeferredRTLightingFeatGLSL::processPix( Vector &component unconditionLightInfo.c_str() ), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular ) ); // If this has an interlaced pre-pass, do averaging here - if( fd.features[MFT_InterlacedPrePass] ) + if( fd.features[MFT_InterlacedDeferred] ) { Var *oneOverTargetSize = (Var*) LangElement::find( "oneOverTargetSize" ); if( !oneOverTargetSize ) @@ -216,7 +216,7 @@ void DeferredRTLightingFeatGLSL::setTexData( Material::StageData &stageDat, void DeferredBumpFeatGLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { - if( fd.features[MFT_PrePassConditioner] ) + if( fd.features[MFT_DeferredConditioner] ) { // There is an output conditioner active, so we need to supply a transform // to the pixel shader. @@ -264,7 +264,7 @@ void DeferredBumpFeatGLSL::processPix( Vector &componentList, // NULL output in case nothing gets handled output = NULL; - if( fd.features[MFT_PrePassConditioner] ) + if( fd.features[MFT_DeferredConditioner] ) { MultiLine *meta = new MultiLine; @@ -312,7 +312,7 @@ void DeferredBumpFeatGLSL::processPix( Vector &componentList, } // This var is read from GBufferConditionerGLSL and - // used in the prepass output. + // used in the deferred output. // // By using the 'half' type here we get a bunch of partial // precision optimized code on further operations on the normal @@ -425,7 +425,7 @@ ShaderFeature::Resources DeferredBumpFeatGLSL::getResources( const MaterialFeatu res.numTex = 1; res.numTexReg = 1; - if ( fd.features[MFT_PrePassConditioner] && + if ( fd.features[MFT_DeferredConditioner] && fd.features.hasFeature( MFT_DetailNormalMap ) ) { res.numTex += 1; @@ -450,7 +450,7 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat, return; } - if (!fd.features[MFT_PrePassConditioner] && fd.features[MFT_AccuMap]) + if (!fd.features[MFT_DeferredConditioner] && fd.features[MFT_AccuMap]) { passData.mTexType[texIndex] = Material::Bump; passData.mSamplerNames[texIndex] = "bumpMap"; @@ -464,14 +464,14 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat, } } else if (!fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] && - ( fd.features[MFT_PrePassConditioner] || + ( fd.features[MFT_DeferredConditioner] || fd.features[MFT_PixSpecular] ) ) { passData.mTexType[ texIndex ] = Material::Bump; passData.mSamplerNames[ texIndex ] = "bumpMap"; passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_NormalMap ); - if ( fd.features[MFT_PrePassConditioner] && + if ( fd.features[MFT_DeferredConditioner] && fd.features.hasFeature( MFT_DetailNormalMap ) ) { passData.mTexType[ texIndex ] = Material::DetailBump; @@ -604,11 +604,11 @@ void DeferredMinnaertGLSL::setTexData( Material::StageData &stageDat, { if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] ) { - NamedTexTarget *texTarget = NamedTexTarget::find(RenderPrePassMgr::BufferName); + NamedTexTarget *texTarget = NamedTexTarget::find(RenderDeferredMgr::BufferName); if ( texTarget ) { passData.mTexType[texIndex] = Material::TexTarget; - passData.mSamplerNames[texIndex] = "prepassBuffer"; + passData.mSamplerNames[texIndex] = "deferredBuffer"; passData.mTexSlot[ texIndex++ ].texTarget = texTarget; } } @@ -620,11 +620,11 @@ void DeferredMinnaertGLSL::processPixMacros( Vector ¯os, if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] ) { // Pull in the uncondition method for the g buffer - NamedTexTarget *texTarget = NamedTexTarget::find( RenderPrePassMgr::BufferName ); + NamedTexTarget *texTarget = NamedTexTarget::find( RenderDeferredMgr::BufferName ); if ( texTarget && texTarget->getConditioner() ) { ConditionerMethodDependency *unconditionMethod = texTarget->getConditioner()->getConditionerMethodDependency(ConditionerFeature::UnconditionMethod); - unconditionMethod->createMethodMacro( String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition", macros ); + unconditionMethod->createMethodMacro( String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition", macros ); addDependency(unconditionMethod); } } @@ -664,12 +664,12 @@ void DeferredMinnaertGLSL::processPix( Vector &componentList, minnaertConstant->constSortPos = cspPotentialPrimitive; // create texture var - Var *prepassBuffer = new Var; - prepassBuffer->setType( "sampler2D" ); - prepassBuffer->setName( "prepassBuffer" ); - prepassBuffer->uniform = true; - prepassBuffer->sampler = true; - prepassBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here + Var *deferredBuffer = new Var; + deferredBuffer->setType( "sampler2D" ); + deferredBuffer->setName( "deferredBuffer" ); + deferredBuffer->uniform = true; + deferredBuffer->sampler = true; + deferredBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here // Texture coord Var *uvScene = (Var*) LangElement::find( "uvScene" ); @@ -680,11 +680,11 @@ void DeferredMinnaertGLSL::processPix( Vector &componentList, // Get the world space view vector. Var *wsViewVec = getWsView( getInWsPosition( componentList ), meta ); - String unconditionPrePassMethod = String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition"; + String unconditionDeferredMethod = String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition"; Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" ); - meta->addStatement( new GenOp( avar( " vec4 normalDepth = %s(@, @);\r\n", unconditionPrePassMethod.c_str() ), prepassBuffer, uvScene ) ); + meta->addStatement( new GenOp( avar( " vec4 normalDepth = %s(@, @);\r\n", unconditionDeferredMethod.c_str() ), deferredBuffer, uvScene ) ); meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) ); meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) ); meta->addStatement( new GenOp( " @;\r\n", assignColor( new GenOp( "vec4(Minnaert, Minnaert, Minnaert, 1.0)" ), Material::Mul ) ) ); diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.h b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.h index 0e326de6a..f55dcbeb5 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.h +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.h @@ -30,13 +30,13 @@ class ConditionerMethodDependency; -/// Lights the pixel by sampling from the light prepass +/// Lights the pixel by sampling from the light deferred /// buffer. It will fall back to forward lighting /// functionality for non-deferred rendered surfaces. /// /// Also note that this feature is only used in the /// forward rendering pass. It is not used during the -/// prepass step. +/// deferred step. /// class DeferredRTLightingFeatGLSL : public RTLightingFeatGLSL { @@ -103,7 +103,7 @@ public: /// Generates specular highlights in the forward pass -/// from the light prepass buffer. +/// from the light deferred buffer. class DeferredPixelSpecularGLSL : public PixelSpecularGLSL { typedef PixelSpecularGLSL Parent; diff --git a/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp index bfa39779e..b1f97722f 100644 --- a/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp @@ -27,7 +27,7 @@ #include "shaderGen/langElement.h" #include "shaderGen/shaderOp.h" #include "shaderGen/conditionerFeature.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "materials/processedMaterial.h" #include "materials/materialFeatureTypes.h" diff --git a/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp b/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp index 095f4ea9e..65e55e6c1 100644 --- a/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp @@ -163,7 +163,7 @@ void GBufferConditionerGLSL::processPix( Vector &componentLis LangElement *outputDecl = new DecOp( unconditionedOut ); - // If we're doing prepass blending then we need + // If we're doing deferred blending then we need // to steal away the alpha channel before the // conditioner stomps on it. Var *alphaVal = NULL; @@ -174,7 +174,7 @@ void GBufferConditionerGLSL::processPix( Vector &componentLis } // If using interlaced normals, invert the normal - if(fd.features[MFT_InterlacedPrePass]) + if(fd.features[MFT_InterlacedDeferred]) { // NOTE: Its safe to not call ShaderFeatureGLSL::addOutVpos() in the vertex // shader as for SM 3.0 nothing is needed there. @@ -190,7 +190,7 @@ void GBufferConditionerGLSL::processPix( Vector &componentLis meta->addStatement( new GenOp(" @ = @;", outputDecl, new GenOp( "float4(normalize(@), @)", gbNormal, depth ) ) ); meta->addStatement( assignOutput( unconditionedOut ) ); - // If we have an alpha var then we're doing prepass lerp blending. + // If we have an alpha var then we're doing deferred lerp blending. if ( alphaVal ) { Var *outColor = (Var*)LangElement::find( getOutputTargetVarName( DefaultTarget ) ); @@ -227,10 +227,10 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str methodVar->setType("float4"); DecOp *methodDecl = new DecOp(methodVar); - Var *prepassSampler = new Var; - prepassSampler->setName("prepassSamplerVar"); - prepassSampler->setType("sampler2D"); - DecOp *prepassSamplerDecl = new DecOp(prepassSampler); + Var *deferredSampler = new Var; + deferredSampler->setName("deferredSamplerVar"); + deferredSampler->setType("sampler2D"); + DecOp *deferredSamplerDecl = new DecOp(deferredSampler); Var *screenUV = new Var; screenUV->setName("screenUVVar"); @@ -242,7 +242,7 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str bufferSample->setType("float4"); DecOp *bufferSampleDecl = new DecOp(bufferSample); - meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) ); + meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) ); meta->addStatement( new GenOp( "{\r\n" ) ); @@ -250,14 +250,14 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str #ifdef TORQUE_OS_XENON meta->addStatement( new GenOp( " @;\r\n", bufferSampleDecl ) ); - meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, prepassSampler ) ); + meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, deferredSampler ) ); #else // The gbuffer has no mipmaps, so use tex2dlod when // possible so that the shader compiler can optimize. meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) ); - meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV ) ); + meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV ) ); meta->addStatement( new GenOp( " #else\r\n" ) ); - meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV ) ); + meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV ) ); meta->addStatement( new GenOp( " #endif\r\n\r\n" ) ); #endif diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index 172eb65c8..8065aae99 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -27,7 +27,7 @@ #include "shaderGen/langElement.h" #include "shaderGen/shaderOp.h" #include "shaderGen/conditionerFeature.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "materials/processedMaterial.h" #include "materials/materialFeatureTypes.h" @@ -160,7 +160,7 @@ void DeferredRTLightingFeatHLSL::processPix( Vector &component unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular)); // If this has an interlaced pre-pass, do averaging here - if( fd.features[MFT_InterlacedPrePass] ) + if( fd.features[MFT_InterlacedDeferred] ) { Var *oneOverTargetSize = (Var*) LangElement::find( "oneOverTargetSize" ); if( !oneOverTargetSize ) @@ -236,7 +236,7 @@ void DeferredRTLightingFeatHLSL::setTexData( Material::StageData &stageDat, void DeferredBumpFeatHLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { - if( fd.features[MFT_PrePassConditioner] ) + if( fd.features[MFT_DeferredConditioner] ) { // There is an output conditioner active, so we need to supply a transform // to the pixel shader. @@ -284,7 +284,7 @@ void DeferredBumpFeatHLSL::processPix( Vector &componentList, // NULL output in case nothing gets handled output = NULL; - if( fd.features[MFT_PrePassConditioner] ) + if( fd.features[MFT_DeferredConditioner] ) { MultiLine *meta = new MultiLine; @@ -358,7 +358,7 @@ void DeferredBumpFeatHLSL::processPix( Vector &componentList, } // This var is read from GBufferConditionerHLSL and - // used in the prepass output. + // used in the deferred output. // // By using the 'half' type here we get a bunch of partial // precision optimized code on further operations on the normal @@ -500,7 +500,7 @@ ShaderFeature::Resources DeferredBumpFeatHLSL::getResources( const MaterialFeatu res.numTex = 1; res.numTexReg = 1; - if ( fd.features[MFT_PrePassConditioner] && + if ( fd.features[MFT_DeferredConditioner] && fd.features.hasFeature( MFT_DetailNormalMap ) ) { res.numTex += 1; @@ -525,7 +525,7 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat, return; } - if ( !fd.features[MFT_PrePassConditioner] && fd.features[MFT_AccuMap] ) + if ( !fd.features[MFT_DeferredConditioner] && fd.features[MFT_AccuMap] ) { passData.mTexType[ texIndex ] = Material::Bump; passData.mSamplerNames[ texIndex ] = "bumpMap"; @@ -539,14 +539,14 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat, } } else if ( !fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] && - ( fd.features[MFT_PrePassConditioner] || + ( fd.features[MFT_DeferredConditioner] || fd.features[MFT_PixSpecular] ) ) { passData.mTexType[ texIndex ] = Material::Bump; passData.mSamplerNames[ texIndex ] = "bumpMap"; passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_NormalMap ); - if ( fd.features[MFT_PrePassConditioner] && + if ( fd.features[MFT_DeferredConditioner] && fd.features.hasFeature( MFT_DetailNormalMap ) ) { passData.mTexType[ texIndex ] = Material::DetailBump; @@ -681,11 +681,11 @@ void DeferredMinnaertHLSL::setTexData( Material::StageData &stageDat, { if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] ) { - NamedTexTarget *texTarget = NamedTexTarget::find(RenderPrePassMgr::BufferName); + NamedTexTarget *texTarget = NamedTexTarget::find(RenderDeferredMgr::BufferName); if ( texTarget ) { passData.mTexType[texIndex] = Material::TexTarget; - passData.mSamplerNames[texIndex] = "prepassBuffer"; + passData.mSamplerNames[texIndex] = "deferredBuffer"; passData.mTexSlot[ texIndex++ ].texTarget = texTarget; } } @@ -697,11 +697,11 @@ void DeferredMinnaertHLSL::processPixMacros( Vector ¯os, if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] ) { // Pull in the uncondition method for the g buffer - NamedTexTarget *texTarget = NamedTexTarget::find( RenderPrePassMgr::BufferName ); + NamedTexTarget *texTarget = NamedTexTarget::find( RenderDeferredMgr::BufferName ); if ( texTarget && texTarget->getConditioner() ) { ConditionerMethodDependency *unconditionMethod = texTarget->getConditioner()->getConditionerMethodDependency(ConditionerFeature::UnconditionMethod); - unconditionMethod->createMethodMacro( String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition", macros ); + unconditionMethod->createMethodMacro( String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition", macros ); addDependency(unconditionMethod); } } @@ -741,23 +741,23 @@ void DeferredMinnaertHLSL::processPix( Vector &componentList, minnaertConstant->constSortPos = cspPotentialPrimitive; // create texture var - Var *prepassBuffer = new Var; - prepassBuffer->setType( "sampler2D" ); - prepassBuffer->setName( "prepassBuffer" ); - prepassBuffer->uniform = true; - prepassBuffer->sampler = true; - prepassBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here + Var *deferredBuffer = new Var; + deferredBuffer->setType( "sampler2D" ); + deferredBuffer->setName( "deferredBuffer" ); + deferredBuffer->uniform = true; + deferredBuffer->sampler = true; + deferredBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here Var* prePassTex = NULL; if (mIsDirect3D11) { - prepassBuffer->setType("SamplerState"); + deferredBuffer->setType("SamplerState"); prePassTex = new Var; prePassTex->setName("prePassTex"); prePassTex->setType("Texture2D"); prePassTex->uniform = true; prePassTex->texture = true; - prePassTex->constNum = prepassBuffer->constNum; + prePassTex->constNum = deferredBuffer->constNum; } // Texture coord @@ -769,14 +769,14 @@ void DeferredMinnaertHLSL::processPix( Vector &componentList, // Get the world space view vector. Var *wsViewVec = getWsView( getInWsPosition( componentList ), meta ); - String unconditionPrePassMethod = String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition"; + String unconditionDeferredMethod = String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition"; Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" ); if (mIsDirect3D11) - meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionPrePassMethod.c_str()), prepassBuffer, prePassTex, uvScene)); + meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, prePassTex, uvScene)); else - meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionPrePassMethod.c_str()), prepassBuffer, uvScene)); + meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, uvScene)); meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) ); meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) ); diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h index d1035398c..9d81a8104 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h @@ -30,13 +30,13 @@ class ConditionerMethodDependency; -/// Lights the pixel by sampling from the light prepass +/// Lights the pixel by sampling from the light deferred /// buffer. It will fall back to forward lighting /// functionality for non-deferred rendered surfaces. /// /// Also note that this feature is only used in the /// forward rendering pass. It is not used during the -/// prepass step. +/// deferred step. /// class DeferredRTLightingFeatHLSL : public RTLightingFeatHLSL { @@ -103,7 +103,7 @@ public: /// Generates specular highlights in the forward pass -/// from the light prepass buffer. +/// from the light deferred buffer. class DeferredPixelSpecularHLSL : public PixelSpecularHLSL { typedef PixelSpecularHLSL Parent; diff --git a/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp index 25c86b7bc..f8934d443 100644 --- a/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp @@ -27,7 +27,7 @@ #include "shaderGen/langElement.h" #include "shaderGen/shaderOp.h" #include "shaderGen/conditionerFeature.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "materials/processedMaterial.h" #include "materials/materialFeatureTypes.h" diff --git a/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp b/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp index d03a40ecd..4dba5e4a5 100644 --- a/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp @@ -163,7 +163,7 @@ void GBufferConditionerHLSL::processPix( Vector &componentLis LangElement *outputDecl = new DecOp( unconditionedOut ); - // If we're doing prepass blending then we need + // If we're doing deferred blending then we need // to steal away the alpha channel before the // conditioner stomps on it. Var *alphaVal = NULL; @@ -174,7 +174,7 @@ void GBufferConditionerHLSL::processPix( Vector &componentLis } // If using interlaced normals, invert the normal - if(fd.features[MFT_InterlacedPrePass]) + if(fd.features[MFT_InterlacedDeferred]) { // NOTE: Its safe to not call ShaderFeatureHLSL::addOutVpos() in the vertex // shader as for SM 3.0 nothing is needed there. @@ -190,7 +190,7 @@ void GBufferConditionerHLSL::processPix( Vector &componentLis meta->addStatement( new GenOp(" @ = @;", outputDecl, new GenOp( "float4(normalize(@), @)", gbNormal, depth ) ) ); meta->addStatement( assignOutput( unconditionedOut ) ); - // If we have an alpha var then we're doing prepass lerp blending. + // If we have an alpha var then we're doing deferred lerp blending. if ( alphaVal ) { Var *outColor = (Var*)LangElement::find( getOutputTargetVarName( DefaultTarget ) ); @@ -228,27 +228,27 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str methodVar->setType("inline float4"); DecOp *methodDecl = new DecOp(methodVar); - Var *prepassSampler = new Var; - prepassSampler->setName("prepassSamplerVar"); - prepassSampler->setType("sampler2D"); - DecOp *prepassSamplerDecl = new DecOp(prepassSampler); + Var *deferredSampler = new Var; + deferredSampler->setName("deferredSamplerVar"); + deferredSampler->setType("sampler2D"); + DecOp *deferredSamplerDecl = new DecOp(deferredSampler); Var *screenUV = new Var; screenUV->setName("screenUVVar"); screenUV->setType("float2"); DecOp *screenUVDecl = new DecOp(screenUV); - Var *prepassTex = NULL; - DecOp *prepassTexDecl = NULL; + Var *deferredTex = NULL; + DecOp *deferredTexDecl = NULL; if (isDirect3D11) { - prepassSampler->setType("SamplerState"); - prepassTex = new Var; - prepassTex->setName("prepassTexVar"); - prepassTex->setType("Texture2D"); - prepassTex->texture = true; - prepassTex->constNum = prepassSampler->constNum; - prepassTexDecl = new DecOp(prepassTex); + deferredSampler->setType("SamplerState"); + deferredTex = new Var; + deferredTex->setName("deferredTexVar"); + deferredTex->setType("Texture2D"); + deferredTex->texture = true; + deferredTex->constNum = deferredSampler->constNum; + deferredTexDecl = new DecOp(deferredTex); } Var *bufferSample = new Var; @@ -257,9 +257,9 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str DecOp *bufferSampleDecl = new DecOp(bufferSample); if (isDirect3D11) - meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, prepassSamplerDecl, prepassTexDecl, screenUVDecl)); + meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, deferredSamplerDecl, deferredTexDecl, screenUVDecl)); else - meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) ); + meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) ); meta->addStatement( new GenOp( "{\r\n" ) ); @@ -267,18 +267,18 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str #ifdef TORQUE_OS_XENON meta->addStatement( new GenOp( " @;\r\n", bufferSampleDecl ) ); - meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, prepassSampler ) ); + meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, deferredSampler ) ); #else // The gbuffer has no mipmaps, so use tex2dlod when // possible so that the shader compiler can optimize. meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) ); if (isDirect3D11) - meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, prepassTex, prepassSampler, screenUV)); + meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, deferredTex, deferredSampler, screenUV)); else - meta->addStatement(new GenOp(" @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV)); + meta->addStatement(new GenOp(" @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV)); meta->addStatement(new GenOp(" #else\r\n")); - meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV)); + meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV)); meta->addStatement(new GenOp(" #endif\r\n\r\n")); #endif diff --git a/Engine/source/lighting/basic/basicLightManager.cpp b/Engine/source/lighting/basic/basicLightManager.cpp index 952814053..f062cad48 100644 --- a/Engine/source/lighting/basic/basicLightManager.cpp +++ b/Engine/source/lighting/basic/basicLightManager.cpp @@ -39,7 +39,7 @@ #include "materials/materialFeatureTypes.h" #include "math/util/frustum.h" #include "scene/sceneObject.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "shaderGen/featureMgr.h" #include "shaderGen/HLSL/shaderFeatureHLSL.h" #include "shaderGen/HLSL/bumpHLSL.h" @@ -184,8 +184,8 @@ void BasicLightManager::activate( SceneManager *sceneManager ) FEATUREMGR->unregisterFeature( MFT_MinnaertShading ); FEATUREMGR->unregisterFeature( MFT_SubSurface ); - // First look for the prepass bin... - RenderPrePassMgr *prePassBin = _findPrePassRenderBin(); + // First look for the deferred bin... + RenderDeferredMgr *prePassBin = _findDeferredRenderBin(); /* // If you would like to use forward shading, and have a linear depth pre-pass @@ -204,19 +204,19 @@ void BasicLightManager::activate( SceneManager *sceneManager ) // Uncomment this for a no-color-write z-fill pass. //linearDepthFormat = GFXFormat_COUNT; - prePassBin = new RenderPrePassMgr( linearDepthFormat != GFXFormat_COUNT, linearDepthFormat ); + prePassBin = new RenderDeferredMgr( linearDepthFormat != GFXFormat_COUNT, linearDepthFormat ); prePassBin->registerObject(); rpm->addManager( prePassBin ); } */ - mPrePassRenderBin = prePassBin; + mDeferredRenderBin = prePassBin; - // If there is a prepass bin - MATMGR->setPrePassEnabled( mPrePassRenderBin.isValid() ); - sceneManager->setPostEffectFog( mPrePassRenderBin.isValid() && mPrePassRenderBin->getTargetChainLength() > 0 ); + // If there is a deferred bin + MATMGR->setDeferredEnabled( mDeferredRenderBin.isValid() ); + sceneManager->setPostEffectFog( mDeferredRenderBin.isValid() && mDeferredRenderBin->getTargetChainLength() > 0 ); - // Tell the material manager that we don't use prepass. - MATMGR->setPrePassEnabled( false ); + // Tell the material manager that we don't use deferred. + MATMGR->setDeferredEnabled( false ); GFXShader::addGlobalMacro( "TORQUE_BASIC_LIGHTING" ); @@ -241,9 +241,9 @@ void BasicLightManager::deactivate() } mConstantLookup.clear(); - if ( mPrePassRenderBin ) - mPrePassRenderBin->deleteObject(); - mPrePassRenderBin = NULL; + if ( mDeferredRenderBin ) + mDeferredRenderBin->deleteObject(); + mDeferredRenderBin = NULL; GFXShader::removeGlobalMacro( "TORQUE_BASIC_LIGHTING" ); diff --git a/Engine/source/lighting/basic/basicLightManager.h b/Engine/source/lighting/basic/basicLightManager.h index 705cb0e77..6641ac39d 100644 --- a/Engine/source/lighting/basic/basicLightManager.h +++ b/Engine/source/lighting/basic/basicLightManager.h @@ -41,7 +41,7 @@ class AvailableSLInterfaces; class GFXShaderConstHandle; -class RenderPrePassMgr; +class RenderDeferredMgr; class PlatformTimer; class blTerrainSystem; @@ -77,7 +77,7 @@ protected: BasicLightManager(); virtual ~BasicLightManager(); - SimObjectPtr mPrePassRenderBin; + SimObjectPtr mDeferredRenderBin; struct LightingShaderConstants { diff --git a/Engine/source/lighting/lightManager.cpp b/Engine/source/lighting/lightManager.cpp index 58f0949c2..82a1adb0c 100644 --- a/Engine/source/lighting/lightManager.cpp +++ b/Engine/source/lighting/lightManager.cpp @@ -36,7 +36,7 @@ #include "T3D/gameBase/gameConnection.h" #include "gfx/gfxStringEnumTranslate.h" #include "console/engineAPI.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" Signal LightManager::smActivateSignal; @@ -419,15 +419,15 @@ bool LightManager::lightScene( const char* callback, const char* param ) return sl->lightScene( callback, flags ); } -RenderPrePassMgr* LightManager::_findPrePassRenderBin() +RenderDeferredMgr* LightManager::_findDeferredRenderBin() { RenderPassManager* rpm = getSceneManager()->getDefaultRenderPass(); for( U32 i = 0; i < rpm->getManagerCount(); i++ ) { RenderBinManager *bin = rpm->getManager( i ); - if( bin->getRenderInstType() == RenderPrePassMgr::RIT_PrePass ) + if( bin->getRenderInstType() == RenderDeferredMgr::RIT_Deferred ) { - return ( RenderPrePassMgr* ) bin; + return ( RenderDeferredMgr* ) bin; } } diff --git a/Engine/source/lighting/lightManager.h b/Engine/source/lighting/lightManager.h index a0ba1cb70..4ffa7022f 100644 --- a/Engine/source/lighting/lightManager.h +++ b/Engine/source/lighting/lightManager.h @@ -49,7 +49,7 @@ class GFXShaderConstBuffer; class GFXShaderConstHandle; class ShaderConstHandles; class SceneRenderState; -class RenderPrePassMgr; +class RenderDeferredMgr; class Frustum; /// @@ -167,7 +167,7 @@ protected: static LightManager *smActiveLM; /// Find the pre-pass render bin on the scene's default render pass. - RenderPrePassMgr* _findPrePassRenderBin(); + RenderDeferredMgr* _findDeferredRenderBin(); /// This helper function sets the shader constansts /// for the stock 4 light forward lighting code. diff --git a/Engine/source/lighting/shadowMap/lightShadowMap.cpp b/Engine/source/lighting/shadowMap/lightShadowMap.cpp index 3359db622..0486ddace 100644 --- a/Engine/source/lighting/shadowMap/lightShadowMap.cpp +++ b/Engine/source/lighting/shadowMap/lightShadowMap.cpp @@ -519,7 +519,7 @@ void LightingShaderConstants::init(GFXShader* shader) mLightSpotParamsSC = shader->getShaderConstHandle("$lightSpotParams"); // NOTE: These are the shader constants used for doing lighting - // during the forward pass. Do not confuse these for the prepass + // during the forward pass. Do not confuse these for the deferred // lighting constants which are used from AdvancedLightBinManager. mLightPositionSC = shader->getShaderConstHandle( ShaderGenVars::lightPosition ); mLightDiffuseSC = shader->getShaderConstHandle( ShaderGenVars::lightDiffuse ); diff --git a/Engine/source/lighting/shadowMap/lightShadowMap.h b/Engine/source/lighting/shadowMap/lightShadowMap.h index c98dc4de5..72137c651 100644 --- a/Engine/source/lighting/shadowMap/lightShadowMap.h +++ b/Engine/source/lighting/shadowMap/lightShadowMap.h @@ -82,7 +82,7 @@ struct LightingShaderConstants // NOTE: These are the shader constants used for doing // lighting during the forward pass. Do not confuse - // these for the prepass lighting constants which are + // these for the deferred lighting constants which are // used from AdvancedLightBinManager. GFXShaderConstHandle *mLightPositionSC; GFXShaderConstHandle *mLightDiffuseSC; diff --git a/Engine/source/lighting/shadowMap/shadowMatHook.cpp b/Engine/source/lighting/shadowMap/shadowMatHook.cpp index 45069478d..11a82ec1e 100644 --- a/Engine/source/lighting/shadowMap/shadowMatHook.cpp +++ b/Engine/source/lighting/shadowMap/shadowMatHook.cpp @@ -90,7 +90,7 @@ void ShadowMaterialHook::init( BaseMatInstance *inMat ) forced.setBlend( false ); forced.setAlphaTest( false ); - // We should force on zwrite as the prepass + // We should force on zwrite as the deferred // will disable it by default. forced.setZReadWrite( true, true ); diff --git a/Engine/source/materials/baseMatInstance.h b/Engine/source/materials/baseMatInstance.h index 4bc6a2ba2..6a2bee0a1 100644 --- a/Engine/source/materials/baseMatInstance.h +++ b/Engine/source/materials/baseMatInstance.h @@ -77,7 +77,7 @@ protected: /// It is up to the derived class to set this variable appropriately. bool mIsValid; - /// This is set by initialization and used by the prepass. + /// This is set by initialization and used by the deferred. bool mHasNormalMaps; /// This material makes use of bone transforms diff --git a/Engine/source/materials/materialFeatureTypes.cpp b/Engine/source/materials/materialFeatureTypes.cpp index 56dcbc8fe..ae3b10093 100644 --- a/Engine/source/materials/materialFeatureTypes.cpp +++ b/Engine/source/materials/materialFeatureTypes.cpp @@ -73,13 +73,13 @@ ImplementFeatureType( MFT_IsEmissive, U32(-1), -1, true ); ImplementFeatureType( MFT_GlossMap, U32(-1), -1, true ); ImplementFeatureType( MFT_DiffuseMapAtlas, U32(-1), -1, true ); ImplementFeatureType( MFT_NormalMapAtlas, U32(-1), -1, true ); -ImplementFeatureType( MFT_InterlacedPrePass, U32(-1), -1, true ); +ImplementFeatureType( MFT_InterlacedDeferred, U32(-1), -1, true ); ImplementFeatureType( MFT_ParaboloidVertTransform, MFG_Transform, -1, false ); ImplementFeatureType( MFT_IsSinglePassParaboloid, U32(-1), -1, false ); ImplementFeatureType( MFT_EyeSpaceDepthOut, MFG_PostLighting, 2.0f, false ); ImplementFeatureType( MFT_DepthOut, MFG_PostLighting, 3.0f, false ); -ImplementFeatureType( MFT_PrePassConditioner, MFG_PostProcess, 1.0f, false ); +ImplementFeatureType( MFT_DeferredConditioner, MFG_PostProcess, 1.0f, false ); ImplementFeatureType( MFT_NormalsOut, MFG_PreLighting, 1.0f, false ); ImplementFeatureType( MFT_LightbufferMRT, MFG_PreLighting, 1.0f, false ); diff --git a/Engine/source/materials/materialFeatureTypes.h b/Engine/source/materials/materialFeatureTypes.h index c820fec96..e451f6f70 100644 --- a/Engine/source/materials/materialFeatureTypes.h +++ b/Engine/source/materials/materialFeatureTypes.h @@ -150,8 +150,8 @@ DeclareFeatureType( MFT_Fog ); DeclareFeatureType( MFT_HDROut ); /// -DeclareFeatureType( MFT_PrePassConditioner ); -DeclareFeatureType( MFT_InterlacedPrePass ); +DeclareFeatureType( MFT_DeferredConditioner ); +DeclareFeatureType( MFT_InterlacedDeferred ); /// This feature causes MFT_ToneMap and MFT_LightMap to output their light color /// to the second render-target diff --git a/Engine/source/materials/materialManager.cpp b/Engine/source/materials/materialManager.cpp index 50491d05b..ad81ea3d6 100644 --- a/Engine/source/materials/materialManager.cpp +++ b/Engine/source/materials/materialManager.cpp @@ -68,7 +68,7 @@ MaterialManager::MaterialManager() mMaterialSet = NULL; - mUsingPrePass = false; + mUsingDeferred = false; mFlushAndReInit = false; diff --git a/Engine/source/materials/materialManager.h b/Engine/source/materials/materialManager.h index f5f429673..2512ccee0 100644 --- a/Engine/source/materials/materialManager.h +++ b/Engine/source/materials/materialManager.h @@ -79,11 +79,11 @@ public: /// Gets the global warning material instance, callers should not free this copy BaseMatInstance * getWarningMatInstance(); - /// Set the prepass enabled state. - void setPrePassEnabled( bool enabled ) { mUsingPrePass = enabled; } + /// Set the deferred enabled state. + void setDeferredEnabled( bool enabled ) { mUsingDeferred = enabled; } - /// Get the prepass enabled state. - bool getPrePassEnabled() const { return mUsingPrePass; } + /// Get the deferred enabled state. + bool getDeferredEnabled() const { return mUsingDeferred; } #ifndef TORQUE_SHIPPING @@ -153,7 +153,7 @@ protected: typedef Map MaterialMap; MaterialMap mMaterialMap; - bool mUsingPrePass; + bool mUsingDeferred; // time tracking F32 mDt; diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index b013ee45b..6960212c9 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -288,9 +288,9 @@ void ProcessedMaterial::_initPassStateBlock( RenderPassData *rpd, GFXStateBlockD } } - // The prepass will take care of writing to the + // The deferred will take care of writing to the // zbuffer, so we don't have to by default. - if ( MATMGR->getPrePassEnabled() && + if ( MATMGR->getDeferredEnabled() && !mFeatures.hasFeature(MFT_ForwardShading)) result.setZReadWrite( result.zEnable, false ); @@ -350,7 +350,7 @@ U32 ProcessedMaterial::_getRenderStateIndex( const SceneRenderState *sceneState, if ( sceneState && sceneState->isReflectPass() ) currState |= RenderPassData::STATE_REFLECT; - if ( sgData.binType != SceneData::PrePassBin && + if ( sgData.binType != SceneData::DeferredBin && mMaterial->isTranslucent() ) currState |= RenderPassData::STATE_TRANSLUCENT; diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 4c7bc8042..a86d3144d 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -301,7 +301,7 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum, if ( mMaterial->isTranslucent() ) { - // Note: This is for decal blending into the prepass + // Note: This is for decal blending into the deferred // for AL... it probably needs to be made clearer. if ( mMaterial->mTranslucentBlendOp == Material::LerpAlpha && mMaterial->mTranslucentZWrite ) @@ -318,11 +318,11 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum, if ( dStrcmp( LIGHTMGR->getId(), "BLM" ) == 0 ) fd.features.addFeature( MFT_ForwardShading ); - // Disabling the InterlacedPrePass feature for now. It is not ready for prime-time + // Disabling the InterlacedDeferred feature for now. It is not ready for prime-time // and it should not be triggered off of the DoubleSided parameter. [2/5/2010 Pat] /*if ( mMaterial->isDoubleSided() ) { - fd.features.addFeature( MFT_InterlacedPrePass ); + fd.features.addFeature( MFT_InterlacedDeferred ); }*/ // Allow instancing if it was requested and the card supports diff --git a/Engine/source/materials/sceneData.h b/Engine/source/materials/sceneData.h index dd9299121..14c289d35 100644 --- a/Engine/source/materials/sceneData.h +++ b/Engine/source/materials/sceneData.h @@ -49,9 +49,9 @@ struct SceneData /// @see RenderGlowMgr GlowBin, - /// The prepass render bin. - /// @RenderPrePassMgr - PrePassBin, + /// The deferred render bin. + /// @RenderDeferredMgr + DeferredBin, }; /// This defines when we're rendering a special bin diff --git a/Engine/source/renderInstance/renderPrePassMgr.cpp b/Engine/source/renderInstance/renderDeferredMgr.cpp similarity index 84% rename from Engine/source/renderInstance/renderPrePassMgr.cpp rename to Engine/source/renderInstance/renderDeferredMgr.cpp index 88accf3c7..cbc3b42f9 100644 --- a/Engine/source/renderInstance/renderPrePassMgr.cpp +++ b/Engine/source/renderInstance/renderDeferredMgr.cpp @@ -21,7 +21,7 @@ //----------------------------------------------------------------------------- #include "platform/platform.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "gfx/gfxTransformSaver.h" #include "materials/sceneData.h" @@ -51,40 +51,40 @@ #include "materials/shaderData.h" #include "gfx/sim/cubemapData.h" -const MatInstanceHookType PrePassMatInstanceHook::Type( "PrePass" ); -const String RenderPrePassMgr::BufferName("prepass"); -const RenderInstType RenderPrePassMgr::RIT_PrePass("PrePass"); -const String RenderPrePassMgr::ColorBufferName("color"); -const String RenderPrePassMgr::MatInfoBufferName("matinfo"); +const MatInstanceHookType DeferredMatInstanceHook::Type( "Deferred" ); +const String RenderDeferredMgr::BufferName("deferred"); +const RenderInstType RenderDeferredMgr::RIT_Deferred("Deferred"); +const String RenderDeferredMgr::ColorBufferName("color"); +const String RenderDeferredMgr::MatInfoBufferName("matinfo"); -IMPLEMENT_CONOBJECT(RenderPrePassMgr); +IMPLEMENT_CONOBJECT(RenderDeferredMgr); -ConsoleDocClass( RenderPrePassMgr, - "@brief The render bin which performs a z+normals prepass used in Advanced Lighting.\n\n" +ConsoleDocClass( RenderDeferredMgr, + "@brief The render bin which performs a z+normals deferred used in Advanced Lighting.\n\n" "This render bin is used in Advanced Lighting to gather all opaque mesh render instances " "and render them to the g-buffer for use in lighting the scene and doing effects.\n\n" - "PostEffect and other shaders can access the output of this bin by using the #prepass " + "PostEffect and other shaders can access the output of this bin by using the #deferred " "texture target name. See the edge anti-aliasing post effect for an example.\n\n" "@see game/core/scripts/client/postFx/edgeAA.cs\n" "@ingroup RenderBin\n" ); -RenderPrePassMgr::RenderSignal& RenderPrePassMgr::getRenderSignal() +RenderDeferredMgr::RenderSignal& RenderDeferredMgr::getRenderSignal() { static RenderSignal theSignal; return theSignal; } -RenderPrePassMgr::RenderPrePassMgr( bool gatherDepth, +RenderDeferredMgr::RenderDeferredMgr( bool gatherDepth, GFXFormat format ) - : Parent( RIT_PrePass, + : Parent( RIT_Deferred, 0.01f, 0.01f, format, Point2I( Parent::DefaultTargetSize, Parent::DefaultTargetSize), gatherDepth ? Parent::DefaultTargetChainLength : 0 ), - mPrePassMatInstance( NULL ) + mDeferredMatInstance( NULL ) { notifyType( RenderPassManager::RIT_Decal ); notifyType( RenderPassManager::RIT_DecalRoad ); @@ -107,30 +107,30 @@ RenderPrePassMgr::RenderPrePassMgr( bool gatherDepth, _registerFeatures(); } -RenderPrePassMgr::~RenderPrePassMgr() +RenderDeferredMgr::~RenderDeferredMgr() { GFXShader::removeGlobalMacro( "TORQUE_LINEAR_DEPTH" ); mColorTarget.release(); mMatInfoTarget.release(); _unregisterFeatures(); - SAFE_DELETE( mPrePassMatInstance ); + SAFE_DELETE( mDeferredMatInstance ); } -void RenderPrePassMgr::_registerFeatures() +void RenderDeferredMgr::_registerFeatures() { ConditionerFeature *cond = new LinearEyeDepthConditioner( getTargetFormat() ); - FEATUREMGR->registerFeature( MFT_PrePassConditioner, cond ); + FEATUREMGR->registerFeature( MFT_DeferredConditioner, cond ); mNamedTarget.setConditioner( cond ); } -void RenderPrePassMgr::_unregisterFeatures() +void RenderDeferredMgr::_unregisterFeatures() { mNamedTarget.setConditioner( NULL ); - FEATUREMGR->unregisterFeature(MFT_PrePassConditioner); + FEATUREMGR->unregisterFeature(MFT_DeferredConditioner); } -bool RenderPrePassMgr::setTargetSize(const Point2I &newTargetSize) +bool RenderDeferredMgr::setTargetSize(const Point2I &newTargetSize) { bool ret = Parent::setTargetSize( newTargetSize ); mNamedTarget.setViewport( GFX->getViewport() ); @@ -139,14 +139,14 @@ bool RenderPrePassMgr::setTargetSize(const Point2I &newTargetSize) return ret; } -bool RenderPrePassMgr::_updateTargets() +bool RenderDeferredMgr::_updateTargets() { - PROFILE_SCOPE(RenderPrePassMgr_updateTargets); + PROFILE_SCOPE(RenderDeferredMgr_updateTargets); bool ret = Parent::_updateTargets(); // check for an output conditioner, and update it's format - ConditionerFeature *outputConditioner = dynamic_cast(FEATUREMGR->getByType(MFT_PrePassConditioner)); + ConditionerFeature *outputConditioner = dynamic_cast(FEATUREMGR->getByType(MFT_DeferredConditioner)); if( outputConditioner && outputConditioner->setBufferFormat(mTargetFormat) ) { // reload materials, the conditioner needs to alter the generated shaders @@ -193,7 +193,7 @@ bool RenderPrePassMgr::_updateTargets() // lightmapped geometry in the scene. AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) && - lightBin->MRTLightmapsDuringPrePass() && + lightBin->MRTLightmapsDuringDeferred() && lightBin->isProperlyAdded() ) { // Update the size of the light bin target here. This will call _updateTargets @@ -218,28 +218,28 @@ bool RenderPrePassMgr::_updateTargets() return ret; } -void RenderPrePassMgr::_createPrePassMaterial() +void RenderDeferredMgr::_createDeferredMaterial() { - SAFE_DELETE(mPrePassMatInstance); + SAFE_DELETE(mDeferredMatInstance); const GFXVertexFormat *vertexFormat = getGFXVertexFormat(); - MatInstance* prepassMat = static_cast(MATMGR->createMatInstance("AL_DefaultPrePassMaterial", vertexFormat)); - AssertFatal( prepassMat, "TODO: Handle this better." ); - mPrePassMatInstance = new PrePassMatInstance(prepassMat, this); - mPrePassMatInstance->init( MATMGR->getDefaultFeatures(), vertexFormat); - delete prepassMat; + MatInstance* deferredMat = static_cast(MATMGR->createMatInstance("AL_DefaultDeferredMaterial", vertexFormat)); + AssertFatal( deferredMat, "TODO: Handle this better." ); + mDeferredMatInstance = new DeferredMatInstance(deferredMat, this); + mDeferredMatInstance->init( MATMGR->getDefaultFeatures(), vertexFormat); + delete deferredMat; } -void RenderPrePassMgr::setPrePassMaterial( PrePassMatInstance *mat ) +void RenderDeferredMgr::setDeferredMaterial( DeferredMatInstance *mat ) { - SAFE_DELETE(mPrePassMatInstance); - mPrePassMatInstance = mat; + SAFE_DELETE(mDeferredMatInstance); + mDeferredMatInstance = mat; } -void RenderPrePassMgr::addElement( RenderInst *inst ) +void RenderDeferredMgr::addElement( RenderInst *inst ) { - PROFILE_SCOPE( RenderPrePassMgr_addElement ) + PROFILE_SCOPE( RenderDeferredMgr_addElement ) // Skip out if this bin is disabled. if ( gClientSceneGraph->getCurrentRenderState() && @@ -269,8 +269,8 @@ void RenderPrePassMgr::addElement( RenderInst *inst ) static_cast(matInst->getMaterial())->mRefract) return; - // Make sure we got a prepass material. - matInst = getPrePassMaterial(matInst); + // Make sure we got a deferred material. + matInst = getDeferredMaterial(matInst); if (!matInst || !matInst->isValid()) return; } @@ -302,36 +302,36 @@ void RenderPrePassMgr::addElement( RenderInst *inst ) elem.key2 = originalKey; } -void RenderPrePassMgr::sort() +void RenderDeferredMgr::sort() { - PROFILE_SCOPE( RenderPrePassMgr_sort ); + PROFILE_SCOPE( RenderDeferredMgr_sort ); Parent::sort(); dQsort( mTerrainElementList.address(), mTerrainElementList.size(), sizeof(MainSortElem), cmpKeyFunc); dQsort( mObjectElementList.address(), mObjectElementList.size(), sizeof(MainSortElem), cmpKeyFunc); } -void RenderPrePassMgr::clear() +void RenderDeferredMgr::clear() { Parent::clear(); mTerrainElementList.clear(); mObjectElementList.clear(); } -void RenderPrePassMgr::render( SceneRenderState *state ) +void RenderDeferredMgr::render( SceneRenderState *state ) { - PROFILE_SCOPE(RenderPrePassMgr_render); + PROFILE_SCOPE(RenderDeferredMgr_render); // Take a look at the SceneRenderState and see if we should skip drawing the pre-pass if ( state->disableAdvancedLightingBins() ) return; // NOTE: We don't early out here when the element list is - // zero because we need the prepass to be cleared. + // zero because we need the deferred to be cleared. // Automagically save & restore our viewport and transforms. GFXTransformSaver saver; - GFXDEBUGEVENT_SCOPE( RenderPrePassMgr_Render, ColorI::RED ); + GFXDEBUGEVENT_SCOPE( RenderDeferredMgr_Render, ColorI::RED ); // Tell the superclass we're about to render const bool isRenderingToTarget = _onPreRender(state); @@ -344,13 +344,13 @@ void RenderPrePassMgr::render( SceneRenderState *state ) matrixSet.restoreSceneViewProjection(); const MatrixF worldViewXfm = GFX->getWorldMatrix(); - // Setup the default prepass material for object instances. - if ( !mPrePassMatInstance ) - _createPrePassMaterial(); - if ( mPrePassMatInstance ) + // Setup the default deferred material for object instances. + if ( !mDeferredMatInstance ) + _createDeferredMaterial(); + if ( mDeferredMatInstance ) { matrixSet.setWorld(MatrixF::Identity); - mPrePassMatInstance->setTransforms(matrixSet, state); + mDeferredMatInstance->setTransforms(matrixSet, state); } // Signal start of pre-pass @@ -361,16 +361,16 @@ void RenderPrePassMgr::render( SceneRenderState *state ) // on the smaller meshes and objects. // The terrain doesn't need any scene graph data - // in the the prepass... so just clear it. + // in the the deferred... so just clear it. SceneData sgData; - sgData.init( state, SceneData::PrePassBin ); + sgData.init( state, SceneData::DeferredBin ); Vector< MainSortElem >::const_iterator itr = mTerrainElementList.begin(); for ( ; itr != mTerrainElementList.end(); itr++ ) { TerrainRenderInst *ri = static_cast( itr->inst ); - TerrainCellMaterial *mat = ri->cellMat->getPrePassMat(); + TerrainCellMaterial *mat = ri->cellMat->getDeferredMat(); GFX->setPrimitiveBuffer( ri->primBuff ); GFX->setVertexBuffer( ri->vertBuff ); @@ -396,8 +396,8 @@ void RenderPrePassMgr::render( SceneRenderState *state ) { MeshRenderInst *ri = static_cast( itr->inst ); - // Get the prepass material. - BaseMatInstance *mat = getPrePassMaterial( ri->matInst ); + // Get the deferred material. + BaseMatInstance *mat = getDeferredMaterial( ri->matInst ); // Set up SG data proper like and flag it // as a pre-pass render @@ -414,9 +414,9 @@ void RenderPrePassMgr::render( SceneRenderState *state ) // Check to see if we need to break this batch. // - // NOTE: We're comparing the non-prepass materials + // NOTE: We're comparing the non-deferred materials // here so we don't incur the cost of looking up the - // prepass hook on each inst. + // deferred hook on each inst. // if ( newPassNeeded( ri, passRI ) ) break; @@ -523,7 +523,7 @@ void RenderPrePassMgr::render( SceneRenderState *state ) { ObjectRenderInst *ri = static_cast( itr->inst ); if ( ri->renderDelegate ) - ri->renderDelegate( ri, state, mPrePassMatInstance ); + ri->renderDelegate( ri, state, mDeferredMatInstance ); } // Signal end of pre-pass @@ -533,7 +533,7 @@ void RenderPrePassMgr::render( SceneRenderState *state ) _onPostRender(); } -const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStenciWriteDesc( bool lightmappedGeometry /*= true*/ ) +const GFXStateBlockDesc & RenderDeferredMgr::getOpaqueStenciWriteDesc( bool lightmappedGeometry /*= true*/ ) { static bool sbInit = false; static GFXStateBlockDesc sOpaqueStaticLitStencilWriteDesc; @@ -548,7 +548,7 @@ const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStenciWriteDesc( bool light sOpaqueStaticLitStencilWriteDesc.stencilEnable = true; sOpaqueStaticLitStencilWriteDesc.stencilWriteMask = 0x03; sOpaqueStaticLitStencilWriteDesc.stencilMask = 0x03; - sOpaqueStaticLitStencilWriteDesc.stencilRef = RenderPrePassMgr::OpaqueStaticLitMask; + sOpaqueStaticLitStencilWriteDesc.stencilRef = RenderDeferredMgr::OpaqueStaticLitMask; sOpaqueStaticLitStencilWriteDesc.stencilPassOp = GFXStencilOpReplace; sOpaqueStaticLitStencilWriteDesc.stencilFailOp = GFXStencilOpKeep; sOpaqueStaticLitStencilWriteDesc.stencilZFailOp = GFXStencilOpKeep; @@ -556,13 +556,13 @@ const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStenciWriteDesc( bool light // Same only dynamic sOpaqueDynamicLitStencilWriteDesc = sOpaqueStaticLitStencilWriteDesc; - sOpaqueDynamicLitStencilWriteDesc.stencilRef = RenderPrePassMgr::OpaqueDynamicLitMask; + sOpaqueDynamicLitStencilWriteDesc.stencilRef = RenderDeferredMgr::OpaqueDynamicLitMask; } return (lightmappedGeometry ? sOpaqueStaticLitStencilWriteDesc : sOpaqueDynamicLitStencilWriteDesc); } -const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStencilTestDesc() +const GFXStateBlockDesc & RenderDeferredMgr::getOpaqueStencilTestDesc() { static bool sbInit = false; static GFXStateBlockDesc sOpaqueStencilTestDesc; @@ -589,13 +589,13 @@ const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStencilTestDesc() //------------------------------------------------------------------------------ -ProcessedPrePassMaterial::ProcessedPrePassMaterial( Material& mat, const RenderPrePassMgr *prePassMgr ) -: Parent(mat), mPrePassMgr(prePassMgr) +ProcessedDeferredMaterial::ProcessedDeferredMaterial( Material& mat, const RenderDeferredMgr *prePassMgr ) +: Parent(mat), mDeferredMgr(prePassMgr) { } -void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum, +void ProcessedDeferredMaterial::_determineFeatures( U32 stageNum, MaterialFeatureData &fd, const FeatureSet &features ) { @@ -605,7 +605,7 @@ void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum, bool bEnableMRTLightmap = false; AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) - bEnableMRTLightmap = lightBin->MRTLightmapsDuringPrePass(); + bEnableMRTLightmap = lightBin->MRTLightmapsDuringDeferred(); // If this material has a lightmap or tonemap (texture or baked vertex color), // it must be static. Otherwise it is dynamic. @@ -617,17 +617,17 @@ void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum, fd.features.hasFeature( MFT_IsTranslucentZWrite) ) ) ); // Integrate proper opaque stencil write state - mUserDefined.addDesc( mPrePassMgr->getOpaqueStenciWriteDesc( mIsLightmappedGeometry ) ); + mUserDefined.addDesc( mDeferredMgr->getOpaqueStenciWriteDesc( mIsLightmappedGeometry ) ); FeatureSet newFeatures; - // These are always on for prepass. + // These are always on for deferred. newFeatures.addFeature( MFT_EyeSpaceDepthOut ); - newFeatures.addFeature( MFT_PrePassConditioner ); + newFeatures.addFeature( MFT_DeferredConditioner ); #ifndef TORQUE_DEDICATED - //tag all materials running through prepass as deferred + //tag all materials running through deferred as deferred newFeatures.addFeature(MFT_isDeferred); // Deferred Shading : Diffuse @@ -677,7 +677,7 @@ void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum, type == MFT_DetailNormalMap || type == MFT_AlphaTest || type == MFT_Parallax || - type == MFT_InterlacedPrePass || + type == MFT_InterlacedDeferred || type == MFT_Visibility || type == MFT_UseInstancing || type == MFT_DiffuseVertColor || @@ -764,7 +764,7 @@ void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum, fd.features = newFeatures; } -U32 ProcessedPrePassMaterial::getNumStages() +U32 ProcessedDeferredMaterial::getNumStages() { // Loops through all stages to determine how many // stages we actually use. @@ -816,12 +816,12 @@ U32 ProcessedPrePassMaterial::getNumStages() return numStages; } -void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc) +void ProcessedDeferredMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc) { GFXStateBlockDesc prePassStateBlock = desc; // Adjust color writes if this is a pure z-fill pass - const bool pixelOutEnabled = mPrePassMgr->getTargetChainLength() > 0; + const bool pixelOutEnabled = mDeferredMgr->getTargetChainLength() > 0; if ( !pixelOutEnabled ) { prePassStateBlock.colorWriteDefined = true; @@ -832,12 +832,12 @@ void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc) } // Never allow the alpha test state when rendering - // the prepass as we use the alpha channel for the + // the deferred as we use the alpha channel for the // depth information... MFT_AlphaTest will handle it. prePassStateBlock.alphaDefined = true; prePassStateBlock.alphaTestEnable = false; - // If we're translucent then we're doing prepass blending + // If we're translucent then we're doing deferred blending // which never writes to the depth channels. const bool isTranslucent = getMaterial()->isTranslucent(); if ( isTranslucent ) @@ -853,24 +853,24 @@ void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc) Parent::addStateBlockDesc(prePassStateBlock); } -PrePassMatInstance::PrePassMatInstance(MatInstance* root, const RenderPrePassMgr *prePassMgr) -: Parent(*root->getMaterial()), mPrePassMgr(prePassMgr) +DeferredMatInstance::DeferredMatInstance(MatInstance* root, const RenderDeferredMgr *prePassMgr) +: Parent(*root->getMaterial()), mDeferredMgr(prePassMgr) { mFeatureList = root->getRequestedFeatures(); mVertexFormat = root->getVertexFormat(); mUserObject = root->getUserObject(); } -PrePassMatInstance::~PrePassMatInstance() +DeferredMatInstance::~DeferredMatInstance() { } -ProcessedMaterial* PrePassMatInstance::getShaderMaterial() +ProcessedMaterial* DeferredMatInstance::getShaderMaterial() { - return new ProcessedPrePassMaterial(*mMaterial, mPrePassMgr); + return new ProcessedDeferredMaterial(*mMaterial, mDeferredMgr); } -bool PrePassMatInstance::init( const FeatureSet &features, +bool DeferredMatInstance::init( const FeatureSet &features, const GFXVertexFormat *vertexFormat ) { bool vaild = Parent::init(features, vertexFormat); @@ -891,27 +891,27 @@ bool PrePassMatInstance::init( const FeatureSet &features, return vaild; } -PrePassMatInstanceHook::PrePassMatInstanceHook( MatInstance *baseMatInst, - const RenderPrePassMgr *prePassMgr ) - : mHookedPrePassMatInst(NULL), mPrePassManager(prePassMgr) +DeferredMatInstanceHook::DeferredMatInstanceHook( MatInstance *baseMatInst, + const RenderDeferredMgr *prePassMgr ) + : mHookedDeferredMatInst(NULL), mDeferredManager(prePassMgr) { // If the material is a custom material then - // hope that using DefaultPrePassMaterial gives - // them a good prepass. + // hope that using DefaultDeferredMaterial gives + // them a good deferred. if ( baseMatInst->isCustomMaterial() ) { - MatInstance* dummyInst = static_cast( MATMGR->createMatInstance( "AL_DefaultPrePassMaterial", baseMatInst->getVertexFormat() ) ); + MatInstance* dummyInst = static_cast( MATMGR->createMatInstance( "AL_DefaultDeferredMaterial", baseMatInst->getVertexFormat() ) ); - mHookedPrePassMatInst = new PrePassMatInstance( dummyInst, prePassMgr ); - mHookedPrePassMatInst->init( dummyInst->getRequestedFeatures(), baseMatInst->getVertexFormat()); + mHookedDeferredMatInst = new DeferredMatInstance( dummyInst, prePassMgr ); + mHookedDeferredMatInst->init( dummyInst->getRequestedFeatures(), baseMatInst->getVertexFormat()); delete dummyInst; return; } - // Create the prepass material instance. - mHookedPrePassMatInst = new PrePassMatInstance(baseMatInst, prePassMgr); - mHookedPrePassMatInst->getFeaturesDelegate() = baseMatInst->getFeaturesDelegate(); + // Create the deferred material instance. + mHookedDeferredMatInst = new DeferredMatInstance(baseMatInst, prePassMgr); + mHookedDeferredMatInst->getFeaturesDelegate() = baseMatInst->getFeaturesDelegate(); // Get the features, but remove the instancing feature if the // original material didn't end up using it. @@ -920,12 +920,12 @@ PrePassMatInstanceHook::PrePassMatInstanceHook( MatInstance *baseMatInst, features.removeFeature( MFT_UseInstancing ); // Initialize the material. - mHookedPrePassMatInst->init(features, baseMatInst->getVertexFormat()); + mHookedDeferredMatInst->init(features, baseMatInst->getVertexFormat()); } -PrePassMatInstanceHook::~PrePassMatInstanceHook() +DeferredMatInstanceHook::~DeferredMatInstanceHook() { - SAFE_DELETE(mHookedPrePassMatInst); + SAFE_DELETE(mHookedDeferredMatInst); } //------------------------------------------------------------------------------ @@ -1027,10 +1027,10 @@ Var* LinearEyeDepthConditioner::printMethodHeader( MethodType methodType, const methodVar->setType("inline float4"); DecOp *methodDecl = new DecOp(methodVar); - Var *prepassSampler = new Var; - prepassSampler->setName("prepassSamplerVar"); - prepassSampler->setType("sampler2D"); - DecOp *prepassSamplerDecl = new DecOp(prepassSampler); + Var *deferredSampler = new Var; + deferredSampler->setName("deferredSamplerVar"); + deferredSampler->setType("sampler2D"); + DecOp *deferredSamplerDecl = new DecOp(deferredSampler); Var *screenUV = new Var; screenUV->setName("screenUVVar"); @@ -1048,7 +1048,7 @@ Var* LinearEyeDepthConditioner::printMethodHeader( MethodType methodType, const bufferSample->setType("float4"); DecOp *bufferSampleDecl = new DecOp(bufferSample); - meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) ); + meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) ); meta->addStatement( new GenOp( "{\r\n" ) ); @@ -1058,14 +1058,14 @@ Var* LinearEyeDepthConditioner::printMethodHeader( MethodType methodType, const // possible so that the shader compiler can optimize. meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) ); if (GFX->getAdapterType() == OpenGL) - meta->addStatement( new GenOp( " @ = textureLod(@, @, 0); \r\n", bufferSampleDecl, prepassSampler, screenUV) ); + meta->addStatement( new GenOp( " @ = textureLod(@, @, 0); \r\n", bufferSampleDecl, deferredSampler, screenUV) ); else - meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV ) ); + meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV ) ); meta->addStatement( new GenOp( " #else\r\n" ) ); if (GFX->getAdapterType() == OpenGL) - meta->addStatement( new GenOp( " @ = texture(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV) ); + meta->addStatement( new GenOp( " @ = texture(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV) ); else - meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV ) ); + meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV ) ); meta->addStatement( new GenOp( " #endif\r\n\r\n" ) ); // We don't use this way of passing var's around, so this should cause a crash @@ -1076,7 +1076,7 @@ Var* LinearEyeDepthConditioner::printMethodHeader( MethodType methodType, const return retVal; } -void RenderPrePassMgr::_initShaders() +void RenderDeferredMgr::_initShaders() { if ( mClearGBufferShader ) return; @@ -1084,7 +1084,7 @@ void RenderPrePassMgr::_initShaders() ShaderData *shaderData; mClearGBufferShader = Sim::findObject( "ClearGBufferShader", shaderData ) ? shaderData->getShader() : NULL; if ( !mClearGBufferShader ) - Con::errorf( "RenderPrePassMgr::_initShaders - could not find ClearGBufferShader" ); + Con::errorf( "RenderDeferredMgr::_initShaders - could not find ClearGBufferShader" ); // Create StateBlocks GFXStateBlockDesc desc; @@ -1108,7 +1108,7 @@ void RenderPrePassMgr::_initShaders() mSpecularPowerSC = mClearGBufferShader->getShaderConstHandle( "$specularPower" ); } -void RenderPrePassMgr::clearBuffers() +void RenderDeferredMgr::clearBuffers() { // Clear z-buffer. GFX->clear( GFXClearTarget | GFXClearZBuffer | GFXClearStencil, ColorI::ZERO, 1.0f, 0); diff --git a/Engine/source/renderInstance/renderPrePassMgr.h b/Engine/source/renderInstance/renderDeferredMgr.h similarity index 76% rename from Engine/source/renderInstance/renderPrePassMgr.h rename to Engine/source/renderInstance/renderDeferredMgr.h index bf36c6218..264bb04cc 100644 --- a/Engine/source/renderInstance/renderPrePassMgr.h +++ b/Engine/source/renderInstance/renderDeferredMgr.h @@ -29,12 +29,12 @@ #include "core/util/autoPtr.h" // Forward declare -class PrePassMatInstance; +class DeferredMatInstance; // This render manager renders opaque objects to the z-buffer as a z-fill pass. // It can optionally accumulate data from this opaque render pass into a render // target for later use. -class RenderPrePassMgr : public RenderTexTargetBinManager +class RenderDeferredMgr : public RenderTexTargetBinManager { typedef RenderTexTargetBinManager Parent; @@ -47,15 +47,15 @@ public: static const String ColorBufferName; static const String MatInfoBufferName; - // Generic PrePass Render Instance Type - static const RenderInstType RIT_PrePass; + // Generic Deferred Render Instance Type + static const RenderInstType RIT_Deferred; - RenderPrePassMgr( bool gatherDepth = true, + RenderDeferredMgr( bool gatherDepth = true, GFXFormat format = GFXFormatR16G16B16A16 ); - virtual ~RenderPrePassMgr(); + virtual ~RenderDeferredMgr(); - virtual void setPrePassMaterial( PrePassMatInstance *mat ); + virtual void setDeferredMaterial( DeferredMatInstance *mat ); // RenderBinManager interface virtual void render(SceneRenderState * state); @@ -64,10 +64,10 @@ public: virtual void addElement( RenderInst *inst ); // ConsoleObject - DECLARE_CONOBJECT(RenderPrePassMgr); + DECLARE_CONOBJECT(RenderDeferredMgr); - typedef Signal RenderSignal; + typedef Signal RenderSignal; static RenderSignal& getRenderSignal(); @@ -79,7 +79,7 @@ public: virtual bool setTargetSize(const Point2I &newTargetSize); - inline BaseMatInstance* getPrePassMaterial( BaseMatInstance *mat ); + inline BaseMatInstance* getDeferredMaterial( BaseMatInstance *mat ); protected: @@ -89,12 +89,12 @@ protected: /// The object render instance elements. Vector< MainSortElem > mObjectElementList; - PrePassMatInstance *mPrePassMatInstance; + DeferredMatInstance *mDeferredMatInstance; virtual void _registerFeatures(); virtual void _unregisterFeatures(); virtual bool _updateTargets(); - virtual void _createPrePassMaterial(); + virtual void _createDeferredMaterial(); bool _lightManagerActivate(bool active); @@ -117,12 +117,12 @@ public: //------------------------------------------------------------------------------ -class ProcessedPrePassMaterial : public ProcessedShaderMaterial +class ProcessedDeferredMaterial : public ProcessedShaderMaterial { typedef ProcessedShaderMaterial Parent; public: - ProcessedPrePassMaterial(Material& mat, const RenderPrePassMgr *prePassMgr); + ProcessedDeferredMaterial(Material& mat, const RenderDeferredMgr *prePassMgr); virtual U32 getNumStages(); @@ -131,19 +131,19 @@ public: protected: virtual void _determineFeatures( U32 stageNum, MaterialFeatureData &fd, const FeatureSet &features ); - const RenderPrePassMgr *mPrePassMgr; + const RenderDeferredMgr *mDeferredMgr; bool mIsLightmappedGeometry; }; //------------------------------------------------------------------------------ -class PrePassMatInstance : public MatInstance +class DeferredMatInstance : public MatInstance { typedef MatInstance Parent; public: - PrePassMatInstance(MatInstance* root, const RenderPrePassMgr *prePassMgr); - virtual ~PrePassMatInstance(); + DeferredMatInstance(MatInstance* root, const RenderDeferredMgr *prePassMgr); + virtual ~DeferredMatInstance(); bool init() { @@ -157,27 +157,27 @@ public: protected: virtual ProcessedMaterial* getShaderMaterial(); - const RenderPrePassMgr *mPrePassMgr; + const RenderDeferredMgr *mDeferredMgr; }; //------------------------------------------------------------------------------ -class PrePassMatInstanceHook : public MatInstanceHook +class DeferredMatInstanceHook : public MatInstanceHook { public: - PrePassMatInstanceHook(MatInstance *baseMatInst, const RenderPrePassMgr *prePassMgr); - virtual ~PrePassMatInstanceHook(); + DeferredMatInstanceHook(MatInstance *baseMatInst, const RenderDeferredMgr *prePassMgr); + virtual ~DeferredMatInstanceHook(); - virtual PrePassMatInstance *getPrePassMatInstance() { return mHookedPrePassMatInst; } + virtual DeferredMatInstance *getDeferredMatInstance() { return mHookedDeferredMatInst; } virtual const MatInstanceHookType& getType() const { return Type; } - /// The type for prepass material hooks. + /// The type for deferred material hooks. static const MatInstanceHookType Type; protected: - PrePassMatInstance *mHookedPrePassMatInst; - const RenderPrePassMgr *mPrePassManager; + DeferredMatInstance *mHookedDeferredMatInst; + const RenderDeferredMgr *mDeferredManager; }; //------------------------------------------------------------------------------ @@ -208,16 +208,16 @@ protected: }; -inline BaseMatInstance* RenderPrePassMgr::getPrePassMaterial( BaseMatInstance *mat ) +inline BaseMatInstance* RenderDeferredMgr::getDeferredMaterial( BaseMatInstance *mat ) { - PrePassMatInstanceHook *hook = static_cast( mat->getHook( PrePassMatInstanceHook::Type ) ); + DeferredMatInstanceHook *hook = static_cast( mat->getHook( DeferredMatInstanceHook::Type ) ); if ( !hook ) { - hook = new PrePassMatInstanceHook( static_cast( mat ), this ); + hook = new DeferredMatInstanceHook( static_cast( mat ), this ); mat->addHook( hook ); } - return hook->getPrePassMatInstance(); + return hook->getDeferredMatInstance(); } #endif // _PREPASS_MGR_H_ diff --git a/Engine/source/renderInstance/renderImposterMgr.cpp b/Engine/source/renderInstance/renderImposterMgr.cpp index 8bd168cbd..4b12f2537 100644 --- a/Engine/source/renderInstance/renderImposterMgr.cpp +++ b/Engine/source/renderInstance/renderImposterMgr.cpp @@ -30,7 +30,7 @@ #include "lighting/lightInfo.h" #include "scene/sceneRenderState.h" #include "gfx/gfxDebugEvent.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "gfx/gfxTransformSaver.h" #include "console/consoleTypes.h" #include "gfx/util/screenspace.h" @@ -70,7 +70,7 @@ RenderImposterMgr::RenderImposterMgr( F32 renderOrder, F32 processAddOrder ) : RenderBinManager( RIT_Imposter, renderOrder, processAddOrder ) { notifyType( RIT_ImposterBatch ); - RenderPrePassMgr::getRenderSignal().notify( this, &RenderImposterMgr::_renderPrePass ); + RenderDeferredMgr::getRenderSignal().notify( this, &RenderImposterMgr::_renderDeferred ); } void RenderImposterMgr::initPersistFields() @@ -88,7 +88,7 @@ void RenderImposterMgr::initPersistFields() RenderImposterMgr::~RenderImposterMgr() { - RenderPrePassMgr::getRenderSignal().remove( this, &RenderImposterMgr::_renderPrePass ); + RenderDeferredMgr::getRenderSignal().remove( this, &RenderImposterMgr::_renderDeferred ); mIB = NULL; } @@ -119,19 +119,19 @@ bool RenderImposterMgr::_clearStats( GFXDevice::GFXDeviceEventType type ) return true; } -void RenderImposterMgr::_renderPrePass( const SceneRenderState *state, RenderPrePassMgr *prePassBin, bool startPrePass ) +void RenderImposterMgr::_renderDeferred( const SceneRenderState *state, RenderDeferredMgr *prePassBin, bool startDeferred ) { - PROFILE_SCOPE( RenderImposterMgr_RenderPrePass ); + PROFILE_SCOPE( RenderImposterMgr_RenderDeferred ); - if ( !mElementList.size() || !startPrePass ) + if ( !mElementList.size() || !startDeferred ) return; - GFXDEBUGEVENT_SCOPE( RenderImposterMgr_RenderPrePass, ColorI::RED ); + GFXDEBUGEVENT_SCOPE( RenderImposterMgr_RenderDeferred, ColorI::RED ); _innerRender( state, prePassBin ); } -void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderPrePassMgr *prePassBin ) +void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDeferredMgr *prePassBin ) { PROFILE_SCOPE( RenderImposterMgr_InnerRender ); @@ -219,7 +219,7 @@ void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderPrePa // list changes. SceneData sgData; - sgData.init( state, prePassBin ? SceneData::PrePassBin : SceneData::RegularBin ); + sgData.init( state, prePassBin ? SceneData::DeferredBin : SceneData::RegularBin ); sgData.lights[0] = LIGHTMGR->getDefaultLight(); // TODO: I should rework this loop to generate the VB first then @@ -232,7 +232,7 @@ void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderPrePa for ( U32 i=0; i < binSize; ) { currMat = static_cast( mElementList[i].inst )->mat; - setupMat = prePassBin ? prePassBin->getPrePassMaterial( currMat ) : currMat; + setupMat = prePassBin ? prePassBin->getDeferredMaterial( currMat ) : currMat; // TODO: Fix MatInstance to take a const SceneRenderState! while ( setupMat->setupPass( (SceneRenderState*)state, sgData ) ) diff --git a/Engine/source/renderInstance/renderImposterMgr.h b/Engine/source/renderInstance/renderImposterMgr.h index 5ec3c542e..c2721341e 100644 --- a/Engine/source/renderInstance/renderImposterMgr.h +++ b/Engine/source/renderInstance/renderImposterMgr.h @@ -38,7 +38,7 @@ class TSLastDetail; class GFXTextureObject; -class RenderPrePassMgr; +class RenderDeferredMgr; struct ImposterRenderInst; @@ -74,9 +74,9 @@ protected: GFXPrimitiveBufferHandle mIB; //GFXVertexBufferHandle mCornerVB; - void _innerRender( const SceneRenderState *state, RenderPrePassMgr *prePassBin ); + void _innerRender( const SceneRenderState *state, RenderDeferredMgr *prePassBin ); - void _renderPrePass( const SceneRenderState *state, RenderPrePassMgr *prePassBin, bool startPrePass ); + void _renderDeferred( const SceneRenderState *state, RenderDeferredMgr *prePassBin, bool startDeferred ); static bool _clearStats( GFXDevice::GFXDeviceEventType type ); diff --git a/Engine/source/renderInstance/renderMeshMgr.cpp b/Engine/source/renderInstance/renderMeshMgr.cpp index ce27a09c2..c9de7c229 100644 --- a/Engine/source/renderInstance/renderMeshMgr.cpp +++ b/Engine/source/renderInstance/renderMeshMgr.cpp @@ -147,7 +147,7 @@ void RenderMeshMgr::render(SceneRenderState * state) // Check if bin is disabled in advanced lighting. // Allow forward rendering pass on custom materials. - if ( ( MATMGR->getPrePassEnabled() && mBasicOnly && !mat->isCustomMaterial() ) ) + if ( ( MATMGR->getDeferredEnabled() && mBasicOnly && !mat->isCustomMaterial() ) ) { j++; continue; diff --git a/Engine/source/renderInstance/renderObjectMgr.cpp b/Engine/source/renderInstance/renderObjectMgr.cpp index 6cfab0aba..75b1e29a4 100644 --- a/Engine/source/renderInstance/renderObjectMgr.cpp +++ b/Engine/source/renderInstance/renderObjectMgr.cpp @@ -69,7 +69,7 @@ void RenderObjectMgr::render( SceneRenderState *state ) return; // Check if bin is disabled in advanced lighting. - if ( MATMGR->getPrePassEnabled() && mBasicOnly ) + if ( MATMGR->getDeferredEnabled() && mBasicOnly ) return; for( U32 i=0; isetTexture( mParticleShaderConsts.mSamplerDiffuse->getSamplerRegister(), ri->diffuseTex ); - // Set up the prepass texture. - if ( mParticleShaderConsts.mPrePassTargetParamsSC->isValid() ) + // Set up the deferred texture. + if ( mParticleShaderConsts.mDeferredTargetParamsSC->isValid() ) { - GFXTextureObject *texObject = mPrepassTarget ? mPrepassTarget->getTexture(0) : NULL; - GFX->setTexture( mParticleShaderConsts.mSamplerPrePassTex->getSamplerRegister(), texObject ); + GFXTextureObject *texObject = mDeferredTarget ? mDeferredTarget->getTexture(0) : NULL; + GFX->setTexture( mParticleShaderConsts.mSamplerDeferredTex->getSamplerRegister(), texObject ); Point4F rtParams( 0.0f, 0.0f, 1.0f, 1.0f ); if ( texObject ) - ScreenSpace::RenderTargetParameters(texObject->getSize(), mPrepassTarget->getViewport(), rtParams); + ScreenSpace::RenderTargetParameters(texObject->getSize(), mDeferredTarget->getViewport(), rtParams); - mParticleShaderConsts.mShaderConsts->set( mParticleShaderConsts.mPrePassTargetParamsSC, rtParams ); + mParticleShaderConsts.mShaderConsts->set( mParticleShaderConsts.mDeferredTargetParamsSC, rtParams ); } GFX->setPrimitiveBuffer( *ri->primBuff ); @@ -538,8 +538,8 @@ bool RenderParticleMgr::_initShader() // Need depth from pre-pass, so get the macros Vector macros; - if ( mPrepassTarget ) - mPrepassTarget->getShaderMacros( ¯os ); + if ( mDeferredTarget ) + mDeferredTarget->getShaderMacros( ¯os ); // Create particle shader if ( !Sim::findObject( "ParticlesShaderData", shaderData ) || !shaderData ) @@ -557,11 +557,11 @@ bool RenderParticleMgr::_initShader() mParticleShaderConsts.mAlphaFactorSC = mParticleShader->getShaderConstHandle( "$alphaFactor" ); mParticleShaderConsts.mAlphaScaleSC = mParticleShader->getShaderConstHandle( "$alphaScale" ); mParticleShaderConsts.mFSModelViewProjSC = mParticleShader->getShaderConstHandle( "$fsModelViewProj" ); - mParticleShaderConsts.mPrePassTargetParamsSC = mParticleShader->getShaderConstHandle( "$prePassTargetParams" ); + mParticleShaderConsts.mDeferredTargetParamsSC = mParticleShader->getShaderConstHandle( "$prePassTargetParams" ); //samplers mParticleShaderConsts.mSamplerDiffuse = mParticleShader->getShaderConstHandle("$diffuseMap"); - mParticleShaderConsts.mSamplerPrePassTex = mParticleShader->getShaderConstHandle("$prepassTex"); + mParticleShaderConsts.mSamplerDeferredTex = mParticleShader->getShaderConstHandle("$deferredTex"); mParticleShaderConsts.mSamplerParaboloidLightMap = mParticleShader->getShaderConstHandle("$paraboloidLightMap"); } @@ -596,18 +596,18 @@ void RenderParticleMgr::_onLMActivate( const char*, bool activate ) return; // Hunt for the pre-pass manager/target - RenderPrePassMgr *prePassBin = NULL; + RenderDeferredMgr *prePassBin = NULL; for( U32 i = 0; i < rpm->getManagerCount(); i++ ) { RenderBinManager *bin = rpm->getManager(i); - if( bin->getRenderInstType() == RenderPrePassMgr::RIT_PrePass ) + if( bin->getRenderInstType() == RenderDeferredMgr::RIT_Deferred ) { - prePassBin = (RenderPrePassMgr*)bin; + prePassBin = (RenderDeferredMgr*)bin; break; } } - // If we found the prepass bin, set this bin to render very shortly afterwards + // If we found the deferred bin, set this bin to render very shortly afterwards // and re-add this render-manager. If there is no pre-pass bin, or it doesn't // have a depth-texture, we can't render offscreen. mOffscreenRenderEnabled = prePassBin && (prePassBin->getTargetChainLength() > 0); @@ -619,7 +619,7 @@ void RenderParticleMgr::_onLMActivate( const char*, bool activate ) } // Find the targets we use - mPrepassTarget = NamedTexTarget::find( "prepass" ); + mDeferredTarget = NamedTexTarget::find( "deferred" ); mEdgeTarget = NamedTexTarget::find( "edge" ); // Setup the shader @@ -668,7 +668,7 @@ GFXStateBlockRef RenderParticleMgr::_getOffscreenStateBlock(ParticleRenderInst * d.samplers[0].alphaArg1 = GFXTATexture; d.samplers[0].alphaArg2 = GFXTADiffuse; - // Prepass sampler + // Deferred sampler d.samplers[1] = GFXSamplerStateDesc::getClampPoint(); mOffscreenBlocks[blendStyle] = GFX->createStateBlock(d); @@ -701,7 +701,7 @@ GFXStateBlockRef RenderParticleMgr::_getHighResStateBlock(ParticleRenderInst *ri d.samplers[0].alphaArg1 = GFXTATexture; d.samplers[0].alphaArg2 = GFXTADiffuse; - // Prepass sampler + // Deferred sampler d.samplers[1] = GFXSamplerStateDesc::getClampPoint(); mHighResBlocks[blendStyle] = GFX->createStateBlock(d); @@ -773,7 +773,7 @@ GFXStateBlockRef RenderParticleMgr::_getMixedResStateBlock(ParticleRenderInst *r d.samplers[0].alphaArg1 = GFXTATexture; d.samplers[0].alphaArg2 = GFXTADiffuse; - // Prepass sampler + // Deferred sampler d.samplers[1] = GFXSamplerStateDesc::getClampPoint(); mMixedResBlocks[blendStyle] = GFX->createStateBlock(d); diff --git a/Engine/source/renderInstance/renderParticleMgr.h b/Engine/source/renderInstance/renderParticleMgr.h index f1cdc5fd0..77b3d6a82 100644 --- a/Engine/source/renderInstance/renderParticleMgr.h +++ b/Engine/source/renderInstance/renderParticleMgr.h @@ -42,7 +42,7 @@ class RenderParticleMgr : public RenderTexTargetBinManager friend class RenderTranslucentMgr; public: - // Generic PrePass Render Instance Type + // Generic Deferred Render Instance Type static const RenderInstType RIT_Particles; RenderParticleMgr(); @@ -82,9 +82,9 @@ public: protected: bool mOffscreenRenderEnabled; - /// The prepass render target used for the + /// The deferred render target used for the /// soft particle shader effect. - NamedTexTargetRef mPrepassTarget; + NamedTexTargetRef mDeferredTarget; /// The shader used for particle rendering. GFXShaderRef mParticleShader; @@ -109,11 +109,11 @@ protected: GFXShaderConstHandle *mFSModelViewProjSC; GFXShaderConstHandle *mOneOverFarSC; GFXShaderConstHandle *mOneOverSoftnessSC; - GFXShaderConstHandle *mPrePassTargetParamsSC; + GFXShaderConstHandle *mDeferredTargetParamsSC; GFXShaderConstHandle *mAlphaFactorSC; GFXShaderConstHandle *mAlphaScaleSC; GFXShaderConstHandle *mSamplerDiffuse; - GFXShaderConstHandle *mSamplerPrePassTex; + GFXShaderConstHandle *mSamplerDeferredTex; GFXShaderConstHandle *mSamplerParaboloidLightMap; } mParticleShaderConsts; diff --git a/Engine/source/renderInstance/renderTerrainMgr.cpp b/Engine/source/renderInstance/renderTerrainMgr.cpp index 4a67e686f..58bbe5e71 100644 --- a/Engine/source/renderInstance/renderTerrainMgr.cpp +++ b/Engine/source/renderInstance/renderTerrainMgr.cpp @@ -119,7 +119,7 @@ void RenderTerrainMgr::render( SceneRenderState *state ) return; // Check if bin is disabled in advanced lighting. - if ( MATMGR->getPrePassEnabled() && mBasicOnly ) + if ( MATMGR->getDeferredEnabled() && mBasicOnly ) return; PROFILE_SCOPE( RenderTerrainMgr_Render ); diff --git a/Engine/source/renderInstance/renderTexTargetBinManager.cpp b/Engine/source/renderInstance/renderTexTargetBinManager.cpp index 5353f4566..6a8339e89 100644 --- a/Engine/source/renderInstance/renderTexTargetBinManager.cpp +++ b/Engine/source/renderInstance/renderTexTargetBinManager.cpp @@ -37,7 +37,7 @@ ConsoleDocClass( RenderTexTargetBinManager, "@brief An abstract base class for render bin managers that render to a named textue target.\n\n" "This bin itself doesn't do any rendering work. It offers functionality to manage " "a texture render target which derived render bin classes can render into.\n\n" - "@see RenderPrePassMgr\n" + "@see RenderDeferredMgr\n" "@ingroup RenderBin\n" ); diff --git a/Engine/source/shaderGen/GLSL/bumpGLSL.cpp b/Engine/source/shaderGen/GLSL/bumpGLSL.cpp index 020107b57..4706e96c7 100644 --- a/Engine/source/shaderGen/GLSL/bumpGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/bumpGLSL.cpp @@ -365,9 +365,9 @@ ShaderFeature::Resources ParallaxFeatGLSL::getResources( const MaterialFeatureDa // We add the outViewTS to the outputstructure. res.numTexReg = 1; - // If this isn't a prepass then we will be + // If this isn't a deferred then we will be // creating the normal map here. - if ( !fd.features.hasFeature( MFT_PrePassConditioner ) ) + if ( !fd.features.hasFeature( MFT_DeferredConditioner ) ) res.numTex = 1; return res; diff --git a/Engine/source/shaderGen/GLSL/depthGLSL.cpp b/Engine/source/shaderGen/GLSL/depthGLSL.cpp index 2eb5663e9..f1e4b4d00 100644 --- a/Engine/source/shaderGen/GLSL/depthGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/depthGLSL.cpp @@ -108,7 +108,7 @@ void EyeSpaceDepthOutGLSL::processPix( Vector &componentList, // If there isn't an output conditioner for the pre-pass, than just write // out the depth to rgba and return. - if( !fd.features[MFT_PrePassConditioner] ) + if( !fd.features[MFT_DeferredConditioner] ) meta->addStatement( new GenOp( " @;\r\n", assignColor( new GenOp( "float4(float3(@),1)", depthOut ), Material::None ) ) ); output = meta; diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 0a7ec2159..ee3b743c0 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -953,7 +953,7 @@ void DiffuseMapFeatGLSL::processPix( Vector &componentList, // To dump out UV coords... //#define DEBUG_ATLASED_UV_COORDS #ifdef DEBUG_ATLASED_UV_COORDS - if(!fd.features[MFT_PrePassConditioner]) + if(!fd.features[MFT_DeferredConditioner]) { meta->addStatement(new GenOp(" @ = vec4(@.xy, mipLod / @.w, 1.0);\r\n", new DecOp(diffColor), inTex, atParams)); meta->addStatement(new GenOp(" @; return OUT;\r\n", assignColor(diffColor, Material::Mul, NULL, targ) ) ); @@ -1269,7 +1269,7 @@ void LightmapFeatGLSL::processPix( Vector &componentList, bool bPreProcessedLighting = false; AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) - bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass(); + bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred(); // Lightmap has already been included in the advanced light bin, so // no need to do any sampling or anything @@ -1394,7 +1394,7 @@ void TonemapFeatGLSL::processPix( Vector &componentList, bool bPreProcessedLighting = false; AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) - bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass(); + bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred(); // Add in the realtime lighting contribution if ( fd.features[MFT_RTLighting] ) @@ -1549,7 +1549,7 @@ void VertLitGLSL::processPix( Vector &componentList, bool bPreProcessedLighting = false; AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) - bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass(); + bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred(); // Assign value in d_lightcolor to toneMapColor if it exists. This is // the dynamic light buffer, and it already has the baked-vertex-color diff --git a/Engine/source/shaderGen/HLSL/bumpHLSL.cpp b/Engine/source/shaderGen/HLSL/bumpHLSL.cpp index 79ea27714..646d434d6 100644 --- a/Engine/source/shaderGen/HLSL/bumpHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/bumpHLSL.cpp @@ -406,9 +406,9 @@ ShaderFeature::Resources ParallaxFeatHLSL::getResources( const MaterialFeatureDa // We add the outViewTS to the outputstructure. res.numTexReg = 1; - // If this isn't a prepass then we will be + // If this isn't a deferred then we will be // creating the normal map here. - if ( !fd.features.hasFeature( MFT_PrePassConditioner ) ) + if ( !fd.features.hasFeature( MFT_DeferredConditioner ) ) res.numTex = 1; return res; diff --git a/Engine/source/shaderGen/HLSL/depthHLSL.cpp b/Engine/source/shaderGen/HLSL/depthHLSL.cpp index ecb23d676..382245311 100644 --- a/Engine/source/shaderGen/HLSL/depthHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/depthHLSL.cpp @@ -108,7 +108,7 @@ void EyeSpaceDepthOutHLSL::processPix( Vector &componentList, // If there isn't an output conditioner for the pre-pass, than just write // out the depth to rgba and return. - if( !fd.features[MFT_PrePassConditioner] ) + if( !fd.features[MFT_DeferredConditioner] ) meta->addStatement( new GenOp( " @;\r\n", assignColor( new GenOp( "float4(@.rrr,1)", depthOut ), Material::None ) ) ); output = meta; diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 8690ae610..f997f2919 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -991,7 +991,7 @@ void DiffuseMapFeatHLSL::processPix( Vector &componentList, // To dump out UV coords... //#define DEBUG_ATLASED_UV_COORDS #ifdef DEBUG_ATLASED_UV_COORDS - if(!fd.features[MFT_PrePassConditioner]) + if(!fd.features[MFT_DeferredConditioner]) { meta->addStatement(new GenOp(" @ = float4(@.xy, mipLod / @.w, 1.0);\r\n", new DecOp(diffColor), inTex, atParams)); meta->addStatement(new GenOp(" @; return OUT;\r\n", assignColor(diffColor, Material::Mul, NULL, targ) ) ); @@ -1347,7 +1347,7 @@ void LightmapFeatHLSL::processPix( Vector &componentList, bool bPreProcessedLighting = false; AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) - bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass(); + bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred(); // Lightmap has already been included in the advanced light bin, so // no need to do any sampling or anything @@ -1497,7 +1497,7 @@ void TonemapFeatHLSL::processPix( Vector &componentList, bool bPreProcessedLighting = false; AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) - bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass(); + bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred(); // Add in the realtime lighting contribution if ( fd.features[MFT_RTLighting] ) @@ -1652,7 +1652,7 @@ void VertLitHLSL::processPix( Vector &componentList, bool bPreProcessedLighting = false; AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) - bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass(); + bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred(); // Assign value in d_lightcolor to toneMapColor if it exists. This is // the dynamic light buffer, and it already has the baked-vertex-color diff --git a/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp b/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp index 8ea9bbf0f..0d2372b67 100644 --- a/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp +++ b/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp @@ -94,7 +94,7 @@ void _initShaderGenHLSL( ShaderGen *shaderGen ) FEATUREMGR->registerFeature( MFT_ParticleNormal, new ParticleNormalFeatureHLSL ); - FEATUREMGR->registerFeature( MFT_InterlacedPrePass, new NamedFeatureHLSL( "Interlaced Pre Pass" ) ); + FEATUREMGR->registerFeature( MFT_InterlacedDeferred, new NamedFeatureHLSL( "Interlaced Pre Pass" ) ); FEATUREMGR->registerFeature( MFT_ForwardShading, new NamedFeatureHLSL( "Forward Shaded Material" ) ); diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 193f9587c..abcbef014 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -911,8 +911,8 @@ U32 TerrainMacroMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd ) c void TerrainNormalMapFeatGLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { - // We only need to process normals during the prepass. - if ( !fd.features.hasFeature( MFT_PrePassConditioner ) ) + // We only need to process normals during the deferred. + if ( !fd.features.hasFeature( MFT_DeferredConditioner ) ) return; MultiLine *meta = new MultiLine; @@ -933,7 +933,7 @@ void TerrainNormalMapFeatGLSL::processPix( Vector &component Var *viewToTangent = getInViewToTangent( componentList ); // This var is read from GBufferConditionerGLSL and - // used in the prepass output. + // used in the deferred output. Var *gbNormal = (Var*)LangElement::find( "gbNormal" ); if ( !gbNormal ) { @@ -1004,8 +1004,8 @@ ShaderFeature::Resources TerrainNormalMapFeatGLSL::getResources( const MaterialF { Resources res; - // We only need to process normals during the prepass. - if ( fd.features.hasFeature( MFT_PrePassConditioner ) ) + // We only need to process normals during the deferred. + if ( fd.features.hasFeature( MFT_DeferredConditioner ) ) { // If this is the first normal map and there // are no parallax features then we will diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index 74fdd417b..1cdc96ee6 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -971,8 +971,8 @@ U32 TerrainMacroMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd ) c void TerrainNormalMapFeatHLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { - // We only need to process normals during the prepass. - if ( !fd.features.hasFeature( MFT_PrePassConditioner ) ) + // We only need to process normals during the deferred. + if ( !fd.features.hasFeature( MFT_DeferredConditioner ) ) return; MultiLine *meta = new MultiLine; @@ -993,7 +993,7 @@ void TerrainNormalMapFeatHLSL::processPix( Vector &component Var *viewToTangent = getInViewToTangent( componentList ); // This var is read from GBufferConditionerHLSL and - // used in the prepass output. + // used in the deferred output. Var *gbNormal = (Var*)LangElement::find( "gbNormal" ); if ( !gbNormal ) { @@ -1090,8 +1090,8 @@ ShaderFeature::Resources TerrainNormalMapFeatHLSL::getResources( const MaterialF { Resources res; - // We only need to process normals during the prepass. - if ( fd.features.hasFeature( MFT_PrePassConditioner ) ) + // We only need to process normals during the deferred. + if ( fd.features.hasFeature( MFT_DeferredConditioner ) ) { // If this is the first normal map and there // are no parallax features then we will diff --git a/Engine/source/terrain/terrCell.cpp b/Engine/source/terrain/terrCell.cpp index b69cb7fb5..7f2bdd08b 100644 --- a/Engine/source/terrain/terrCell.cpp +++ b/Engine/source/terrain/terrCell.cpp @@ -1062,7 +1062,7 @@ void TerrCell::preloadMaterials() if ( GFX->getPixelShaderVersion() > 2.0f && dStrcmp( LIGHTMGR->getId(), "BLM" ) != 0) - material->getPrePassMat(); + material->getDeferredMat(); } for ( U32 i = 0; i < 4; i++ ) diff --git a/Engine/source/terrain/terrCellMaterial.cpp b/Engine/source/terrain/terrCellMaterial.cpp index 796c4df47..4cb751e61 100644 --- a/Engine/source/terrain/terrCellMaterial.cpp +++ b/Engine/source/terrain/terrCellMaterial.cpp @@ -29,7 +29,7 @@ #include "materials/materialManager.h" #include "terrain/terrFeatureTypes.h" #include "terrain/terrMaterial.h" -#include "renderInstance/renderPrePassMgr.h" +#include "renderInstance/renderDeferredMgr.h" #include "shaderGen/shaderGen.h" #include "shaderGen/featureMgr.h" #include "scene/sceneRenderState.h" @@ -71,7 +71,7 @@ const Vector TerrainCellMaterial::mSamplerNames = _initSamplerNames(); TerrainCellMaterial::TerrainCellMaterial() : mTerrain( NULL ), mCurrPass( 0 ), - mPrePassMat( NULL ), + mDeferredMat( NULL ), mReflectMat( NULL ) { smAllMaterials.push_back( this ); @@ -79,7 +79,7 @@ TerrainCellMaterial::TerrainCellMaterial() TerrainCellMaterial::~TerrainCellMaterial() { - SAFE_DELETE( mPrePassMat ); + SAFE_DELETE( mDeferredMat ); SAFE_DELETE( mReflectMat ); smAllMaterials.remove( this ); } @@ -219,15 +219,15 @@ void TerrainCellMaterial::setTransformAndEye( const MatrixF &modelXfm, } } -TerrainCellMaterial* TerrainCellMaterial::getPrePassMat() +TerrainCellMaterial* TerrainCellMaterial::getDeferredMat() { - if ( !mPrePassMat ) + if ( !mDeferredMat ) { - mPrePassMat = new TerrainCellMaterial(); - mPrePassMat->init( mTerrain, mMaterials, true, false, mMaterials == 0 ); + mDeferredMat = new TerrainCellMaterial(); + mDeferredMat->init( mTerrain, mMaterials, true, false, mMaterials == 0 ); } - return mPrePassMat; + return mDeferredMat; } TerrainCellMaterial* TerrainCellMaterial::getReflectMat() @@ -248,7 +248,7 @@ void TerrainCellMaterial::init( TerrainBlock *block, bool baseOnly ) { // This isn't allowed for now. - AssertFatal( !( prePassMat && reflectMat ), "TerrainCellMaterial::init - We shouldn't get prepass and reflection in the same material!" ); + AssertFatal( !( prePassMat && reflectMat ), "TerrainCellMaterial::init - We shouldn't get deferred and reflection in the same material!" ); mTerrain = block; mMaterials = activeMaterials; @@ -301,8 +301,8 @@ void TerrainCellMaterial::init( TerrainBlock *block, for_each( materials.begin(), materials.end(), delete_pointer() ); // If we have attached mats then update them too. - if ( mPrePassMat ) - mPrePassMat->init( mTerrain, mMaterials, true, false, baseOnly ); + if ( mDeferredMat ) + mDeferredMat->init( mTerrain, mMaterials, true, false, baseOnly ); if ( mReflectMat ) mReflectMat->init( mTerrain, mMaterials, false, true, baseOnly ); } @@ -341,14 +341,14 @@ bool TerrainCellMaterial::_createPass( Vector *materials, const bool disableParallaxMaps = GFX->getPixelShaderVersion() < 3.0f || MATMGR->getExclusionFeatures().hasFeature( MFT_Parallax ); - // Has advanced lightmap support been enabled for prepass. + // Has advanced lightmap support been enabled for deferred. bool advancedLightmapSupport = false; if ( prePassMat ) { // This sucks... but it works. AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) ) - advancedLightmapSupport = lightBin->MRTLightmapsDuringPrePass(); + advancedLightmapSupport = lightBin->MRTLightmapsDuringDeferred(); } // Loop till we create a valid shader! @@ -360,7 +360,7 @@ bool TerrainCellMaterial::_createPass( Vector *materials, if ( prePassMat ) { features.addFeature( MFT_EyeSpaceDepthOut ); - features.addFeature( MFT_PrePassConditioner ); + features.addFeature( MFT_DeferredConditioner ); features.addFeature( MFT_DeferredTerrainBaseMap ); features.addFeature(MFT_isDeferred); @@ -546,7 +546,7 @@ bool TerrainCellMaterial::_createPass( Vector *materials, { desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha ); - // If this is the prepass then we don't want to + // If this is the deferred then we don't want to // write to the last two color channels (where // depth is usually encoded). // @@ -558,9 +558,9 @@ bool TerrainCellMaterial::_createPass( Vector *materials, desc.setColorWrites( true, true, true, false ); } - // We write to the zbuffer if this is a prepass - // material or if the prepass is disabled. - desc.setZReadWrite( true, !MATMGR->getPrePassEnabled() || + // We write to the zbuffer if this is a deferred + // material or if the deferred is disabled. + desc.setZReadWrite( true, !MATMGR->getDeferredEnabled() || prePassMat || reflectMat ); @@ -669,10 +669,10 @@ bool TerrainCellMaterial::_createPass( Vector *materials, materials->pop_front(); } - // If we're doing prepass it requires some + // If we're doing deferred it requires some // special stencil settings for it to work. if ( prePassMat ) - desc.addDesc( RenderPrePassMgr::getOpaqueStenciWriteDesc( false ) ); + desc.addDesc( RenderDeferredMgr::getOpaqueStenciWriteDesc( false ) ); desc.setCullMode( GFXCullCCW ); pass->stateBlock = GFX->createStateBlock(desc); diff --git a/Engine/source/terrain/terrCellMaterial.h b/Engine/source/terrain/terrCellMaterial.h index 1f2fbfb68..a10a5e657 100644 --- a/Engine/source/terrain/terrCellMaterial.h +++ b/Engine/source/terrain/terrCellMaterial.h @@ -153,8 +153,8 @@ protected: NamedTexTargetRef mLightInfoTarget; - /// The prepass material for this material. - TerrainCellMaterial *mPrePassMat; + /// The deferred material for this material. + TerrainCellMaterial *mDeferredMat; /// The reflection material for this material. TerrainCellMaterial *mReflectMat; @@ -182,8 +182,8 @@ public: bool reflectMat = false, bool baseOnly = false ); - /// Returns a prepass material from this material. - TerrainCellMaterial* getPrePassMat(); + /// Returns a deferred material from this material. + TerrainCellMaterial* getDeferredMat(); /// Returns the reflection material from this material. TerrainCellMaterial* getReflectMat(); diff --git a/Templates/BaseGame/game/core/gfxData/shaders.cs b/Templates/BaseGame/game/core/gfxData/shaders.cs index 8dce075e5..da3b7c864 100644 --- a/Templates/BaseGame/game/core/gfxData/shaders.cs +++ b/Templates/BaseGame/game/core/gfxData/shaders.cs @@ -34,7 +34,7 @@ singleton ShaderData( ParticlesShaderData ) OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particlesP.glsl"; samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$prepassTex"; + samplerNames[1] = "$deferredTex"; samplerNames[2] = "$paraboloidLightMap"; pixVersion = 2.0; @@ -103,7 +103,7 @@ new ShaderData( fxFoliageReplicatorShader ) pixVersion = 1.4; }; -singleton ShaderData( VolumetricFogPrePassShader ) +singleton ShaderData( VolumetricFogDeferredShader ) { DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreP.hlsl"; @@ -121,7 +121,7 @@ singleton ShaderData( VolumetricFogShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogV.glsl"; OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogP.glsl"; - samplerNames[0] = "$prepassTex"; + samplerNames[0] = "$deferredTex"; samplerNames[1] = "$depthBuffer"; samplerNames[2] = "$frontBuffer"; samplerNames[3] = "$density"; diff --git a/Templates/BaseGame/game/core/gfxData/water.cs b/Templates/BaseGame/game/core/gfxData/water.cs index a7332d0c4..ec5e4be71 100644 --- a/Templates/BaseGame/game/core/gfxData/water.cs +++ b/Templates/BaseGame/game/core/gfxData/water.cs @@ -35,7 +35,7 @@ singleton ShaderData( WaterShader ) OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterP.glsl"; samplerNames[0] = "$bumpMap"; // noise - samplerNames[1] = "$prepassTex"; // #prepass + samplerNames[1] = "$deferredTex"; // #deferred samplerNames[2] = "$reflectMap"; // $reflectbuff samplerNames[3] = "$refractBuff"; // $backbuff samplerNames[4] = "$skyMap"; // $cubemap @@ -61,7 +61,7 @@ singleton GFXStateBlockData( WaterStateBlock ) { samplersDefined = true; samplerStates[0] = WaterSampler; // noise - samplerStates[1] = SamplerClampPoint; // #prepass + samplerStates[1] = SamplerClampPoint; // #deferred samplerStates[2] = SamplerClampLinear; // $reflectbuff samplerStates[3] = SamplerClampPoint; // $backbuff samplerStates[4] = SamplerWrapLinear; // $cubemap @@ -78,7 +78,7 @@ singleton GFXStateBlockData( UnderWaterStateBlock : WaterStateBlock ) singleton CustomMaterial( WaterMat ) { - sampler["prepassTex"] = "#prepass"; + sampler["deferredTex"] = "#deferred"; sampler["reflectMap"] = "$reflectbuff"; sampler["refractBuff"] = "$backbuff"; // These samplers are set in code not here. @@ -115,7 +115,7 @@ singleton CustomMaterial( UnderwaterMat ) //sampler["bumpMap"] = "core/art/water/noise02"; //sampler["foamMap"] = "core/art/water/foam"; - sampler["prepassTex"] = "#prepass"; + sampler["deferredTex"] = "#deferred"; sampler["refractBuff"] = "$backbuff"; shader = UnderWaterShader; @@ -171,7 +171,7 @@ singleton CustomMaterial( WaterBasicMat ) //sampler["bumpMap"] = "core/art/water/noise02"; //sampler["skyMap"] = "$cubemap"; - //sampler["prepassTex"] = "#prepass"; + //sampler["deferredTex"] = "#deferred"; sampler["reflectMap"] = "$reflectbuff"; sampler["refractBuff"] = "$backbuff"; @@ -199,7 +199,7 @@ singleton CustomMaterial( UnderwaterBasicMat ) //sampler["bumpMap"] = "core/art/water/noise02"; //samplers["skyMap"] = "$cubemap"; - //sampler["prepassTex"] = "#prepass"; + //sampler["deferredTex"] = "#deferred"; sampler["refractBuff"] = "$backbuff"; shader = UnderWaterBasicShader; diff --git a/Templates/BaseGame/game/core/lighting/advanced/deferredShading.cs b/Templates/BaseGame/game/core/lighting/advanced/deferredShading.cs index 1b998db3b..02603ff22 100644 --- a/Templates/BaseGame/game/core/lighting/advanced/deferredShading.cs +++ b/Templates/BaseGame/game/core/lighting/advanced/deferredShading.cs @@ -46,9 +46,9 @@ new ShaderData( AL_DeferredShader ) OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredShadingP.glsl"; samplerNames[0] = "colorBufferTex"; - samplerNames[1] = "lightPrePassTex"; + samplerNames[1] = "lightDeferredTex"; samplerNames[2] = "matInfoTex"; - samplerNames[3] = "prepassTex"; + samplerNames[3] = "deferredTex"; pixVersion = 2.0; }; @@ -62,7 +62,7 @@ singleton PostEffect( AL_DeferredShading ) texture[0] = "#color"; texture[1] = "#lightinfo"; texture[2] = "#matinfo"; - texture[3] = "#prepass"; + texture[3] = "#deferred"; target = "$backBuffer"; renderPriority = 10000; diff --git a/Templates/BaseGame/game/core/lighting/advanced/shaders.cs b/Templates/BaseGame/game/core/lighting/advanced/shaders.cs index 6cf97f810..3600c5206 100644 --- a/Templates/BaseGame/game/core/lighting/advanced/shaders.cs +++ b/Templates/BaseGame/game/core/lighting/advanced/shaders.cs @@ -83,7 +83,7 @@ new CustomMaterial( AL_VectorLightMaterial ) shader = AL_VectorLightShader; stateBlock = AL_VectorLightState; - sampler["prePassBuffer"] = "#prepass"; + sampler["prePassBuffer"] = "#deferred"; sampler["shadowMap"] = "$dynamiclight"; sampler["dynamicShadowMap"] = "$dynamicShadowMap"; sampler["ssaoMask"] = "#ssaoMask"; @@ -160,7 +160,7 @@ new CustomMaterial( AL_PointLightMaterial ) shader = AL_PointLightShader; stateBlock = AL_ConvexLightState; - sampler["prePassBuffer"] = "#prepass"; + sampler["prePassBuffer"] = "#deferred"; sampler["shadowMap"] = "$dynamiclight"; sampler["dynamicShadowMap"] = "$dynamicShadowMap"; sampler["cookieMap"] = "$dynamiclightmask"; @@ -199,7 +199,7 @@ new CustomMaterial( AL_SpotLightMaterial ) shader = AL_SpotLightShader; stateBlock = AL_ConvexLightState; - sampler["prePassBuffer"] = "#prepass"; + sampler["prePassBuffer"] = "#deferred"; sampler["shadowMap"] = "$dynamiclight"; sampler["dynamicShadowMap"] = "$dynamicShadowMap"; sampler["cookieMap"] = "$dynamiclightmask"; @@ -212,9 +212,9 @@ new CustomMaterial( AL_SpotLightMaterial ) pixVersion = 3.0; }; -/// This material is used for generating prepass +/// This material is used for generating deferred /// materials for objects that do not have materials. -new Material( AL_DefaultPrePassMaterial ) +new Material( AL_DefaultDeferredMaterial ) { // We need something in the first pass else it // won't create a proper material instance. @@ -269,7 +269,7 @@ new CustomMaterial( AL_ParticlePointLightMaterial ) shader = AL_ParticlePointLightShader; stateBlock = AL_ConvexLightState; - sampler["prePassBuffer"] = "#prepass"; + sampler["prePassBuffer"] = "#deferred"; target = "lightinfo"; pixVersion = 3.0; diff --git a/Templates/BaseGame/game/core/postFX/MLAA.cs b/Templates/BaseGame/game/core/postFX/MLAA.cs index a67696d42..ee07427ee 100644 --- a/Templates/BaseGame/game/core/postFX/MLAA.cs +++ b/Templates/BaseGame/game/core/postFX/MLAA.cs @@ -51,7 +51,7 @@ singleton ShaderData( MLAA_EdgeDetectionShader ) OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/edgeDetectionP.glsl"; samplerNames[0] = "$colorMapG"; - samplerNames[1] = "$prepassMap"; + samplerNames[1] = "$deferredMap"; pixVersion = 3.0; }; @@ -125,7 +125,7 @@ singleton PostEffect( MLAAFx ) renderTime = "PFXAfterDiffuse"; texture[0] = "$backBuffer"; //colorMapG - texture[1] = "#prepass"; // Used for depth detection + texture[1] = "#deferred"; // Used for depth detection target = "$outTex"; targetClear = PFXTargetClear_OnDraw; diff --git a/Templates/BaseGame/game/core/postFX/MotionBlurFx.cs b/Templates/BaseGame/game/core/postFX/MotionBlurFx.cs index da0912722..6919cc5a7 100644 --- a/Templates/BaseGame/game/core/postFX/MotionBlurFx.cs +++ b/Templates/BaseGame/game/core/postFX/MotionBlurFx.cs @@ -29,7 +29,7 @@ singleton ShaderData( PFX_MotionBlurShader ) OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/motionBlurP.glsl"; samplerNames[0] = "$backBuffer"; - samplerNames[1] = "$prepassTex"; + samplerNames[1] = "$deferredTex"; pixVersion = 3.0; }; @@ -43,7 +43,7 @@ singleton PostEffect(MotionBlurFX) shader = PFX_MotionBlurShader; stateBlock = PFX_DefaultStateBlock; texture[0] = "$backbuffer"; - texture[1] = "#prepass"; + texture[1] = "#deferred"; target = "$backBuffer"; }; diff --git a/Templates/BaseGame/game/core/postFX/caustics.cs b/Templates/BaseGame/game/core/postFX/caustics.cs index 25c1ac766..f391ec67a 100644 --- a/Templates/BaseGame/game/core/postFX/caustics.cs +++ b/Templates/BaseGame/game/core/postFX/caustics.cs @@ -41,7 +41,7 @@ singleton ShaderData( PFX_CausticsShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/caustics/gl/causticsP.glsl"; - samplerNames[0] = "$prepassTex"; + samplerNames[0] = "$deferredTex"; samplerNames[1] = "$causticsTex0"; samplerNames[2] = "$causticsTex1"; @@ -57,7 +57,7 @@ singleton PostEffect( CausticsPFX ) shader = PFX_CausticsShader; stateBlock = PFX_CausticsStateBlock; - texture[0] = "#prepass"; + texture[0] = "#deferred"; texture[1] = "core/images/caustics_1"; texture[2] = "core/images/caustics_2"; target = "$backBuffer"; diff --git a/Templates/BaseGame/game/core/postFX/dof.cs b/Templates/BaseGame/game/core/postFX/dof.cs index 21ba52800..1767a9c86 100644 --- a/Templates/BaseGame/game/core/postFX/dof.cs +++ b/Templates/BaseGame/game/core/postFX/dof.cs @@ -430,7 +430,7 @@ singleton PostEffect( DOFPostEffect ) shader = PFX_DOFDownSampleShader; stateBlock = PFX_DOFDownSampleStateBlock; texture[0] = "$backBuffer"; - texture[1] = "#prepass"; + texture[1] = "#deferred"; target = "#shrunk"; targetScale = "0.25 0.25"; @@ -485,7 +485,7 @@ singleton PostEffect( DOFFinalPFX ) texture[0] = "$backBuffer"; texture[1] = "$inTex"; texture[2] = "#largeBlur"; - texture[3] = "#prepass"; + texture[3] = "#deferred"; target = "$backBuffer"; }; diff --git a/Templates/BaseGame/game/core/postFX/edgeAA.cs b/Templates/BaseGame/game/core/postFX/edgeAA.cs index 4271a2ae1..c3b4263fa 100644 --- a/Templates/BaseGame/game/core/postFX/edgeAA.cs +++ b/Templates/BaseGame/game/core/postFX/edgeAA.cs @@ -40,7 +40,7 @@ singleton ShaderData( PFX_EdgeAADetectShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeDetectP.glsl"; - samplerNames[0] = "$prepassBuffer"; + samplerNames[0] = "$deferredBuffer"; pixVersion = 3.0; }; @@ -81,7 +81,7 @@ singleton PostEffect( EdgeDetectPostEffect ) shader = PFX_EdgeAADetectShader; stateBlock = PFX_DefaultEdgeAAStateBlock; - texture[0] = "#prepass"; + texture[0] = "#deferred"; target = "#edge"; isEnabled = true; diff --git a/Templates/BaseGame/game/core/postFX/fog.cs b/Templates/BaseGame/game/core/postFX/fog.cs index 48ed3c139..4b9bfc663 100644 --- a/Templates/BaseGame/game/core/postFX/fog.cs +++ b/Templates/BaseGame/game/core/postFX/fog.cs @@ -32,7 +32,7 @@ singleton ShaderData( FogPassShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/fogP.glsl"; - samplerNames[0] = "$prepassTex"; + samplerNames[0] = "$deferredTex"; pixVersion = 2.0; }; @@ -58,7 +58,7 @@ singleton PostEffect( FogPostFx ) shader = FogPassShader; stateBlock = FogPassStateBlock; - texture[0] = "#prepass"; + texture[0] = "#deferred"; renderPriority = 5; @@ -79,7 +79,7 @@ singleton ShaderData( UnderwaterFogPassShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/underwaterFogP.glsl"; - samplerNames[0] = "$prepassTex"; + samplerNames[0] = "$deferredTex"; samplerNames[1] = "$backbuffer"; samplerNames[2] = "$waterDepthGradMap"; @@ -110,7 +110,7 @@ singleton PostEffect( UnderwaterFogPostFx ) shader = UnderwaterFogPassShader; stateBlock = UnderwaterFogPassStateBlock; - texture[0] = "#prepass"; + texture[0] = "#deferred"; texture[1] = "$backBuffer"; texture[2] = "#waterDepthGradMap"; diff --git a/Templates/BaseGame/game/core/postFX/hdr.cs b/Templates/BaseGame/game/core/postFX/hdr.cs index 621228532..b874158eb 100644 --- a/Templates/BaseGame/game/core/postFX/hdr.cs +++ b/Templates/BaseGame/game/core/postFX/hdr.cs @@ -170,7 +170,7 @@ singleton ShaderData( HDR_CombineShader ) samplerNames[1] = "$luminanceTex"; samplerNames[2] = "$bloomTex"; samplerNames[3] = "$colorCorrectionTex"; - samplerNames[4] = "prepassTex"; + samplerNames[4] = "deferredTex"; pixVersion = 3.0; }; diff --git a/Templates/BaseGame/game/core/postFX/lightRay.cs b/Templates/BaseGame/game/core/postFX/lightRay.cs index b1a5d9015..523b9bdea 100644 --- a/Templates/BaseGame/game/core/postFX/lightRay.cs +++ b/Templates/BaseGame/game/core/postFX/lightRay.cs @@ -39,7 +39,7 @@ singleton ShaderData( LightRayOccludeShader ) OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayOccludeP.glsl"; samplerNames[0] = "$backBuffer"; - samplerNames[1] = "$prepassTex"; + samplerNames[1] = "$deferredTex"; pixVersion = 3.0; }; @@ -77,7 +77,7 @@ singleton PostEffect( LightRayPostFX ) shader = LightRayOccludeShader; stateBlock = LightRayStateBlock; texture[0] = "$backBuffer"; - texture[1] = "#prepass"; + texture[1] = "#deferred"; target = "$outTex"; targetFormat = "GFXFormatR16G16B16A16F"; diff --git a/Templates/BaseGame/game/core/postFX/ssao.cs b/Templates/BaseGame/game/core/postFX/ssao.cs index e88f7128b..3165b263d 100644 --- a/Templates/BaseGame/game/core/postFX/ssao.cs +++ b/Templates/BaseGame/game/core/postFX/ssao.cs @@ -156,7 +156,7 @@ singleton ShaderData( SSAOShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_P.glsl"; - samplerNames[0] = "$prepassMap"; + samplerNames[0] = "$deferredMap"; samplerNames[1] = "$randNormalTex"; samplerNames[2] = "$powTable"; @@ -172,7 +172,7 @@ singleton ShaderData( SSAOBlurYShader ) OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_Blur_P.glsl"; samplerNames[0] = "$occludeMap"; - samplerNames[1] = "$prepassMap"; + samplerNames[1] = "$deferredMap"; pixVersion = 3.0; @@ -199,7 +199,7 @@ singleton PostEffect( SSAOPostFx ) shader = SSAOShader; stateBlock = SSAOStateBlock; - texture[0] = "#prepass"; + texture[0] = "#deferred"; texture[1] = "core/images/noise.png"; texture[2] = "#ssao_pow_table"; @@ -215,7 +215,7 @@ singleton PostEffect( SSAOPostFx ) stateBlock = SSAOBlurStateBlock; texture[0] = "$inTex"; - texture[1] = "#prepass"; + texture[1] = "#deferred"; target = "$outTex"; }; @@ -228,7 +228,7 @@ singleton PostEffect( SSAOPostFx ) stateBlock = SSAOBlurStateBlock; texture[0] = "$inTex"; - texture[1] = "#prepass"; + texture[1] = "#deferred"; target = "$outTex"; }; @@ -241,7 +241,7 @@ singleton PostEffect( SSAOPostFx ) stateBlock = SSAOBlurStateBlock; texture[0] = "$inTex"; - texture[1] = "#prepass"; + texture[1] = "#deferred"; target = "$outTex"; }; @@ -254,7 +254,7 @@ singleton PostEffect( SSAOPostFx ) stateBlock = SSAOBlurStateBlock; texture[0] = "$inTex"; - texture[1] = "#prepass"; + texture[1] = "#deferred"; // We write to a mask texture which is then // read by the lighting shaders to mask ambient. diff --git a/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogP.hlsl b/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogP.hlsl index e900f7548..9fdf5c882 100644 --- a/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogP.hlsl +++ b/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogP.hlsl @@ -25,7 +25,7 @@ #include "../shaderModelAutoGen.hlsl" #include "../torque.hlsl" -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); TORQUE_UNIFORM_SAMPLER2D(depthBuffer, 1); TORQUE_UNIFORM_SAMPLER2D(frontBuffer, 2); TORQUE_UNIFORM_SAMPLER2D(density, 3); @@ -56,7 +56,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0 float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0; uvscreen.y = 1.0 - uvscreen.y; - float obj_test = TORQUE_PREPASS_UNCONDITION(prepassTex, uvscreen).w * preBias; + float obj_test = TORQUE_PREPASS_UNCONDITION(deferredTex, uvscreen).w * preBias; float depth = TORQUE_TEX2D(depthBuffer, uvscreen).r; float front = TORQUE_TEX2D(frontBuffer, uvscreen).r; diff --git a/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreP.hlsl b/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreP.hlsl index fdc839507..9d5060935 100644 --- a/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreP.hlsl +++ b/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreP.hlsl @@ -20,7 +20,7 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -// Volumetric Fog prepass pixel shader V1.00 +// Volumetric Fog deferred pixel shader V1.00 #include "../shaderModel.hlsl" struct ConnectData diff --git a/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreV.hlsl b/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreV.hlsl index aba7a745d..b736e0d0d 100644 --- a/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreV.hlsl +++ b/Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreV.hlsl @@ -20,7 +20,7 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -// Volumetric Fog prepass vertex shader V1.00 +// Volumetric Fog deferred vertex shader V1.00 #include "../shaderModel.hlsl" #include "../hlslStructs.hlsl" diff --git a/Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogP.glsl b/Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogP.glsl index 7895d9e2d..fcfa31244 100644 --- a/Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogP.glsl +++ b/Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogP.glsl @@ -24,7 +24,7 @@ #include "shadergen:/autogenConditioners.h" #include "../../gl/torque.glsl" -uniform sampler2D prepassTex; +uniform sampler2D deferredTex; uniform sampler2D depthBuffer; uniform sampler2D frontBuffer; uniform sampler2D density; @@ -52,7 +52,7 @@ void main() vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0; uvscreen.y = 1.0 - uvscreen.y; - float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias; + float obj_test = deferredUncondition( deferredTex, uvscreen).w * preBias; float depth = tex2D(depthBuffer,uvscreen).r; float front = tex2D(frontBuffer,uvscreen).r; diff --git a/Templates/BaseGame/game/core/shaders/gl/particlesP.glsl b/Templates/BaseGame/game/core/shaders/gl/particlesP.glsl index 813e31a1d..efc3234e0 100644 --- a/Templates/BaseGame/game/core/shaders/gl/particlesP.glsl +++ b/Templates/BaseGame/game/core/shaders/gl/particlesP.glsl @@ -34,7 +34,7 @@ uniform float oneOverSoftness; uniform float oneOverFar; - uniform sampler2D prepassTex; + uniform sampler2D deferredTex; //uniform vec3 vEye; uniform vec4 prePassTargetParams; #endif @@ -88,7 +88,7 @@ void main() vec2 tc = IN_pos.xy * vec2(1.0, -1.0) / IN_pos.w; tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams); - float sceneDepth = prepassUncondition( prepassTex, tc ).w; + float sceneDepth = deferredUncondition( deferredTex, tc ).w; float depth = IN_pos.w * oneOverFar; float diff = sceneDepth - depth; #ifdef CLIP_Z diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/deferredClearGBufferP.hlsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/deferredClearGBufferP.hlsl index cefebe8c7..5ae05896e 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/deferredClearGBufferP.hlsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/deferredClearGBufferP.hlsl @@ -41,7 +41,7 @@ Fragout main( Conn IN ) { Fragout OUT; - // Clear Prepass Buffer ( Normals/Depth ); + // Clear Deferred Buffer ( Normals/Depth ); OUT.col = float4(1.0, 1.0, 1.0, 1.0); // Clear Color Buffer. diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/deferredShadingP.hlsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/deferredShadingP.hlsl index 338ebd8da..28f8eb563 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/deferredShadingP.hlsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/deferredShadingP.hlsl @@ -25,17 +25,17 @@ #include "../../torque.hlsl" TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0); -TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,1); +TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,1); TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2); -TORQUE_UNIFORM_SAMPLER2D(prepassTex,3); +TORQUE_UNIFORM_SAMPLER2D(deferredTex,3); float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 { - float4 lightBuffer = TORQUE_TEX2D( lightPrePassTex, IN.uv0 ); + float4 lightBuffer = TORQUE_TEX2D( lightDeferredTex, IN.uv0 ); float4 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 ); float4 matInfo = TORQUE_TEX2D( matInfoTex, IN.uv0 ); float specular = saturate(lightBuffer.a); - float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; + float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w; if (depth>0.9999) return float4(0,0,0,0); diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl index 39dc0dc9f..b58f347bb 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl @@ -29,7 +29,7 @@ out vec4 OUT_col2; //----------------------------------------------------------------------------- void main() { - // Clear Prepass Buffer ( Normals/Depth ); + // Clear Deferred Buffer ( Normals/Depth ); OUT_col = vec4(1.0, 1.0, 1.0, 1.0); // Clear Color Buffer. diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredShadingP.glsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredShadingP.glsl index ae01125af..0234d5fd1 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredShadingP.glsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredShadingP.glsl @@ -26,21 +26,21 @@ #include "../../../gl/torque.glsl" uniform sampler2D colorBufferTex; -uniform sampler2D lightPrePassTex; +uniform sampler2D lightDeferredTex; uniform sampler2D matInfoTex; -uniform sampler2D prepassTex; +uniform sampler2D deferredTex; out vec4 OUT_col; void main() { - float depth = prepassUncondition( prepassTex, uv0 ).w; + float depth = deferredUncondition( deferredTex, uv0 ).w; if (depth>0.9999) { OUT_col = vec4(0.0); return; } - vec4 lightBuffer = texture( lightPrePassTex, uv0 ); + vec4 lightBuffer = texture( lightDeferredTex, uv0 ); vec4 colorBuffer = texture( colorBufferTex, uv0 ); vec4 matInfo = texture( matInfoTex, uv0 ); float specular = clamp(lightBuffer.a,0.0,1.0); diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/pointLightP.glsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/pointLightP.glsl index 8fe127e04..9bb3cb727 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/pointLightP.glsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/pointLightP.glsl @@ -159,9 +159,9 @@ void main() } // Sample/unpack the normal/z data - vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene ); - vec3 normal = prepassSample.rgb; - float depth = prepassSample.a; + vec4 deferredSample = deferredUncondition( prePassBuffer, uvScene ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; // Eye ray - Eye -> Pixel vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane ); diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/spotLightP.glsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/spotLightP.glsl index c6ffa02a0..abff1f809 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/spotLightP.glsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/spotLightP.glsl @@ -101,9 +101,9 @@ void main() } // Sample/unpack the normal/z data - vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene ); - vec3 normal = prepassSample.rgb; - float depth = prepassSample.a; + vec4 deferredSample = deferredUncondition( prePassBuffer, uvScene ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; // Eye ray - Eye -> Pixel vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN_vsEyeDir.xyz, vsFarPlane ); diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/vectorLightP.glsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/vectorLightP.glsl index 15e0bf477..977afd9c0 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/vectorLightP.glsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/gl/vectorLightP.glsl @@ -214,9 +214,9 @@ void main() } // Sample/unpack the normal/z data - vec4 prepassSample = prepassUncondition( prePassBuffer, uv0 ); - vec3 normal = prepassSample.rgb; - float depth = prepassSample.a; + vec4 deferredSample = deferredUncondition( prePassBuffer, uv0 ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; // Use eye ray to get ws pos vec4 worldPos = vec4(eyePosWorld + wsEyeRay * depth, 1.0f); diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/particlePointLightP.hlsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/particlePointLightP.hlsl index 7ff5d50d2..9eeb52b94 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/particlePointLightP.hlsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/particlePointLightP.hlsl @@ -49,9 +49,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 float2 uvScene = getUVFromSSPos(ssPos, rtParams0); // Sample/unpack the normal/z data - float4 prepassSample = TORQUE_PREPASS_UNCONDITION(prePassBuffer, uvScene); - float3 normal = prepassSample.rgb; - float depth = prepassSample.a; + float4 deferredSample = TORQUE_PREPASS_UNCONDITION(prePassBuffer, uvScene); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; // Eye ray - Eye -> Pixel float3 eyeRay = getDistanceVectorToPlane(-vsFarPlane.w, IN.vsEyeDir, vsFarPlane); diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/pointLightP.hlsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/pointLightP.hlsl index a8c0ea105..e5a2a2d89 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/pointLightP.hlsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/pointLightP.hlsl @@ -161,9 +161,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 } // Sample/unpack the normal/z data - float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene ); - float3 normal = prepassSample.rgb; - float depth = prepassSample.a; + float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; // Eye ray - Eye -> Pixel float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane ); diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/spotLightP.hlsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/spotLightP.hlsl index 5040b15e2..5520b1a69 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/spotLightP.hlsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/spotLightP.hlsl @@ -99,9 +99,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 } // Sample/unpack the normal/z data - float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene ); - float3 normal = prepassSample.rgb; - float depth = prepassSample.a; + float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; // Eye ray - Eye -> Pixel float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane ); diff --git a/Templates/BaseGame/game/core/shaders/lighting/advanced/vectorLightP.hlsl b/Templates/BaseGame/game/core/shaders/lighting/advanced/vectorLightP.hlsl index 956227909..cbea25cb4 100644 --- a/Templates/BaseGame/game/core/shaders/lighting/advanced/vectorLightP.hlsl +++ b/Templates/BaseGame/game/core/shaders/lighting/advanced/vectorLightP.hlsl @@ -213,9 +213,9 @@ float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0 subsurface = float3(0.337255, 0.772549, 0.262745); } // Sample/unpack the normal/z data - float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, IN.uv0 ); - float3 normal = prepassSample.rgb; - float depth = prepassSample.a; + float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, IN.uv0 ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; // Use eye ray to get ws pos float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f); diff --git a/Templates/BaseGame/game/core/shaders/particlesP.hlsl b/Templates/BaseGame/game/core/shaders/particlesP.hlsl index 37439c59a..f393bf512 100644 --- a/Templates/BaseGame/game/core/shaders/particlesP.hlsl +++ b/Templates/BaseGame/game/core/shaders/particlesP.hlsl @@ -33,7 +33,7 @@ uniform float oneOverSoftness; uniform float oneOverFar; - TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1); + TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); //uniform float3 vEye; uniform float4 prePassTargetParams; #endif @@ -84,7 +84,7 @@ float4 main( Conn IN ) : TORQUE_TARGET0 float2 tc = IN.pos.xy * float2(1.0, -1.0) / IN.pos.w; tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams); - float sceneDepth = TORQUE_PREPASS_UNCONDITION(prepassTex, tc).w; + float sceneDepth = TORQUE_PREPASS_UNCONDITION(deferredTex, tc).w; float depth = IN.pos.w * oneOverFar; float diff = sceneDepth - depth; #ifdef CLIP_Z diff --git a/Templates/BaseGame/game/core/shaders/postFX/caustics/causticsP.hlsl b/Templates/BaseGame/game/core/shaders/postFX/caustics/causticsP.hlsl index d2f4a058a..c45376e22 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/caustics/causticsP.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/caustics/causticsP.hlsl @@ -28,7 +28,7 @@ uniform float3 eyePosWorld; uniform float4 rtParams0; uniform float4 waterFogPlane; -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); TORQUE_UNIFORM_SAMPLER2D(causticsTex0, 1); TORQUE_UNIFORM_SAMPLER2D(causticsTex1, 2); @@ -40,7 +40,7 @@ float distanceToPlane(float4 plane, float3 pos) float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 { //Sample the pre-pass - float4 prePass = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ); + float4 prePass = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ); //Get depth float depth = prePass.w; diff --git a/Templates/BaseGame/game/core/shaders/postFX/caustics/gl/causticsP.glsl b/Templates/BaseGame/game/core/shaders/postFX/caustics/gl/causticsP.glsl index 2d2a54154..5d62185dd 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/caustics/gl/causticsP.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/caustics/gl/causticsP.glsl @@ -29,7 +29,7 @@ uniform vec4 rtParams0; uniform vec4 waterFogPlane; uniform float accumTime; -uniform sampler2D prepassTex; +uniform sampler2D deferredTex; uniform sampler2D causticsTex0; uniform sampler2D causticsTex1; uniform vec2 targetSize; @@ -44,7 +44,7 @@ float distanceToPlane(vec4 plane, vec3 pos) void main() { //Sample the pre-pass - vec4 prePass = prepassUncondition( prepassTex, IN_uv0 ); + vec4 prePass = deferredUncondition( deferredTex, IN_uv0 ); //Get depth float depth = prePass.w; diff --git a/Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_DownSample_P.glsl b/Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_DownSample_P.glsl index 17f23e487..f3c093f31 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_DownSample_P.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_DownSample_P.glsl @@ -87,10 +87,10 @@ void main() coc = half4(0); for ( int i = 0; i < 4; i++ ) { - depth[0] = prepassUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w; - depth[1] = prepassUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w; - depth[2] = prepassUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w; - depth[3] = prepassUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w; + depth[0] = deferredUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w; + depth[1] = deferredUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w; + depth[2] = deferredUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w; + depth[3] = deferredUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w; // @todo OPENGL INTEL need review coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) ); diff --git a/Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Final_P.glsl b/Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Final_P.glsl index 40b71bc27..9b976ba1e 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Final_P.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Final_P.glsl @@ -117,7 +117,7 @@ void main() //med.rgb = large; //nearCoc = 0; - depth = prepassUncondition( depthSampler, IN_uv3 ).w; + depth = deferredUncondition( depthSampler, IN_uv3 ).w; //return half4(depth.rrr,1); //return half4(nearCoc.rrr,1.0); diff --git a/Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeDetectP.hlsl b/Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeDetectP.hlsl index 2277126a8..d9988341c 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeDetectP.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeDetectP.hlsl @@ -23,7 +23,7 @@ #include "../postFx.hlsl" #include "../../shaderModelAutoGen.hlsl" -TORQUE_UNIFORM_SAMPLER2D(prepassBuffer,0); +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer,0); // GPU Gems 3, pg 443-444 float GetEdgeWeight(float2 uv0, in float2 targetSize) @@ -50,7 +50,7 @@ float GetEdgeWeight(float2 uv0, in float2 targetSize) for(int i = 0; i < 9; i++) { float2 uv = uv0 + offsets[i] * PixelSize; - float4 gbSample = TORQUE_PREPASS_UNCONDITION( prepassBuffer, uv ); + float4 gbSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uv ); Depth[i] = gbSample.a; Normal[i] = gbSample.rgb; } diff --git a/Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeDetectP.glsl b/Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeDetectP.glsl index d1856ecde..02507eee8 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeDetectP.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeDetectP.glsl @@ -24,7 +24,7 @@ #include "shadergen:/autogenConditioners.h" // GPU Gems 3, pg 443-444 -float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize) +float GetEdgeWeight(vec2 uv0, in sampler2D deferredBuffer, in vec2 targetSize) { vec2 offsets[9] = vec2[]( vec2( 0.0, 0.0), @@ -47,7 +47,7 @@ float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize) for(int i = 0; i < 9; i++) { vec2 uv = uv0 + offsets[i] * PixelSize; - vec4 gbSample = prepassUncondition( prepassBuffer, uv ); + vec4 gbSample = deferredUncondition( deferredBuffer, uv ); Depth[i] = gbSample.a; Normal[i] = gbSample.rgb; } @@ -85,12 +85,12 @@ float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize) in vec2 uv0; #define IN_uv0 uv0 -uniform sampler2D prepassBuffer; +uniform sampler2D deferredBuffer; uniform vec2 targetSize; out vec4 OUT_col; void main() { - OUT_col = vec4( GetEdgeWeight(IN_uv0, prepassBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw); + OUT_col = vec4( GetEdgeWeight(IN_uv0, deferredBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw); } diff --git a/Templates/BaseGame/game/core/shaders/postFX/fogP.hlsl b/Templates/BaseGame/game/core/shaders/postFX/fogP.hlsl index de5fd65dc..437d8c396 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/fogP.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/fogP.hlsl @@ -25,7 +25,7 @@ #include "./../torque.hlsl" #include "./../shaderModelAutoGen.hlsl" -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); uniform float3 eyePosWorld; uniform float4 fogColor; uniform float3 fogData; @@ -33,8 +33,8 @@ uniform float4 rtParams0; float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 { - //float2 prepassCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; - float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; + //float2 deferredCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; + float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w; //return float4( depth, 0, 0, 0.7 ); float factor = computeSceneFog( eyePosWorld, diff --git a/Templates/BaseGame/game/core/shaders/postFX/gl/fogP.glsl b/Templates/BaseGame/game/core/shaders/postFX/gl/fogP.glsl index dd16f8b46..9dbc435fe 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/gl/fogP.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/gl/fogP.glsl @@ -25,7 +25,7 @@ #include "shadergen:/autogenConditioners.h" #include "../../gl/torque.glsl" -uniform sampler2D prepassTex ; +uniform sampler2D deferredTex ; uniform vec3 eyePosWorld; uniform vec4 fogColor; uniform vec3 fogData; @@ -38,8 +38,8 @@ out vec4 OUT_col; void main() { - //vec2 prepassCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy; - float depth = prepassUncondition( prepassTex, uv0 ).w; + //vec2 deferredCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy; + float depth = deferredUncondition( deferredTex, uv0 ).w; //return vec4( depth, 0, 0, 0.7 ); float factor = computeSceneFog( eyePosWorld, diff --git a/Templates/BaseGame/game/core/shaders/postFX/gl/motionBlurP.glsl b/Templates/BaseGame/game/core/shaders/postFX/gl/motionBlurP.glsl index 56333e776..8077d4124 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/gl/motionBlurP.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/gl/motionBlurP.glsl @@ -35,7 +35,7 @@ uniform mat4 matWorldToScreen; uniform float velocityMultiplier; uniform sampler2D backBuffer; -uniform sampler2D prepassTex; +uniform sampler2D deferredTex; out vec4 OUT_col; @@ -44,11 +44,11 @@ void main() vec2 IN_uv0 = _IN_uv0; float samples = 5; - // First get the prepass texture for uv channel 0 - vec4 prepass = prepassUncondition( prepassTex, IN_uv0 ); + // First get the deferred texture for uv channel 0 + vec4 deferred = deferredUncondition( deferredTex, IN_uv0 ); // Next extract the depth - float depth = prepass.a; + float depth = deferred.a; // Create the screen position vec4 screenPos = vec4(IN_uv0.x*2-1, IN_uv0.y*2-1, depth*2-1, 1); diff --git a/Templates/BaseGame/game/core/shaders/postFX/gl/underwaterFogP.glsl b/Templates/BaseGame/game/core/shaders/postFX/gl/underwaterFogP.glsl index 33cfae7bd..8b1b80bc0 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/gl/underwaterFogP.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/gl/underwaterFogP.glsl @@ -39,7 +39,7 @@ // Uniforms //----------------------------------------------------------------------------- -uniform sampler2D prepassTex ; +uniform sampler2D deferredTex ; uniform sampler2D backbuffer ; uniform sampler1D waterDepthGradMap; uniform vec3 eyePosWorld; @@ -55,9 +55,9 @@ out vec4 OUT_col; void main() { - //vec2 prepassCoord = IN_uv0; + //vec2 deferredCoord = IN_uv0; //IN_uv0 = ( IN_uv0.xy * rtParams0.zw ) + rtParams0.xy; - float depth = prepassUncondition( prepassTex, IN_uv0 ).w; + float depth = deferredUncondition( deferredTex, IN_uv0 ).w; //return vec4( depth.rrr, 1 ); // Skip fogging the extreme far plane so that diff --git a/Templates/BaseGame/game/core/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl b/Templates/BaseGame/game/core/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl index a7917b328..59f5f4bbf 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl @@ -25,7 +25,7 @@ #include "../../gl/postFX.glsl" uniform sampler2D backBuffer; // The original backbuffer. -uniform sampler2D prepassTex; // The pre-pass depth and normals. +uniform sampler2D deferredTex; // The pre-pass depth and normals. uniform float brightScalar; @@ -38,7 +38,7 @@ void main() vec4 col = vec4( 0, 0, 0, 1 ); // Get the depth at this pixel. - float depth = prepassUncondition( prepassTex, IN_uv0 ).w; + float depth = deferredUncondition( deferredTex, IN_uv0 ).w; // If the depth is equal to 1.0, read from the backbuffer // and perform the exposure calculation on the result. diff --git a/Templates/BaseGame/game/core/shaders/postFX/lightRay/lightRayOccludeP.hlsl b/Templates/BaseGame/game/core/shaders/postFX/lightRay/lightRayOccludeP.hlsl index b70bafa98..1a0e4222f 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/lightRay/lightRayOccludeP.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/lightRay/lightRayOccludeP.hlsl @@ -24,7 +24,7 @@ #include "../postFx.hlsl" TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); uniform float brightScalar; @@ -36,7 +36,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 col = float4( 0, 0, 0, 1 ); // Get the depth at this pixel. - float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; + float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w; // If the depth is equal to 1.0, read from the backbuffer // and perform the exposure calculation on the result. diff --git a/Templates/BaseGame/game/core/shaders/postFX/mlaa/edgeDetectionP.hlsl b/Templates/BaseGame/game/core/shaders/postFX/mlaa/edgeDetectionP.hlsl index 364bd948f..7d5c7f057 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/mlaa/edgeDetectionP.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/mlaa/edgeDetectionP.hlsl @@ -29,7 +29,7 @@ #include "shadergen:/autogenConditioners.h" uniform sampler2D colorMapG : register(S0); -uniform sampler2D prepassMap : register(S1); +uniform sampler2D deferredMap : register(S1); uniform float3 lumaCoefficients; uniform float threshold; @@ -43,7 +43,7 @@ float4 main( float2 texcoord : TEXCOORD0, // // Note that there is a lot of overlapped luma calculations; performance // can be improved if this luma calculation is performed in the main pass, - // which may give you an edge if used in conjunction with a z prepass. + // which may give you an edge if used in conjunction with a z deferred. float L = dot(tex2D(colorMapG, texcoord).rgb, lumaCoefficients); @@ -56,11 +56,11 @@ float4 main( float2 texcoord : TEXCOORD0, float4 edges = step(threshold, delta); // Add depth edges to color edges - float D = prepassUncondition(prepassMap, texcoord).w; - float Dleft = prepassUncondition(prepassMap, offset[0].xy).w; - float Dtop = prepassUncondition(prepassMap, offset[0].zw).w; - float Dright = prepassUncondition(prepassMap, offset[1].xy).w; - float Dbottom = prepassUncondition(prepassMap, offset[1].zw).w; + float D = deferredUncondition(deferredMap, texcoord).w; + float Dleft = deferredUncondition(deferredMap, offset[0].xy).w; + float Dtop = deferredUncondition(deferredMap, offset[0].zw).w; + float Dright = deferredUncondition(deferredMap, offset[1].xy).w; + float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w; delta = abs(D.xxxx - float4(Dleft, Dtop, Dright, Dbottom)); edges += step(depthThreshold, delta); diff --git a/Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/edgeDetectionP.glsl b/Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/edgeDetectionP.glsl index 362f29b5c..d964a28a4 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/edgeDetectionP.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/edgeDetectionP.glsl @@ -30,7 +30,7 @@ #include "shadergen:/autogenConditioners.h" uniform sampler2D colorMapG; -uniform sampler2D prepassMap; +uniform sampler2D deferredMap; uniform vec3 lumaCoefficients; uniform float threshold; @@ -47,7 +47,7 @@ void main() // // Note that there is a lot of overlapped luma calculations; performance // can be improved if this luma calculation is performed in the main pass, - // which may give you an edge if used in conjunction with a z prepass. + // which may give you an edge if used in conjunction with a z deferred. float L = dot(texture(colorMapG, texcoord).rgb, lumaCoefficients); @@ -60,11 +60,11 @@ void main() vec4 edges = step(threshold, delta); // Add depth edges to color edges - float D = prepassUncondition(prepassMap, texcoord).w; - float Dleft = prepassUncondition(prepassMap, offset[0].xy).w; - float Dtop = prepassUncondition(prepassMap, offset[0].zw).w; - float Dright = prepassUncondition(prepassMap, offset[1].xy).w; - float Dbottom = prepassUncondition(prepassMap, offset[1].zw).w; + float D = deferredUncondition(deferredMap, texcoord).w; + float Dleft = deferredUncondition(deferredMap, offset[0].xy).w; + float Dtop = deferredUncondition(deferredMap, offset[0].zw).w; + float Dright = deferredUncondition(deferredMap, offset[1].xy).w; + float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w; delta = abs(vec4(D) - vec4(Dleft, Dtop, Dright, Dbottom)); edges += step(depthThreshold, delta); diff --git a/Templates/BaseGame/game/core/shaders/postFX/motionBlurP.hlsl b/Templates/BaseGame/game/core/shaders/postFX/motionBlurP.hlsl index 8bc65fbc6..50839fe1e 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/motionBlurP.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/motionBlurP.hlsl @@ -30,17 +30,17 @@ uniform float4x4 matWorldToScreen; // Passed in from setShaderConsts() uniform float velocityMultiplier; TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); float4 main(PFXVertToPix IN) : TORQUE_TARGET0 { float samples = 5; - // First get the prepass texture for uv channel 0 - float4 prepass = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ); + // First get the deferred texture for uv channel 0 + float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ); // Next extract the depth - float depth = prepass.a; + float depth = deferred.a; // Create the screen position float4 screenPos = float4(IN.uv0.x*2-1, IN.uv0.y*2-1, depth*2-1, 1); diff --git a/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl b/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl index 270c68738..0a49622cf 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl @@ -24,7 +24,7 @@ #include "./../postFx.hlsl" TORQUE_UNIFORM_SAMPLER2D(occludeMap, 0); -TORQUE_UNIFORM_SAMPLER2D(prepassMap, 1); +TORQUE_UNIFORM_SAMPLER2D(deferredMap, 1); struct VertToPix { @@ -49,7 +49,7 @@ uniform float blurNormalTol; void sample( float2 uv, float weight, float4 centerTap, inout int usedCount, inout float occlusion, inout float total ) { //return; - float4 tap = TORQUE_PREPASS_UNCONDITION( prepassMap, uv ); + float4 tap = TORQUE_PREPASS_UNCONDITION( deferredMap, uv ); if ( abs( tap.a - centerTap.a ) < blurDepthTol ) { @@ -65,7 +65,7 @@ void sample( float2 uv, float weight, float4 centerTap, inout int usedCount, ino float4 main( VertToPix IN ) : TORQUE_TARGET0 { //float4 centerTap; - float4 centerTap = TORQUE_PREPASS_UNCONDITION( prepassMap, IN.uv0.zw ); + float4 centerTap = TORQUE_PREPASS_UNCONDITION( deferredMap, IN.uv0.zw ); //return centerTap; diff --git a/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl b/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl index cb3ee2fe4..66aa3e8d3 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl @@ -26,7 +26,7 @@ #define DOSMALL #define DOLARGE -TORQUE_UNIFORM_SAMPLER2D(prepassMap,0); +TORQUE_UNIFORM_SAMPLER2D(deferredMap,0); TORQUE_UNIFORM_SAMPLER2D(randNormalTex,1); TORQUE_UNIFORM_SAMPLER1D(powTable,2); @@ -143,9 +143,9 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float3 reflectNormal = normalize( TORQUE_TEX2DLOD( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 ); //return float4( reflectNormal, 1 ); - float4 prepass = TORQUE_PREPASS_UNCONDITION( prepassMap, IN.uv0 ); - float3 normal = prepass.xyz; - float depth = prepass.a; + float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredMap, IN.uv0 ); + float3 normal = deferred.xyz; + float depth = deferred.a; //return float4( ( depth ).xxx, 1 ); // Early out if too far away. @@ -197,7 +197,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 se = ep + ray; - occluderFragment = TORQUE_PREPASS_UNCONDITION( prepassMap, se.xy ); + occluderFragment = TORQUE_PREPASS_UNCONDITION( deferredMap, se.xy ); depthDiff = se.z - occluderFragment.a; @@ -246,7 +246,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 se = ep + ray; - occluderFragment = TORQUE_PREPASS_UNCONDITION( prepassMap, se.xy ); + occluderFragment = TORQUE_PREPASS_UNCONDITION( deferredMap, se.xy ); depthDiff = se.z - occluderFragment.a; diff --git a/Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl b/Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl index f0de9396f..cae920af8 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl @@ -42,7 +42,7 @@ in vec2 uv7; #define IN_uv7 uv7 uniform sampler2D occludeMap ; -uniform sampler2D prepassMap ; +uniform sampler2D deferredMap ; uniform float blurDepthTol; uniform float blurNormalTol; @@ -51,7 +51,7 @@ out vec4 OUT_col; void _sample( vec2 uv, float weight, vec4 centerTap, inout int usedCount, inout float occlusion, inout float total ) { //return; - vec4 tap = prepassUncondition( prepassMap, uv ); + vec4 tap = deferredUncondition( deferredMap, uv ); if ( abs( tap.a - centerTap.a ) < blurDepthTol ) { @@ -67,7 +67,7 @@ void _sample( vec2 uv, float weight, vec4 centerTap, inout int usedCount, inout void main() { //vec4 centerTap; - vec4 centerTap = prepassUncondition( prepassMap, IN_uv0.zw ); + vec4 centerTap = deferredUncondition( deferredMap, IN_uv0.zw ); //return centerTap; diff --git a/Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_P.glsl b/Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_P.glsl index 7ee6a412a..cfff88381 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_P.glsl +++ b/Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_P.glsl @@ -27,7 +27,7 @@ #define DOSMALL #define DOLARGE -uniform sampler2D prepassMap ; +uniform sampler2D deferredMap ; uniform sampler2D randNormalTex ; uniform sampler1D powTable ; @@ -146,9 +146,9 @@ void main() vec3 reflectNormal = normalize( tex2Dlod( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 ); //return vec4( reflectNormal, 1 ); - vec4 prepass = prepassUncondition( prepassMap, IN_uv0 ); - vec3 normal = prepass.xyz; - float depth = prepass.a; + vec4 deferred = deferredUncondition( deferredMap, IN_uv0 ); + vec3 normal = deferred.xyz; + float depth = deferred.a; //return vec4( ( depth ).xxx, 1 ); // Early out if too far away. @@ -203,7 +203,7 @@ void main() se = ep + ray; - occluderFragment = prepassUncondition( prepassMap, se.xy ); + occluderFragment = deferredUncondition( deferredMap, se.xy ); depthDiff = se.z - occluderFragment.a; @@ -252,7 +252,7 @@ void main() se = ep + ray; - occluderFragment = prepassUncondition( prepassMap, se.xy ); + occluderFragment = deferredUncondition( deferredMap, se.xy ); depthDiff = se.z - occluderFragment.a; diff --git a/Templates/BaseGame/game/core/shaders/postFX/underwaterFogP.hlsl b/Templates/BaseGame/game/core/shaders/postFX/underwaterFogP.hlsl index 80a8c4c77..b7d126f54 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/underwaterFogP.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/underwaterFogP.hlsl @@ -37,7 +37,7 @@ // Uniforms //----------------------------------------------------------------------------- -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); TORQUE_UNIFORM_SAMPLER2D(backbuffer, 1); TORQUE_UNIFORM_SAMPLER1D(waterDepthGradMap, 2); @@ -53,9 +53,9 @@ uniform float4 rtParams0; float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 { - //float2 prepassCoord = IN.uv0; + //float2 deferredCoord = IN.uv0; //IN.uv0 = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; - float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; + float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w; //return float4( depth.rrr, 1 ); // Skip fogging the extreme far plane so that diff --git a/Templates/BaseGame/game/core/shaders/shaderModelAutoGen.hlsl b/Templates/BaseGame/game/core/shaders/shaderModelAutoGen.hlsl index 4f2d8803f..33531cbf6 100644 --- a/Templates/BaseGame/game/core/shaders/shaderModelAutoGen.hlsl +++ b/Templates/BaseGame/game/core/shaders/shaderModelAutoGen.hlsl @@ -27,9 +27,9 @@ // Portability helpers for autogenConditioners #if (TORQUE_SM >= 10 && TORQUE_SM <=30) - #define TORQUE_PREPASS_UNCONDITION(tex, coords) prepassUncondition(tex, coords) + #define TORQUE_PREPASS_UNCONDITION(tex, coords) deferredUncondition(tex, coords) #elif TORQUE_SM >= 40 - #define TORQUE_PREPASS_UNCONDITION(tex, coords) prepassUncondition(tex, texture_##tex, coords) + #define TORQUE_PREPASS_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords) #endif #endif //_TORQUE_SHADERMODEL_AUTOGEN_ diff --git a/Templates/BaseGame/game/core/shaders/water/gl/waterBasicP.glsl b/Templates/BaseGame/game/core/shaders/water/gl/waterBasicP.glsl index 1d5a07c3f..9ece76b72 100644 --- a/Templates/BaseGame/game/core/shaders/water/gl/waterBasicP.glsl +++ b/Templates/BaseGame/game/core/shaders/water/gl/waterBasicP.glsl @@ -94,7 +94,7 @@ float fresnel(float NdotV, float bias, float power) // Uniforms //----------------------------------------------------------------------------- uniform sampler2D bumpMap; -//uniform sampler2D prepassTex; +//uniform sampler2D deferredTex; uniform sampler2D reflectMap; uniform sampler2D refractBuff; uniform samplerCube skyMap; diff --git a/Templates/BaseGame/game/core/shaders/water/gl/waterP.glsl b/Templates/BaseGame/game/core/shaders/water/gl/waterP.glsl index 5f722282c..512eebda9 100644 --- a/Templates/BaseGame/game/core/shaders/water/gl/waterP.glsl +++ b/Templates/BaseGame/game/core/shaders/water/gl/waterP.glsl @@ -116,7 +116,7 @@ float fresnel(float NdotV, float bias, float power) // Uniforms //----------------------------------------------------------------------------- uniform sampler2D bumpMap; -uniform sampler2D prepassTex; +uniform sampler2D deferredTex; uniform sampler2D reflectMap; uniform sampler2D refractBuff; uniform samplerCube skyMap; @@ -165,9 +165,9 @@ void main() // Convert from WorldSpace to EyeSpace. float pixelDepth = PIXEL_DIST / farPlaneDist; - vec2 prepassCoord = viewportCoordToRenderTarget( IN_posPostWave, rtParams1 ); + vec2 deferredCoord = viewportCoordToRenderTarget( IN_posPostWave, rtParams1 ); - float startDepth = prepassUncondition( prepassTex, prepassCoord ).w; + float startDepth = deferredUncondition( deferredTex, deferredCoord ).w; // The water depth in world units of the undistorted pixel. float startDelta = ( startDepth - pixelDepth ); @@ -189,14 +189,14 @@ void main() vec4 distortPos = IN_posPostWave; distortPos.xy += distortDelta; - prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); - // Get prepass depth at the position of this distorted pixel. - float prepassDepth = prepassUncondition( prepassTex, prepassCoord ).w; - if ( prepassDepth > 0.99 ) - prepassDepth = 5.0; + // Get deferred depth at the position of this distorted pixel. + float deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; - float delta = ( prepassDepth - pixelDepth ) * farPlaneDist; + float delta = ( deferredDepth - pixelDepth ) * farPlaneDist; if ( delta < 0.0 ) { @@ -209,7 +209,7 @@ void main() } else { - float diff = ( prepassDepth - startDepth ) * farPlaneDist; + float diff = ( deferredDepth - startDepth ) * farPlaneDist; if ( diff < 0 ) { @@ -221,13 +221,13 @@ void main() distortPos = IN_posPostWave; distortPos.xy += distortDelta; - prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); - // Get prepass depth at the position of this distorted pixel. - prepassDepth = prepassUncondition( prepassTex, prepassCoord ).w; - if ( prepassDepth > 0.99 ) - prepassDepth = 5.0; - delta = ( prepassDepth - pixelDepth ) * farPlaneDist; + // Get deferred depth at the position of this distorted pixel. + deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + delta = ( deferredDepth - pixelDepth ) * farPlaneDist; } if ( delta < 0.1 ) diff --git a/Templates/BaseGame/game/core/shaders/water/waterBasicP.hlsl b/Templates/BaseGame/game/core/shaders/water/waterBasicP.hlsl index efb437779..f34a4e551 100644 --- a/Templates/BaseGame/game/core/shaders/water/waterBasicP.hlsl +++ b/Templates/BaseGame/game/core/shaders/water/waterBasicP.hlsl @@ -93,7 +93,7 @@ float fresnel(float NdotV, float bias, float power) // Uniforms //----------------------------------------------------------------------------- TORQUE_UNIFORM_SAMPLER2D(bumpMap,0); -//uniform sampler2D prepassTex : register( S1 ); +//uniform sampler2D deferredTex : register( S1 ); TORQUE_UNIFORM_SAMPLER2D(reflectMap,2); TORQUE_UNIFORM_SAMPLER2D(refractBuff,3); TORQUE_UNIFORM_SAMPLERCUBE(skyMap,4); diff --git a/Templates/BaseGame/game/core/shaders/water/waterP.hlsl b/Templates/BaseGame/game/core/shaders/water/waterP.hlsl index d50c0b51c..25820d403 100644 --- a/Templates/BaseGame/game/core/shaders/water/waterP.hlsl +++ b/Templates/BaseGame/game/core/shaders/water/waterP.hlsl @@ -106,7 +106,7 @@ float fresnel(float NdotV, float bias, float power) // Uniforms //----------------------------------------------------------------------------- TORQUE_UNIFORM_SAMPLER2D(bumpMap,0); -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); TORQUE_UNIFORM_SAMPLER2D(reflectMap, 2); TORQUE_UNIFORM_SAMPLER2D(refractBuff, 3); TORQUE_UNIFORM_SAMPLERCUBE(skyMap, 4); @@ -153,9 +153,9 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0 // Convert from WorldSpace to EyeSpace. float pixelDepth = PIXEL_DIST / farPlaneDist; - float2 prepassCoord = viewportCoordToRenderTarget( IN.posPostWave, rtParams1 ); + float2 deferredCoord = viewportCoordToRenderTarget( IN.posPostWave, rtParams1 ); - float startDepth = TORQUE_PREPASS_UNCONDITION( prepassTex, prepassCoord ).w; + float startDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w; // The water depth in world units of the undistorted pixel. float startDelta = ( startDepth - pixelDepth ); @@ -177,14 +177,14 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0 float4 distortPos = IN.posPostWave; distortPos.xy += distortDelta; - prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); - // Get prepass depth at the position of this distorted pixel. - float prepassDepth = TORQUE_PREPASS_UNCONDITION( prepassTex, prepassCoord ).w; - if ( prepassDepth > 0.99 ) - prepassDepth = 5.0; + // Get deferred depth at the position of this distorted pixel. + float deferredDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; - float delta = ( prepassDepth - pixelDepth ) * farPlaneDist; + float delta = ( deferredDepth - pixelDepth ) * farPlaneDist; if ( delta < 0.0 ) { @@ -197,7 +197,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0 } else { - float diff = ( prepassDepth - startDepth ) * farPlaneDist; + float diff = ( deferredDepth - startDepth ) * farPlaneDist; if ( diff < 0 ) { @@ -209,13 +209,13 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0 distortPos = IN.posPostWave; distortPos.xy += distortDelta; - prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); - // Get prepass depth at the position of this distorted pixel. - prepassDepth = TORQUE_PREPASS_UNCONDITION( prepassTex, prepassCoord ).w; - if ( prepassDepth > 0.99 ) - prepassDepth = 5.0; - delta = ( prepassDepth - pixelDepth ) * farPlaneDist; + // Get deferred depth at the position of this distorted pixel. + deferredDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + delta = ( deferredDepth - pixelDepth ) * farPlaneDist; } if ( delta < 0.1 ) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs index aaa46200e..905b826c6 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs @@ -119,7 +119,7 @@ new GFXStateBlockData( AL_DefaultVisualizeState ) zWriteEnable = false; samplersDefined = true; - samplerStates[0] = SamplerClampPoint; // #prepass + samplerStates[0] = SamplerClampPoint; // #deferred samplerStates[1] = SamplerClampLinear; // depthviz }; @@ -131,7 +131,7 @@ new ShaderData( AL_DepthVisualizeShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = "./shaders/dbgDepthVisualizeP.glsl"; - samplerNames[0] = "prepassTex"; + samplerNames[0] = "deferredTex"; samplerNames[1] = "depthViz"; pixVersion = 2.0; @@ -141,7 +141,7 @@ singleton PostEffect( AL_DepthVisualize ) { shader = AL_DepthVisualizeShader; stateBlock = AL_DefaultVisualizeState; - texture[0] = "#prepass"; + texture[0] = "#deferred"; texture[1] = "tools/worldEditor/images/depthviz"; target = "$backBuffer"; renderPriority = 9999; @@ -188,7 +188,7 @@ new ShaderData( AL_NormalsVisualizeShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = "./shaders/dbgNormalVisualizeP.glsl"; - samplerNames[0] = "prepassTex"; + samplerNames[0] = "deferredTex"; pixVersion = 2.0; }; @@ -197,7 +197,7 @@ singleton PostEffect( AL_NormalsVisualize ) { shader = AL_NormalsVisualizeShader; stateBlock = AL_DefaultVisualizeState; - texture[0] = "#prepass"; + texture[0] = "#deferred"; target = "$backBuffer"; renderPriority = 9999; }; @@ -224,7 +224,7 @@ new ShaderData( AL_LightColorVisualizeShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = "./shaders/dbgLightColorVisualizeP.glsl"; - samplerNames[0] = "lightPrePassTex"; + samplerNames[0] = "lightDeferredTex"; pixVersion = 2.0; }; @@ -259,7 +259,7 @@ new ShaderData( AL_LightSpecularVisualizeShader ) OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLPixelShaderFile = "./shaders/dbgLightSpecularVisualizeP.glsl"; - samplerNames[0] = "lightPrePassTex"; + samplerNames[0] = "lightDeferredTex"; pixVersion = 2.0; }; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgDepthVisualizeP.glsl b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgDepthVisualizeP.glsl index 31aa60ef4..8ada46462 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgDepthVisualizeP.glsl +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgDepthVisualizeP.glsl @@ -24,13 +24,13 @@ #include "shadergen:/autogenConditioners.h" in vec2 uv0; -uniform sampler2D prepassTex; +uniform sampler2D deferredTex; uniform sampler1D depthViz; out vec4 OUT_col; void main() { - float depth = prepassUncondition( prepassTex, uv0 ).w; + float depth = deferredUncondition( deferredTex, uv0 ).w; OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgDepthVisualizeP.hlsl b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgDepthVisualizeP.hlsl index 2f1be62b2..e554c4445 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgDepthVisualizeP.hlsl +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgDepthVisualizeP.hlsl @@ -23,11 +23,11 @@ #include "core/shaders/postfx/postFx.hlsl" #include "core/shaders/shaderModelAutoGen.hlsl" -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); TORQUE_UNIFORM_SAMPLER1D(depthViz, 1); float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 { - float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; + float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w; return float4( TORQUE_TEX1D( depthViz, depth ).rgb, 1.0 ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightColorVisualizeP.glsl b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightColorVisualizeP.glsl index 0b375b646..86fb67268 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightColorVisualizeP.glsl +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightColorVisualizeP.glsl @@ -23,12 +23,12 @@ #include "core/shaders/gl/hlslCompat.glsl" in vec2 uv0; -uniform sampler2D lightPrePassTex; +uniform sampler2D lightDeferredTex; out vec4 OUT_col; void main() { - vec4 lightColor = texture( lightPrePassTex, uv0 ); + vec4 lightColor = texture( lightDeferredTex, uv0 ); OUT_col = vec4( lightColor.rgb, 1.0 ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightColorVisualizeP.hlsl b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightColorVisualizeP.hlsl index 7d66e2e69..38e5832f5 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightColorVisualizeP.hlsl +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightColorVisualizeP.hlsl @@ -23,10 +23,10 @@ #include "core/shaders/shaderModelAutoGen.hlsl" #include "core/shaders/postfx/postFx.hlsl" -TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,0); +TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0); float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 { - float4 lightColor = TORQUE_TEX2D( lightPrePassTex, IN.uv0 ); + float4 lightColor = TORQUE_TEX2D( lightDeferredTex, IN.uv0 ); return float4( lightColor.rgb, 1.0 ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightSpecularVisualizeP.glsl b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightSpecularVisualizeP.glsl index 679c18e16..e8a037d2b 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightSpecularVisualizeP.glsl +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightSpecularVisualizeP.glsl @@ -23,12 +23,12 @@ #include "core/shaders/gl/hlslCompat.glsl" in vec2 uv0; -uniform sampler2D lightPrePassTex; +uniform sampler2D lightDeferredTex; out vec4 OUT_col; void main() { - float specular = texture( lightPrePassTex, uv0 ).a; + float specular = texture( lightDeferredTex, uv0 ).a; OUT_col = vec4( specular, specular, specular, 1.0 ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightSpecularVisualizeP.hlsl b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightSpecularVisualizeP.hlsl index ed5c268d4..66424a11f 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightSpecularVisualizeP.hlsl +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgLightSpecularVisualizeP.hlsl @@ -22,10 +22,10 @@ #include "core/shaders/postfx/postFx.hlsl" -TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,0); +TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0); float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 { - float specular = TORQUE_TEX2D( lightPrePassTex, IN.uv0 ).a; + float specular = TORQUE_TEX2D( lightDeferredTex, IN.uv0 ).a; return float4( specular, specular, specular, 1.0 ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgNormalVisualizeP.glsl b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgNormalVisualizeP.glsl index 2292e3538..ab3323360 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgNormalVisualizeP.glsl +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgNormalVisualizeP.glsl @@ -24,12 +24,12 @@ #include "shadergen:/autogenConditioners.h" in vec2 uv0; -uniform sampler2D prepassTex; +uniform sampler2D deferredTex; out vec4 OUT_col; void main() { - vec3 normal = prepassUncondition( prepassTex, uv0 ).xyz; + vec3 normal = deferredUncondition( deferredTex, uv0 ).xyz; OUT_col = vec4( ( normal + 1.0 ) * 0.5, 1.0 ); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgNormalVisualizeP.hlsl b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgNormalVisualizeP.hlsl index daacee307..b4443514c 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgNormalVisualizeP.hlsl +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/shaders/dbgNormalVisualizeP.hlsl @@ -23,10 +23,10 @@ #include "core/shaders/postfx/postFx.hlsl" #include "core/shaders/shaderModelAutoGen.hlsl" -TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 { - float3 normal = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).xyz; + float3 normal = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).xyz; return float4( ( normal + 1.0 ) * 0.5, 1.0 ); } \ No newline at end of file From c0906e1c414c36e1b2a02df59a1d4d6febeb3c7a Mon Sep 17 00:00:00 2001 From: Chris Millsap Date: Tue, 11 Apr 2017 14:51:29 -0400 Subject: [PATCH 3/5] Possible fix to issue #1951 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Code formated to be submitted for pull request) -- Indentation was off. SAME FIX AS BEFORE When two instances of Torque3D are running on the same network, one as a hosted server and the other as a client, the client is unable to connect to the server. The program now can open a socket. This was obviously a typo. To find the error I just searched for keywords containing socket, open, open socket, and opensocket till I found the correct file. The other error was in how the program processed “non fatal” errors. I just outputed the error to the main console and devised that the socket should not be closed for a WSAEWOULDBLOCK error 10035 "It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established." Read about the WouldBlock error: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx Use of dbgSetParameters ( port , password ): http://docs.garagegames.com/tge/official/content/documentation/Reference/Console%20Functions/TorqueScript_Console_Functions_2.html#dbgSetParameters_.28_port_.2C_password_.29 --- Engine/source/platform/platformNet.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index f2464b9bc..3ab659d50 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -809,7 +809,7 @@ NetSocket Net::openConnectTo(const char *addressString) error = Net::WrongProtocolType; } - if (error != NoError || error == NeedHostLookup) + if (error == NoError || error == NeedHostLookup) // Open socket { handleFd = openSocket(); } @@ -826,10 +826,15 @@ NetSocket Net::openConnectTo(const char *addressString) if (::connect(socketFd, (struct sockaddr *)&ipAddr, sizeof(ipAddr)) == -1 && errno != EINPROGRESS) { - Con::errorf("Error connecting %s: %s", - addressString, strerror(errno)); - closeSocket(handleFd); - handleFd = NetSocket::INVALID; + error = PlatformNetState::getLastError(); // Output this error if not 10035 then close + + if (error != Net::WouldBlock) // Resource temporarily unavailable. + { + Con::errorf("Error connecting %s: %s", + addressString, strerror(errno)); + closeSocket(handleFd); + handleFd = NetSocket::INVALID; + } } } else From f421a50e5aa77e96f4b707f01e061913390470ac Mon Sep 17 00:00:00 2001 From: Chris Millsap Date: Wed, 12 Apr 2017 18:54:59 -0400 Subject: [PATCH 4/5] Comment formatting Removed incorrect comments to be more inline with windows and linux. Put comment on line 812 on top of code. --- Engine/source/platform/platformNet.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 3ab659d50..2114633ca 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -809,7 +809,8 @@ NetSocket Net::openConnectTo(const char *addressString) error = Net::WrongProtocolType; } - if (error == NoError || error == NeedHostLookup) // Open socket + // Open socket + if (error == NoError || error == NeedHostLookup) { handleFd = openSocket(); } @@ -826,9 +827,9 @@ NetSocket Net::openConnectTo(const char *addressString) if (::connect(socketFd, (struct sockaddr *)&ipAddr, sizeof(ipAddr)) == -1 && errno != EINPROGRESS) { - error = PlatformNetState::getLastError(); // Output this error if not 10035 then close + error = PlatformNetState::getLastError(); - if (error != Net::WouldBlock) // Resource temporarily unavailable. + if (error != Net::WouldBlock) { Con::errorf("Error connecting %s: %s", addressString, strerror(errno)); From d6fd1a49ca07479d83d1e1fd08ef2816fe008522 Mon Sep 17 00:00:00 2001 From: klaus95 Date: Mon, 17 Apr 2017 15:46:44 -0700 Subject: [PATCH 5/5] Fix for bug #1738 getTrailingNumber("string") and stripTrailingNumber("string") will now work for single letter cases. For example, getTrailingNumber() will return "11" if the input is "a11" or "t11", and stripTrailingNumber() will return "a" if the input is "a11". --- Engine/source/core/util/str.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/core/util/str.cpp b/Engine/source/core/util/str.cpp index cc124a45d..816e1391a 100644 --- a/Engine/source/core/util/str.cpp +++ b/Engine/source/core/util/str.cpp @@ -1620,7 +1620,7 @@ String String::GetTrailingNumber(const char* str, S32& number) if ((*p == '-') || (*p == '_')) number = -dAtoi(p + 1); else - number = ((p == base.c_str()) ? dAtoi(p) : dAtoi(++p)); + number = (isdigit(*p) && (p == base.c_str()) ? dAtoi(p) : dAtoi(++p)); // Remove space between the name and the number while ((p > base.c_str()) && dIsspace(*(p-1)))