mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Reworks the $Core::commonShaderPath variable usage to be a static variable in ShaderGen for efficiency(only one getVariable when shadergen is initialized), as well as implements the ability to set a default value, and ensures that it tries to set a path even if the pref variable is missing which is important for ported projects from older builds.
This commit is contained in:
parent
f2b86b7df3
commit
8c807485b1
17 changed files with 65 additions and 55 deletions
|
|
@ -37,6 +37,7 @@
|
|||
#include "windowManager/platformWindow.h"
|
||||
#include "gfx/D3D11/screenshotD3D11.h"
|
||||
#include "materials/shaderData.h"
|
||||
#include "shaderGen/shaderGen.h"
|
||||
|
||||
#ifdef TORQUE_DEBUG
|
||||
#include "d3d11sdklayers.h"
|
||||
|
|
@ -838,8 +839,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
|
|||
//shader model 4.0 is enough for the generic shaders
|
||||
const char* shaderModel = "4.0";
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorV.hlsl"));
|
||||
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorP.hlsl"));
|
||||
shaderData->setField("DXVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/colorV.hlsl"));
|
||||
shaderData->setField("DXPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/colorP.hlsl"));
|
||||
shaderData->setField("pixVersion", shaderModel);
|
||||
shaderData->registerObject();
|
||||
mGenericShader[GSColor] = shaderData->getShader();
|
||||
|
|
@ -848,8 +849,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureV.hlsl"));
|
||||
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureP.hlsl"));
|
||||
shaderData->setField("DXVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/modColorTextureV.hlsl"));
|
||||
shaderData->setField("DXPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/modColorTextureP.hlsl"));
|
||||
shaderData->setField("pixVersion", shaderModel);
|
||||
shaderData->registerObject();
|
||||
mGenericShader[GSModColorTexture] = shaderData->getShader();
|
||||
|
|
@ -858,8 +859,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureV.hlsl"));
|
||||
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureP.hlsl"));
|
||||
shaderData->setField("DXVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/addColorTextureV.hlsl"));
|
||||
shaderData->setField("DXPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/addColorTextureP.hlsl"));
|
||||
shaderData->setField("pixVersion", shaderModel);
|
||||
shaderData->registerObject();
|
||||
mGenericShader[GSAddColorTexture] = shaderData->getShader();
|
||||
|
|
@ -868,8 +869,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureV.hlsl"));
|
||||
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureP.hlsl"));
|
||||
shaderData->setField("DXVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/textureV.hlsl"));
|
||||
shaderData->setField("DXPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/textureP.hlsl"));
|
||||
shaderData->setField("pixVersion", shaderModel);
|
||||
shaderData->registerObject();
|
||||
mGenericShader[GSTexture] = shaderData->getShader();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "gfx/gl/gfxGLStateCache.h"
|
||||
#include "gfx/gl/gfxGLVertexAttribLocation.h"
|
||||
#include "gfx/gl/gfxGLVertexDecl.h"
|
||||
#include "shaderGen/shaderGen.h"
|
||||
|
||||
GFXAdapter::CreateDeviceInstanceDelegate GFXGLDevice::mCreateDeviceInstance(GFXGLDevice::createInstance);
|
||||
|
||||
|
|
@ -781,8 +782,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
ShaderData *shaderData;
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorP.glsl"));
|
||||
shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/colorV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/colorP.glsl"));
|
||||
shaderData->setField("pixVersion", "2.0");
|
||||
shaderData->registerObject();
|
||||
mGenericShader[GSColor] = shaderData->getShader();
|
||||
|
|
@ -791,8 +792,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureP.glsl"));
|
||||
shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/modColorTextureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/modColorTextureP.glsl"));
|
||||
shaderData->setSamplerName("$diffuseMap", 0);
|
||||
shaderData->setField("pixVersion", "2.0");
|
||||
shaderData->registerObject();
|
||||
|
|
@ -802,8 +803,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureP.glsl"));
|
||||
shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/addColorTextureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/addColorTextureP.glsl"));
|
||||
shaderData->setSamplerName("$diffuseMap", 0);
|
||||
shaderData->setField("pixVersion", "2.0");
|
||||
shaderData->registerObject();
|
||||
|
|
@ -813,8 +814,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureP.glsl"));
|
||||
shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/textureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/textureP.glsl"));
|
||||
shaderData->setSamplerName("$diffuseMap", 0);
|
||||
shaderData->setField("pixVersion", "2.0");
|
||||
shaderData->registerObject();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue