Sync upstream changes to shiny

deque
scrawl 11 years ago
parent 44b517f66d
commit c5a9cd0aa1

@ -1,13 +1,16 @@
#if SH_HLSL == 1 || SH_CG == 1
#define shTexture2D sampler2D
#define shTexture3D sampler3D
#define shSample(tex, coord) tex2D(tex, coord)
#define shCubicSample(tex, coord) texCUBE(tex, coord)
#define shLerp(a, b, t) lerp(a, b, t)
#define shSaturate(a) saturate(a)
#define shSampler2D(name) , uniform sampler2D name : register(s@shCounter(0)) @shUseSampler(name)
#define shSampler3D(name) , uniform sampler3D name : register(s@shCounter(0)) @shUseSampler(name)
#define shSamplerCube(name) , uniform samplerCUBE name : register(s@shCounter(0)) @shUseSampler(name)
#define shMatrixMult(m, v) mul(m, v)
@ -67,6 +70,7 @@
#define int3 ivec3
#define int4 ivec4
#define shTexture2D sampler2D
#define shTexture3D sampler3D
#define shSample(tex, coord) texture2D(tex, coord)
#define shCubicSample(tex, coord) textureCube(tex, coord)
#define shLerp(a, b, t) mix(a, b, t)
@ -76,6 +80,8 @@
#define shSampler2D(name) uniform sampler2D name; @shUseSampler(name)
#define shSampler3D(name) uniform sampler3D name; @shUseSampler(name)
#define shSamplerCube(name) uniform samplerCube name; @shUseSampler(name)
#define shMatrixMult(m, v) (m * v)

@ -278,14 +278,15 @@ namespace sh
MaterialMap::iterator it = mMaterials.find(name);
if (it != mMaterials.end())
return &(it->second);
else
else
return NULL;
}
MaterialInstance* Factory::findInstance (const std::string& name)
{
assert (mMaterials.find(name) != mMaterials.end());
return &mMaterials.find(name)->second;
MaterialInstance* m = searchInstance(name);
assert (m);
return m;
}
MaterialInstance* Factory::requestMaterial (const std::string& name, const std::string& configuration, unsigned short lodIndex)
@ -297,27 +298,24 @@ namespace sh
if (m)
{
// make sure all lod techniques below (higher lod) exist
int i = lodIndex;
while (i>0)
if (m->createForConfiguration (configuration, 0))
{
if (mListener)
mListener->materialCreated (m, configuration, 0);
}
else
return NULL;
for (LodConfigurationMap::iterator it = mLodConfigurations.begin(); it != mLodConfigurations.end(); ++it)
{
--i;
if (m->createForConfiguration (configuration, i))
if (m->createForConfiguration (configuration, it->first))
{
if (mListener)
mListener->materialCreated (m, configuration, i);
mListener->materialCreated (m, configuration, it->first);
}
else
return NULL;
}
if (m->createForConfiguration (configuration, lodIndex))
{
if (mListener)
mListener->materialCreated (m, configuration, lodIndex);
}
else
return NULL;
}
return m;
}
@ -625,8 +623,14 @@ namespace sh
{
MaterialInstance* m = searchInstance (name);
assert(m);
m->createForConfiguration (configuration, 0);
}
for (LodConfigurationMap::iterator it = mLodConfigurations.begin(); it != mLodConfigurations.end(); ++it)
{
m->createForConfiguration (configuration, it->first);
}
}
bool Factory::removeCache(const std::string& pattern)
{

@ -259,8 +259,8 @@ namespace sh
Platform* mPlatform;
MaterialInstance* findInstance (const std::string& name);
private:
MaterialInstance* searchInstance (const std::string& name);
/// @return was anything removed?
bool removeCache (const std::string& pattern);

@ -163,7 +163,8 @@ namespace sh
mTexUnits.push_back(texUnit);
// set texture unit indices (required by GLSL)
if (useShaders && ((hasVertex && foundVertex) || (hasFragment && foundFragment)) && (mFactory->getCurrentLanguage () == Language_GLSL || mFactory->getCurrentLanguage() == Language_GLSLES))
if (useShaders && ((hasVertex && foundVertex) || (hasFragment && foundFragment)) && (mFactory->getCurrentLanguage () == Language_GLSL
|| mFactory->getCurrentLanguage() == Language_GLSLES))
{
pass->setTextureUnitIndex (foundVertex ? GPT_Vertex : GPT_Fragment, texIt->getName(), i);

@ -9,8 +9,7 @@
/*
Almost exact copy of load_file_to_string policy found in
boost::wave headers with the only change that it uses
boost::filesystem facility to handle UTF-8 paths used
throughout OpenMW (bfs::fstream, bfs::path).
boost::filesystem facility to handle UTF-8 paths properly on windows.
Original namespace is used due to required bost::wave
internal symbols.

@ -1,8 +1,6 @@
#ifndef SH_PREPROCESSOR_H
#define SH_PREPROCESSOR_H
#include <stdint.h>
#include <string>
#include <vector>

@ -151,7 +151,7 @@ namespace sh
else if (typeid(*value) == typeid(IntValue))
type = Ogre::GCT_INT1;
else
throw std::runtime_error("unexpected type");
throw std::runtime_error("unexpected type");
params->addConstantDefinition(name, type);
mSharedParameters[name] = params;
}

Loading…
Cancel
Save