Commit 5597eef8 by Nicolas Capens

Rename the GLSL shader compiler namespace to glsl.

Bug 18962347 Change-Id: I28d001045cf43eed2d92cb0007330dffa620025b Reviewed-on: https://swiftshader-review.googlesource.com/1760Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 68754bf1
......@@ -20,7 +20,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
namespace sh
namespace glsl
{
// Integer to TString conversion
TString str(int i)
......@@ -2074,7 +2074,7 @@ namespace sh
}
}
activeVaryings.push_back(sh::Varying(glVariableType(type), name, varying->getArraySize(), reg, 0));
activeVaryings.push_back(glsl::Varying(glVariableType(type), name, varying->getArraySize(), reg, 0));
}
}
......
......@@ -29,7 +29,7 @@ namespace es2
class Shader;
}
namespace sh
namespace glsl
{
struct Uniform
{
......
......@@ -13,14 +13,14 @@
#include "InitializeParseContext.h"
TranslatorASM::TranslatorASM(sh::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject)
TranslatorASM::TranslatorASM(glsl::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject)
{
}
bool TranslatorASM::translate(TIntermNode* root)
{
TParseContext& parseContext = *GetGlobalParseContext();
sh::OutputASM outputASM(parseContext, shaderObject);
glsl::OutputASM outputASM(parseContext, shaderObject);
outputASM.output();
......
......@@ -15,7 +15,7 @@
#include "ShHandle.h"
#include "OutputASM.h"
namespace sh
namespace glsl
{
class Shader;
}
......@@ -23,13 +23,13 @@ namespace sh
class TranslatorASM : public TCompiler
{
public:
TranslatorASM(sh::Shader *shaderObject, ShShaderType type, ShShaderSpec spec);
TranslatorASM(glsl::Shader *shaderObject, ShShaderType type, ShShaderSpec spec);
protected:
virtual bool translate(TIntermNode* root);
private:
sh::Shader *const shaderObject;
glsl::Shader *const shaderObject;
};
#endif // COMPILER_TRANSLATORASM_H_
......@@ -940,9 +940,9 @@ namespace es2
// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
// Returns the number of used varying registers, or -1 if unsuccesful
int Program::packVaryings(const sh::Varying *packing[][4])
int Program::packVaryings(const glsl::Varying *packing[][4])
{
for(sh::VaryingList::iterator varying = fragmentShader->varyings.begin(); varying != fragmentShader->varyings.end(); varying++)
for(glsl::VaryingList::iterator varying = fragmentShader->varyings.begin(); varying != fragmentShader->varyings.end(); varying++)
{
int n = VariableRowCount(varying->type) * varying->size();
int m = VariableColumnCount(varying->type);
......@@ -1087,11 +1087,11 @@ namespace es2
bool Program::linkVaryings()
{
for(sh::VaryingList::iterator input = fragmentShader->varyings.begin(); input != fragmentShader->varyings.end(); input++)
for(glsl::VaryingList::iterator input = fragmentShader->varyings.begin(); input != fragmentShader->varyings.end(); input++)
{
bool matched = false;
for(sh::VaryingList::iterator output = vertexShader->varyings.begin(); output != vertexShader->varyings.end(); output++)
for(glsl::VaryingList::iterator output = vertexShader->varyings.begin(); output != vertexShader->varyings.end(); output++)
{
if(output->name == input->name)
{
......@@ -1115,12 +1115,12 @@ namespace es2
}
}
sh::VaryingList &psVaryings = fragmentShader->varyings;
sh::VaryingList &vsVaryings = vertexShader->varyings;
glsl::VaryingList &psVaryings = fragmentShader->varyings;
glsl::VaryingList &vsVaryings = vertexShader->varyings;
for(sh::VaryingList::iterator output = vsVaryings.begin(); output != vsVaryings.end(); output++)
for(glsl::VaryingList::iterator output = vsVaryings.begin(); output != vsVaryings.end(); output++)
{
for(sh::VaryingList::iterator input = psVaryings.begin(); input != psVaryings.end(); input++)
for(glsl::VaryingList::iterator input = psVaryings.begin(); input != psVaryings.end(); input++)
{
if(output->name == input->name)
{
......@@ -1221,7 +1221,7 @@ namespace es2
unsigned int usedLocations = 0;
// Link attributes that have a binding location
for(sh::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
{
int location = getAttributeBinding(attribute->name);
......@@ -1250,7 +1250,7 @@ namespace es2
}
// Link attributes that don't have a binding location
for(sh::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
{
int location = getAttributeBinding(attribute->name);
......@@ -1298,11 +1298,11 @@ namespace es2
bool Program::linkUniforms(Shader *shader)
{
const sh::ActiveUniforms &activeUniforms = shader->activeUniforms;
const glsl::ActiveUniforms &activeUniforms = shader->activeUniforms;
for(unsigned int uniformIndex = 0; uniformIndex < activeUniforms.size(); uniformIndex++)
{
const sh::Uniform &uniform = activeUniforms[uniformIndex];
const glsl::Uniform &uniform = activeUniforms[uniformIndex];
if(!defineUniform(shader->getType(), uniform.type, uniform.precision, uniform.name, uniform.arraySize, uniform.registerIndex))
{
......
......@@ -133,7 +133,7 @@ namespace es2
private:
void unlink();
int packVaryings(const sh::Varying *packing[][4]);
int packVaryings(const glsl::Varying *packing[][4]);
bool linkVaryings();
bool linkAttributes();
......@@ -171,7 +171,7 @@ namespace es2
sw::VertexShader *vertexBinary;
std::set<std::string> attributeBinding[MAX_VERTEX_ATTRIBS];
sh::Attribute linkedAttribute[MAX_VERTEX_ATTRIBS];
glsl::Attribute linkedAttribute[MAX_VERTEX_ATTRIBS];
int attributeStream[MAX_VERTEX_ATTRIBS];
struct Sampler
......
......@@ -269,7 +269,7 @@ GLenum Shader::parseType(const std::string &type)
}
// true if varying x has a higher priority in packing than y
bool Shader::compareVarying(const sh::Varying &x, const sh::Varying &y)
bool Shader::compareVarying(const glsl::Varying &x, const glsl::Varying &y)
{
if(x.type == y.type)
{
......@@ -415,7 +415,7 @@ int VertexShader::getSemanticIndex(const std::string &attributeName)
{
if(!attributeName.empty())
{
for(sh::ActiveAttributes::iterator attribute = activeAttributes.begin(); attribute != activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = activeAttributes.begin(); attribute != activeAttributes.end(); attribute++)
{
if(attribute->name == attributeName)
{
......
......@@ -27,7 +27,7 @@
#include <list>
#include <vector>
namespace sh
namespace glsl
{
class OutputASM;
}
......@@ -35,7 +35,7 @@ namespace sh
namespace es2
{
class Shader : public sh::Shader
class Shader : public glsl::Shader
{
friend class Program;
......@@ -71,7 +71,7 @@ protected:
void clear();
static GLenum parseType(const std::string &type);
static bool compareVarying(const sh::Varying &x, const sh::Varying &y);
static bool compareVarying(const glsl::Varying &x, const glsl::Varying &y);
char *mSource;
char *mInfoLog;
......
......@@ -940,9 +940,9 @@ namespace es2
// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
// Returns the number of used varying registers, or -1 if unsuccesful
int Program::packVaryings(const sh::Varying *packing[][4])
int Program::packVaryings(const glsl::Varying *packing[][4])
{
for(sh::VaryingList::iterator varying = fragmentShader->varyings.begin(); varying != fragmentShader->varyings.end(); varying++)
for(glsl::VaryingList::iterator varying = fragmentShader->varyings.begin(); varying != fragmentShader->varyings.end(); varying++)
{
int n = VariableRowCount(varying->type) * varying->size();
int m = VariableColumnCount(varying->type);
......@@ -1087,11 +1087,11 @@ namespace es2
bool Program::linkVaryings()
{
for(sh::VaryingList::iterator input = fragmentShader->varyings.begin(); input != fragmentShader->varyings.end(); input++)
for(glsl::VaryingList::iterator input = fragmentShader->varyings.begin(); input != fragmentShader->varyings.end(); input++)
{
bool matched = false;
for(sh::VaryingList::iterator output = vertexShader->varyings.begin(); output != vertexShader->varyings.end(); output++)
for(glsl::VaryingList::iterator output = vertexShader->varyings.begin(); output != vertexShader->varyings.end(); output++)
{
if(output->name == input->name)
{
......@@ -1115,12 +1115,12 @@ namespace es2
}
}
sh::VaryingList &psVaryings = fragmentShader->varyings;
sh::VaryingList &vsVaryings = vertexShader->varyings;
glsl::VaryingList &psVaryings = fragmentShader->varyings;
glsl::VaryingList &vsVaryings = vertexShader->varyings;
for(sh::VaryingList::iterator output = vsVaryings.begin(); output != vsVaryings.end(); output++)
for(glsl::VaryingList::iterator output = vsVaryings.begin(); output != vsVaryings.end(); output++)
{
for(sh::VaryingList::iterator input = psVaryings.begin(); input != psVaryings.end(); input++)
for(glsl::VaryingList::iterator input = psVaryings.begin(); input != psVaryings.end(); input++)
{
if(output->name == input->name)
{
......@@ -1221,7 +1221,7 @@ namespace es2
unsigned int usedLocations = 0;
// Link attributes that have a binding location
for(sh::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
{
int location = getAttributeBinding(attribute->name);
......@@ -1250,7 +1250,7 @@ namespace es2
}
// Link attributes that don't have a binding location
for(sh::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
{
int location = getAttributeBinding(attribute->name);
......@@ -1298,11 +1298,11 @@ namespace es2
bool Program::linkUniforms(Shader *shader)
{
const sh::ActiveUniforms &activeUniforms = shader->activeUniforms;
const glsl::ActiveUniforms &activeUniforms = shader->activeUniforms;
for(unsigned int uniformIndex = 0; uniformIndex < activeUniforms.size(); uniformIndex++)
{
const sh::Uniform &uniform = activeUniforms[uniformIndex];
const glsl::Uniform &uniform = activeUniforms[uniformIndex];
if(!defineUniform(shader->getType(), uniform.type, uniform.precision, uniform.name, uniform.arraySize, uniform.registerIndex))
{
......
......@@ -133,7 +133,7 @@ namespace es2
private:
void unlink();
int packVaryings(const sh::Varying *packing[][4]);
int packVaryings(const glsl::Varying *packing[][4]);
bool linkVaryings();
bool linkAttributes();
......@@ -171,7 +171,7 @@ namespace es2
sw::VertexShader *vertexBinary;
std::set<std::string> attributeBinding[MAX_VERTEX_ATTRIBS];
sh::Attribute linkedAttribute[MAX_VERTEX_ATTRIBS];
glsl::Attribute linkedAttribute[MAX_VERTEX_ATTRIBS];
int attributeStream[MAX_VERTEX_ATTRIBS];
struct Sampler
......
......@@ -269,7 +269,7 @@ GLenum Shader::parseType(const std::string &type)
}
// true if varying x has a higher priority in packing than y
bool Shader::compareVarying(const sh::Varying &x, const sh::Varying &y)
bool Shader::compareVarying(const glsl::Varying &x, const glsl::Varying &y)
{
if(x.type == y.type)
{
......@@ -415,7 +415,7 @@ int VertexShader::getSemanticIndex(const std::string &attributeName)
{
if(!attributeName.empty())
{
for(sh::ActiveAttributes::iterator attribute = activeAttributes.begin(); attribute != activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = activeAttributes.begin(); attribute != activeAttributes.end(); attribute++)
{
if(attribute->name == attributeName)
{
......
......@@ -27,7 +27,7 @@
#include <list>
#include <vector>
namespace sh
namespace glsl
{
class OutputASM;
}
......@@ -35,7 +35,7 @@ namespace sh
namespace es2
{
class Shader : public sh::Shader
class Shader : public glsl::Shader
{
friend class Program;
......@@ -71,7 +71,7 @@ protected:
void clear();
static GLenum parseType(const std::string &type);
static bool compareVarying(const sh::Varying &x, const sh::Varying &y);
static bool compareVarying(const glsl::Varying &x, const glsl::Varying &y);
char *mSource;
char *mInfoLog;
......
......@@ -940,9 +940,9 @@ namespace es2
// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
// Returns the number of used varying registers, or -1 if unsuccesful
int Program::packVaryings(const sh::Varying *packing[][4])
int Program::packVaryings(const glsl::Varying *packing[][4])
{
for(sh::VaryingList::iterator varying = fragmentShader->varyings.begin(); varying != fragmentShader->varyings.end(); varying++)
for(glsl::VaryingList::iterator varying = fragmentShader->varyings.begin(); varying != fragmentShader->varyings.end(); varying++)
{
int n = VariableRowCount(varying->type) * varying->size();
int m = VariableColumnCount(varying->type);
......@@ -1087,11 +1087,11 @@ namespace es2
bool Program::linkVaryings()
{
for(sh::VaryingList::iterator input = fragmentShader->varyings.begin(); input != fragmentShader->varyings.end(); input++)
for(glsl::VaryingList::iterator input = fragmentShader->varyings.begin(); input != fragmentShader->varyings.end(); input++)
{
bool matched = false;
for(sh::VaryingList::iterator output = vertexShader->varyings.begin(); output != vertexShader->varyings.end(); output++)
for(glsl::VaryingList::iterator output = vertexShader->varyings.begin(); output != vertexShader->varyings.end(); output++)
{
if(output->name == input->name)
{
......@@ -1115,12 +1115,12 @@ namespace es2
}
}
sh::VaryingList &psVaryings = fragmentShader->varyings;
sh::VaryingList &vsVaryings = vertexShader->varyings;
glsl::VaryingList &psVaryings = fragmentShader->varyings;
glsl::VaryingList &vsVaryings = vertexShader->varyings;
for(sh::VaryingList::iterator output = vsVaryings.begin(); output != vsVaryings.end(); output++)
for(glsl::VaryingList::iterator output = vsVaryings.begin(); output != vsVaryings.end(); output++)
{
for(sh::VaryingList::iterator input = psVaryings.begin(); input != psVaryings.end(); input++)
for(glsl::VaryingList::iterator input = psVaryings.begin(); input != psVaryings.end(); input++)
{
if(output->name == input->name)
{
......@@ -1221,7 +1221,7 @@ namespace es2
unsigned int usedLocations = 0;
// Link attributes that have a binding location
for(sh::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
{
int location = getAttributeBinding(attribute->name);
......@@ -1250,7 +1250,7 @@ namespace es2
}
// Link attributes that don't have a binding location
for(sh::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = vertexShader->activeAttributes.begin(); attribute != vertexShader->activeAttributes.end(); attribute++)
{
int location = getAttributeBinding(attribute->name);
......@@ -1298,11 +1298,11 @@ namespace es2
bool Program::linkUniforms(Shader *shader)
{
const sh::ActiveUniforms &activeUniforms = shader->activeUniforms;
const glsl::ActiveUniforms &activeUniforms = shader->activeUniforms;
for(unsigned int uniformIndex = 0; uniformIndex < activeUniforms.size(); uniformIndex++)
{
const sh::Uniform &uniform = activeUniforms[uniformIndex];
const glsl::Uniform &uniform = activeUniforms[uniformIndex];
if(!defineUniform(shader->getType(), uniform.type, uniform.precision, uniform.name, uniform.arraySize, uniform.registerIndex))
{
......
......@@ -142,7 +142,7 @@ namespace es2
private:
void unlink();
int packVaryings(const sh::Varying *packing[][4]);
int packVaryings(const glsl::Varying *packing[][4]);
bool linkVaryings();
bool linkAttributes();
......@@ -180,7 +180,7 @@ namespace es2
sw::VertexShader *vertexBinary;
std::set<std::string> attributeBinding[MAX_VERTEX_ATTRIBS];
sh::Attribute linkedAttribute[MAX_VERTEX_ATTRIBS];
glsl::Attribute linkedAttribute[MAX_VERTEX_ATTRIBS];
int attributeStream[MAX_VERTEX_ATTRIBS];
struct Sampler
......
......@@ -269,7 +269,7 @@ GLenum Shader::parseType(const std::string &type)
}
// true if varying x has a higher priority in packing than y
bool Shader::compareVarying(const sh::Varying &x, const sh::Varying &y)
bool Shader::compareVarying(const glsl::Varying &x, const glsl::Varying &y)
{
if(x.type == y.type)
{
......@@ -415,7 +415,7 @@ int VertexShader::getSemanticIndex(const std::string &attributeName)
{
if(!attributeName.empty())
{
for(sh::ActiveAttributes::iterator attribute = activeAttributes.begin(); attribute != activeAttributes.end(); attribute++)
for(glsl::ActiveAttributes::iterator attribute = activeAttributes.begin(); attribute != activeAttributes.end(); attribute++)
{
if(attribute->name == attributeName)
{
......
......@@ -25,7 +25,7 @@
#include <list>
#include <vector>
namespace sh
namespace glsl
{
class OutputASM;
}
......@@ -33,7 +33,7 @@ namespace sh
namespace es2
{
class Shader : public sh::Shader
class Shader : public glsl::Shader
{
friend class Program;
......@@ -69,7 +69,7 @@ protected:
void clear();
static GLenum parseType(const std::string &type);
static bool compareVarying(const sh::Varying &x, const sh::Varying &y);
static bool compareVarying(const glsl::Varying &x, const glsl::Varying &y);
char *mSource;
char *mInfoLog;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment