mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
few more features seem to cause conflicts
move clearing of the map out of flushproceduralshaders, this function is now empty, not sure if this is going to cause issues elsewhere but what was happening was postfx manager was setting the hdr format after the level had been loaded, the materials for a few objects were being setup but then the shadergen process would execute on them again and it would clear the cache and cause double ups
This commit is contained in:
parent
4ceeb07ea0
commit
dc2a9ed2e5
3 changed files with 21 additions and 22 deletions
|
|
@ -180,8 +180,6 @@ public:
|
||||||
|
|
||||||
void processPix( Vector<ShaderComponent*> &componentList,
|
void processPix( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd ) override;
|
const MaterialFeatureData &fd ) override;
|
||||||
|
|
||||||
U32 getShaderStages() override { return GFXShaderStage::PIXEL_SHADER; }
|
|
||||||
|
|
||||||
U32 getOutputTargets( const MaterialFeatureData &fd ) const override { return mOutputTargetMask; }
|
U32 getOutputTargets( const MaterialFeatureData &fd ) const override { return mOutputTargetMask; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include "gfx/gfxDevice.h"
|
#include "gfx/gfxDevice.h"
|
||||||
#include "core/memVolume.h"
|
#include "core/memVolume.h"
|
||||||
#include "core/module.h"
|
#include "core/module.h"
|
||||||
|
#include "console/persistenceManager.h"
|
||||||
|
|
||||||
#ifdef TORQUE_D3D11
|
#ifdef TORQUE_D3D11
|
||||||
#include "shaderGen/HLSL/customFeatureHLSL.h"
|
#include "shaderGen/HLSL/customFeatureHLSL.h"
|
||||||
|
|
@ -95,6 +96,14 @@ ShaderGen::~ShaderGen()
|
||||||
_uninit();
|
_uninit();
|
||||||
|
|
||||||
mFileCache.clear();
|
mFileCache.clear();
|
||||||
|
|
||||||
|
for (ShaderDataMap::Pair data : mProcShaderData)
|
||||||
|
{
|
||||||
|
if (data.value->isProperlyAdded() && !data.value->isDeleted())
|
||||||
|
data.value->unregisterObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
mProcShaderData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderGen::registerInitDelegate(GFXAdapterType adapterType, ShaderGenInitDelegate& initDelegate)
|
void ShaderGen::registerInitDelegate(GFXAdapterType adapterType, ShaderGenInitDelegate& initDelegate)
|
||||||
|
|
@ -272,14 +281,20 @@ void ShaderGen::generateShader( const MaterialFeatureData& featureData,
|
||||||
case VERTEX_SHADER:
|
case VERTEX_SHADER:
|
||||||
_processVertFeatures(macros, skipRegen);
|
_processVertFeatures(macros, skipRegen);
|
||||||
if (skipRegen)
|
if (skipRegen)
|
||||||
|
{
|
||||||
|
LangElement::deleteElements();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
_printVertShader(*stream);
|
_printVertShader(*stream);
|
||||||
((ShaderConnector*)mComponents[C_CONNECTOR])->reset();
|
((ShaderConnector*)mComponents[C_CONNECTOR])->reset();
|
||||||
break;
|
break;
|
||||||
case PIXEL_SHADER:
|
case PIXEL_SHADER:
|
||||||
_processPixFeatures(macros, skipRegen);
|
_processPixFeatures(macros, skipRegen);
|
||||||
if (skipRegen)
|
if (skipRegen)
|
||||||
|
{
|
||||||
|
LangElement::deleteElements();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
_printPixShader(*stream);
|
_printPixShader(*stream);
|
||||||
break;
|
break;
|
||||||
case GEOMETRY_SHADER:
|
case GEOMETRY_SHADER:
|
||||||
|
|
@ -568,14 +583,14 @@ GFXShader* ShaderGen::getShader(const MaterialFeatureData& featureData, const GF
|
||||||
|
|
||||||
String cacheKey = Torque::getStringHash64(shaderDescription);
|
String cacheKey = Torque::getStringHash64(shaderDescription);
|
||||||
|
|
||||||
|
Vector<GFXShaderMacro> shaderMacros;
|
||||||
|
shaderMacros.push_back(GFXShaderMacro("TORQUE_SHADERGEN"));
|
||||||
|
if (macros)
|
||||||
|
shaderMacros.merge(*macros);
|
||||||
|
|
||||||
ShaderDataMap::iterator dat = mProcShaderData.find(cacheKey);
|
ShaderDataMap::iterator dat = mProcShaderData.find(cacheKey);
|
||||||
if (dat != mProcShaderData.end())
|
if (dat != mProcShaderData.end())
|
||||||
{
|
{
|
||||||
Vector<GFXShaderMacro> shaderMacros;
|
|
||||||
shaderMacros.push_back(GFXShaderMacro("TORQUE_SHADERGEN"));
|
|
||||||
if (macros)
|
|
||||||
shaderMacros.merge(*macros);
|
|
||||||
|
|
||||||
// should we loop vertex shader features to build mInstancingFormat before sending it down to see old hob?
|
// should we loop vertex shader features to build mInstancingFormat before sending it down to see old hob?
|
||||||
return dat->value->getShader(shaderMacros);
|
return dat->value->getShader(shaderMacros);
|
||||||
}
|
}
|
||||||
|
|
@ -589,26 +604,15 @@ GFXShader* ShaderGen::getShader(const MaterialFeatureData& featureData, const GF
|
||||||
shaderData->setSamplerName(samplers[samp], samp);
|
shaderData->setSamplerName(samplers[samp], samp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<GFXShaderMacro> shaderMacros;
|
|
||||||
shaderMacros.push_back(GFXShaderMacro("TORQUE_SHADERGEN"));
|
|
||||||
if (macros)
|
|
||||||
shaderMacros.merge(*macros);
|
|
||||||
|
|
||||||
generateShader(featureData, shaderData, vertexFormat, cacheKey, shaderMacros);
|
generateShader(featureData, shaderData, vertexFormat, cacheKey, shaderMacros);
|
||||||
|
|
||||||
shaderData->setInstancingFormat(&mInstancingFormat);
|
shaderData->setInstancingFormat(&mInstancingFormat);
|
||||||
shaderData->registerObject();
|
|
||||||
|
|
||||||
mProcShaderData[cacheKey] = shaderData;
|
mProcShaderData.insert(cacheKey, shaderData);
|
||||||
return shaderData->getShader(shaderMacros);
|
return shaderData->getShader(shaderMacros);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderGen::flushProceduralShaders()
|
void ShaderGen::flushProceduralShaders()
|
||||||
{
|
{
|
||||||
for (auto data : mProcShaderData)
|
|
||||||
{
|
|
||||||
data.value->deleteObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
mProcShaderData.clear();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,8 +153,6 @@ public:
|
||||||
|
|
||||||
void processPix( Vector<ShaderComponent*> &componentList,
|
void processPix( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd ) override;
|
const MaterialFeatureData &fd ) override;
|
||||||
|
|
||||||
U32 getShaderStages() override { return GFXShaderStage::PIXEL_SHADER; }
|
|
||||||
|
|
||||||
Resources getResources( const MaterialFeatureData &fd ) override;
|
Resources getResources( const MaterialFeatureData &fd ) override;
|
||||||
|
|
||||||
|
|
@ -184,7 +182,6 @@ public:
|
||||||
void processPix(Vector<ShaderComponent*> &componentList,
|
void processPix(Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd) override;
|
const MaterialFeatureData &fd) override;
|
||||||
String getName() override { return "Blank Matinfo map"; }
|
String getName() override { return "Blank Matinfo map"; }
|
||||||
U32 getShaderStages() override { return GFXShaderStage::PIXEL_SHADER; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TerrainHeightMapBlendHLSL : public TerrainFeatHLSL
|
class TerrainHeightMapBlendHLSL : public TerrainFeatHLSL
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue