Commit dff6d00a by Maxime Grégoire

Revert "LibGL shader modification, LibGL texture1D and textureRectangle added"

Change-Id: Ie564566cbaa9ea5e87f1417aa2d84faa6b10a89f Reviewed-on: https://swiftshader-review.googlesource.com/3719Reviewed-by: 's avatarMaxime Grégoire <mgregoire@google.com> Tested-by: 's avatarMaxime Grégoire <mgregoire@google.com>
parent df041005
......@@ -129,21 +129,10 @@ enum TQualifier : unsigned char
EvqInOut,
EvqConstReadOnly,
// built-ins read by fragment shader
EvqMultiTexCoord0,
EvqMultiTexCoord1,
EvqMultiTexCoord2,
EvqMultiTexCoord3,
EvqMultiTexCoord4,
EvqMultiTexCoord5,
EvqMultiTexCoord6,
EvqMultiTexCoord7,
// built-ins written by vertex shader
EvqPosition,
EvqPointSize,
EvqInstanceID,
EvqTexCoords,
// built-ins read by fragment shader
EvqFragCoord,
......@@ -213,15 +202,6 @@ inline const char *getQualifierString(TQualifier qualifier)
case EvqPointSize: return "PointSize"; break;
case EvqInstanceID: return "InstanceID"; break;
case EvqFragCoord: return "FragCoord"; break;
case EvqMultiTexCoord0: return "MultiTexCoord0"; break;
case EvqMultiTexCoord1: return "MultiTexCoord1"; break;
case EvqMultiTexCoord2: return "MultiTexCoord2"; break;
case EvqMultiTexCoord3: return "MultiTexCoord3"; break;
case EvqMultiTexCoord4: return "MultiTexCoord4"; break;
case EvqMultiTexCoord5: return "MultiTexCoord5"; break;
case EvqMultiTexCoord6: return "MultiTexCoord6"; break;
case EvqMultiTexCoord7: return "MultiTexCoord7"; break;
case EvqTexCoords: return "TexCoords"; break;
case EvqFrontFacing: return "FrontFacing"; break;
case EvqFragColor: return "FragColor"; break;
case EvqFragData: return "FragData"; break;
......
......@@ -15,22 +15,22 @@
namespace
{
class TScopedPoolAllocator {
public:
class TScopedPoolAllocator {
public:
TScopedPoolAllocator(TPoolAllocator* allocator, bool pushPop)
: mAllocator(allocator), mPushPopAllocator(pushPop) {
if(mPushPopAllocator) mAllocator->push();
if (mPushPopAllocator) mAllocator->push();
SetGlobalPoolAllocator(mAllocator);
}
~TScopedPoolAllocator() {
SetGlobalPoolAllocator(NULL);
if(mPushPopAllocator) mAllocator->pop();
if (mPushPopAllocator) mAllocator->pop();
}
private:
private:
TPoolAllocator* mAllocator;
bool mPushPopAllocator;
};
};
} // namespace
//
......@@ -45,7 +45,6 @@ ShBuiltInResources::ShBuiltInResources()
MaxVertexTextureImageUnits = 0;
MaxCombinedTextureImageUnits = 8;
MaxTextureImageUnits = 8;
MaxTextureCoords = 8;
MaxFragmentUniformVectors = 16;
MaxDrawBuffers = 1;
MaxVertexOutputVectors = 16;
......@@ -82,7 +81,7 @@ bool TCompiler::Init(const ShBuiltInResources& resources)
TScopedPoolAllocator scopedAlloc(&allocator, false);
// Generate built-in symbol table.
if(!InitBuiltInSymbolTable(resources))
if (!InitBuiltInSymbolTable(resources))
return false;
InitExtensionBehavior(resources, extensionBehavior);
......@@ -96,13 +95,13 @@ bool TCompiler::compile(const char* const shaderStrings[],
TScopedPoolAllocator scopedAlloc(&allocator, true);
clearResults();
if(numStrings == 0)
if (numStrings == 0)
return true;
// First string is path of source file if flag is set. The actual source follows.
const char* sourcePath = NULL;
int firstSource = 0;
if(compileOptions & SH_SOURCE_PATH)
if (compileOptions & SH_SOURCE_PATH)
{
sourcePath = shaderStrings[0];
++firstSource;
......@@ -110,14 +109,14 @@ bool TCompiler::compile(const char* const shaderStrings[],
TIntermediate intermediate(infoSink);
TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
shaderType, compileOptions, false,
shaderType, compileOptions, true,
sourcePath, infoSink);
SetGlobalParseContext(&parseContext);
// We preserve symbols at the built-in level from compile-to-compile.
// Start pushing the user-defined symbols at global level.
symbolTable.push();
if(!symbolTable.atGlobalLevel())
if (!symbolTable.atGlobalLevel())
infoSink.info.message(EPrefixInternalError, "Wrong symbol table level");
// Parse shader.
......@@ -127,26 +126,26 @@ bool TCompiler::compile(const char* const shaderStrings[],
shaderVersion = parseContext.getShaderVersion();
if(success) {
if (success) {
TIntermNode* root = parseContext.treeRoot;
success = intermediate.postProcess(root);
if(success)
if (success)
success = validateCallDepth(root, infoSink);
if(success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
success = validateLimitations(root);
if(success && (compileOptions & SH_INTERMEDIATE_TREE))
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
intermediate.outputTree(root);
if(success && (compileOptions & SH_OBJECT_CODE))
if (success && (compileOptions & SH_OBJECT_CODE))
success = translate(root);
}
// Ensure symbol table is returned to the built-in level,
// throwing away all but the built-ins.
while(!symbolTable.atBuiltInLevel())
while (!symbolTable.atBuiltInLevel())
symbolTable.pop();
return success;
......@@ -175,7 +174,6 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
{
case GL_FRAGMENT_SHADER:
symbolTable.setDefaultPrecision(integer, EbpMedium);
symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
break;
case GL_VERTEX_SHADER:
symbolTable.setDefaultPrecision(integer, EbpHigh);
......
......@@ -37,7 +37,6 @@ struct ShBuiltInResources
int MaxVertexTextureImageUnits;
int MaxCombinedTextureImageUnits;
int MaxTextureImageUnits;
int MaxTextureCoords;
int MaxFragmentUniformVectors;
int MaxDrawBuffers;
int MaxVertexOutputVectors;
......
......@@ -123,7 +123,6 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFaceForward, genType, "faceforward", genType, genType, genType);
symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpReflect, genType, "reflect", genType, genType);
symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRefract, genType, "refract", genType, genType, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFtransform, float4, "ftransform", 0);
TType *mat2 = new TType(EbtFloat, 2, 2);
TType *mat2x3 = new TType(EbtFloat, 2, 3);
......@@ -244,7 +243,7 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
{
symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdx, "GL_OES_standard_derivatives", genType, "dFdx", genType);
symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdy, "GL_OES_standard_derivatives", genType, "dFdy", genType);
symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpFwidth, "GL_OES_standard_derivatives", genType, "fwidth", genType);
symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpFwidth,"GL_OES_standard_derivatives", genType, "fwidth", genType);
}
}
......@@ -294,9 +293,9 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
// Depth range in window coordinates
//
TTypeList *members = NewPoolTTypeList();
TTypeLine near = { new TType(EbtFloat, EbpHigh, EvqGlobal, 1), 0 };
TTypeLine far = { new TType(EbtFloat, EbpHigh, EvqGlobal, 1), 0 };
TTypeLine diff = { new TType(EbtFloat, EbpHigh, EvqGlobal, 1), 0 };
TTypeLine near = {new TType(EbtFloat, EbpHigh, EvqGlobal, 1), 0};
TTypeLine far = {new TType(EbtFloat, EbpHigh, EvqGlobal, 1), 0};
TTypeLine diff = {new TType(EbtFloat, EbpHigh, EvqGlobal, 1), 0};
near.type->setFieldName("near");
far.type->setFieldName("far");
diff.type->setFieldName("diff");
......@@ -318,7 +317,6 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits", resources.MaxTextureImageUnits);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors);
symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxTextureCoords", resources.MaxTextureCoords);
symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors);
symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers);
symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxVertexOutputVectors", resources.MaxVertexOutputVectors);
......@@ -345,26 +343,13 @@ void IdentifyBuiltIns(GLenum shaderType,
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
break;
case GL_VERTEX_SHADER:
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_MultiTexCoord0"), TType(EbtFloat, EbpMedium, EvqMultiTexCoord0, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_MultiTexCoord1"), TType(EbtFloat, EbpMedium, EvqMultiTexCoord1, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_MultiTexCoord2"), TType(EbtFloat, EbpMedium, EvqMultiTexCoord2, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_MultiTexCoord3"), TType(EbtFloat, EbpMedium, EvqMultiTexCoord3, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_MultiTexCoord4"), TType(EbtFloat, EbpMedium, EvqMultiTexCoord4, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_MultiTexCoord5"), TType(EbtFloat, EbpMedium, EvqMultiTexCoord5, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_MultiTexCoord6"), TType(EbtFloat, EbpMedium, EvqMultiTexCoord6, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_MultiTexCoord7"), TType(EbtFloat, EbpMedium, EvqMultiTexCoord7, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpMedium, EvqPosition, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
symbolTable.insert(ESSL3_BUILTINS, *new TVariable(NewPoolTString("gl_InstanceID"), TType(EbtInt, EbpHigh, EvqInstanceID, 1)));
break;
default: assert(false && "Language not supported");
}
// Set up gl_TexCoord
TType texCoord(EbtFloat, EbpMedium, EvqTexCoords, 4, 1, true);
texCoord.setArraySize(resources.MaxTextureCoords);
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_TexCoord"), texCoord));
// Finally add resource-specific variables.
switch(shaderType)
{
......@@ -376,7 +361,6 @@ void IdentifyBuiltIns(GLenum shaderType,
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData"), fragData));
}
break;
case GL_VERTEX_SHADER: break;
default: break;
}
}
......
......@@ -652,12 +652,6 @@ namespace glsl
case EOpFwidth: if(visit == PostVisit) emit(sw::Shader::OPCODE_FWIDTH, result, arg); break;
case EOpAny: if(visit == PostVisit) emit(sw::Shader::OPCODE_ANY, result, arg); break;
case EOpAll: if(visit == PostVisit) emit(sw::Shader::OPCODE_ALL, result, arg); break;
case EOpFtransform:
if(visit == PostVisit)
{
emit(sw::Shader::OPCODE_NOP, result, arg);
}
break;
case EOpTranspose:
if(visit == PostVisit)
{
......@@ -1084,7 +1078,6 @@ namespace glsl
case EOpFaceForward: if(visit == PostVisit) emit(sw::Shader::OPCODE_FORWARD(dim(arg[0])), result, arg[0], arg[1], arg[2]); break;
case EOpReflect: if(visit == PostVisit) emit(sw::Shader::OPCODE_REFLECT(dim(arg[0])), result, arg[0], arg[1]); break;
case EOpRefract: if(visit == PostVisit) emit(sw::Shader::OPCODE_REFRACT(dim(arg[0])), result, arg[0], arg[1], arg[2]); break;
case EOpFtransform: break;
case EOpMul:
if(visit == PostVisit)
{
......@@ -1877,15 +1870,6 @@ namespace glsl
case EvqFragCoord: return sw::Shader::PARAMETER_MISCTYPE;
case EvqFrontFacing: return sw::Shader::PARAMETER_MISCTYPE;
case EvqPointCoord: return sw::Shader::PARAMETER_INPUT;
case EvqMultiTexCoord0: return sw::Shader::PARAMETER_INPUT;
case EvqMultiTexCoord1: return sw::Shader::PARAMETER_INPUT;
case EvqMultiTexCoord2: return sw::Shader::PARAMETER_INPUT;
case EvqMultiTexCoord3: return sw::Shader::PARAMETER_INPUT;
case EvqMultiTexCoord4: return sw::Shader::PARAMETER_INPUT;
case EvqMultiTexCoord5: return sw::Shader::PARAMETER_INPUT;
case EvqMultiTexCoord6: return sw::Shader::PARAMETER_INPUT;
case EvqMultiTexCoord7: return sw::Shader::PARAMETER_INPUT;
case EvqTexCoords: return sw::Shader::PARAMETER_TEXTURE;
case EvqFragColor: return sw::Shader::PARAMETER_COLOROUT;
case EvqFragData: return sw::Shader::PARAMETER_COLOROUT;
default: UNREACHABLE();
......@@ -1919,15 +1903,6 @@ namespace glsl
case EvqPosition: return varyingRegister(operand);
case EvqPointSize: return varyingRegister(operand);
case EvqInstanceID: vertexShader->instanceIdDeclared = true; return 0;
case EvqMultiTexCoord0: return 0; //UNIMPLEMENTED();
case EvqMultiTexCoord1: return 0; //UNIMPLEMENTED();
case EvqMultiTexCoord2: return 0; //UNIMPLEMENTED();
case EvqMultiTexCoord3: return 0; //UNIMPLEMENTED();
case EvqMultiTexCoord4: return 0; //UNIMPLEMENTED();
case EvqMultiTexCoord5: return 0; //UNIMPLEMENTED();
case EvqMultiTexCoord6: return 0; //UNIMPLEMENTED();
case EvqMultiTexCoord7: return 0; //UNIMPLEMENTED();
case EvqTexCoords: return 0;
case EvqFragCoord: pixelShader->vPosDeclared = true; return 0;
case EvqFrontFacing: pixelShader->vFaceDeclared = true; return 1;
case EvqPointCoord: return varyingRegister(operand);
......
......@@ -320,14 +320,6 @@ bool TParseContext::lValueErrorCheck(int line, const char* op, TIntermTyped* nod
case EvqCentroidIn:
case EvqVaryingIn: message = "can't modify a varying"; break;
case EvqInput: message = "can't modify an input"; break;
case EvqMultiTexCoord0: message = "can't modify gl_MultiTexCoord0"; break;
case EvqMultiTexCoord1: message = "can't modify gl_MultiTexCoord1"; break;
case EvqMultiTexCoord2: message = "can't modify gl_MultiTexCoord2"; break;
case EvqMultiTexCoord3: message = "can't modify gl_MultiTexCoord3"; break;
case EvqMultiTexCoord4: message = "can't modify gl_MultiTexCoord4"; break;
case EvqMultiTexCoord5: message = "can't modify gl_MultiTexCoord5"; break;
case EvqMultiTexCoord6: message = "can't modify gl_MultiTexCoord6"; break;
case EvqMultiTexCoord7: message = "can't modify gl_MultiTexCoord7"; break;
case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
case EvqFrontFacing: message = "can't modify gl_FrontFacing"; break;
case EvqPointCoord: message = "can't modify gl_PointCoord"; break;
......
......@@ -346,28 +346,28 @@ public:
void insertBuiltIn(ESymbolLevel level, TOperator op, const char *ext, TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0)
{
if(ptype1 && ptype1->getBasicType() == EbtGSampler2D)
if(ptype1->getBasicType() == EbtGSampler2D)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2D), ptype2, ptype3, ptype4);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2D), ptype2, ptype3, ptype4);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2D), ptype2, ptype3, ptype4);
}
else if(ptype1 && ptype1->getBasicType() == EbtGSampler3D)
else if(ptype1->getBasicType() == EbtGSampler3D)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler3D), ptype2, ptype3, ptype4);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler3D), ptype2, ptype3, ptype4);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler3D), ptype2, ptype3, ptype4);
}
else if(ptype1 && ptype1->getBasicType() == EbtGSamplerCube)
else if(ptype1->getBasicType() == EbtGSamplerCube)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSamplerCube), ptype2, ptype3, ptype4);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISamplerCube), ptype2, ptype3, ptype4);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSamplerCube), ptype2, ptype3, ptype4);
}
else if(ptype1 && ptype1->getBasicType() == EbtGSampler2DArray)
else if(ptype1->getBasicType() == EbtGSampler2DArray)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2DArray), ptype2, ptype3, ptype4);
......@@ -393,11 +393,8 @@ public:
{
TFunction *function = new TFunction(NewPoolTString(name), *rvalue, op, ext);
if(ptype1)
{
TParameter param1 = { 0, ptype1 };
TParameter param1 = {0, ptype1};
function->addParameter(param1);
}
if(ptype2)
{
......
......@@ -298,7 +298,6 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
case EOpFaceForward: out << "face-forward"; break;
case EOpReflect: out << "reflect"; break;
case EOpRefract: out << "refract"; break;
case EOpFtransform: out << "ftransform"; break;
case EOpMul: out << "component-wise multiply"; break;
case EOpOuterProduct: out << "outer product"; break;
......
......@@ -155,7 +155,6 @@ enum TOperator {
EOpFaceForward,
EOpReflect,
EOpRefract,
EOpFtransform,
EOpDFdx, // Fragment only, OES_standard_derivatives extension
EOpDFdy, // Fragment only, OES_standard_derivatives extension
......
......@@ -31,7 +31,6 @@
#include <map>
#include <string>
#include <list>
#include <stack>
namespace gl
{
......@@ -294,7 +293,6 @@ class Shader;
class Program;
class Texture;
class Texture2D;
class Texture1D;
class TextureCubeMap;
class Framebuffer;
class Renderbuffer;
......@@ -311,15 +309,12 @@ class Query;
enum
{
MAX_TEXTURE_COORDS = 8,
MAX_CLIENT_ATTRIB_STACK_DEPTH = 16,
MAX_TEXTURE_STACK_DEPTH = 10,
MAX_VERTEX_ATTRIBS = 16,
MAX_VERTEX_ATTRIBS = 9,
MAX_UNIFORM_VECTORS = 256, // Device limit
MAX_VERTEX_UNIFORM_VECTORS = 256 - 3, // Reserve space for gl_DepthRange
MAX_VARYING_VECTORS = 10,
MAX_TEXTURE_IMAGE_UNITS = 16,
MAX_VERTEX_TEXTURE_IMAGE_UNITS = 4,
MAX_TEXTURE_IMAGE_UNITS = 2,
MAX_VERTEX_TEXTURE_IMAGE_UNITS = 1,
MAX_COMBINED_TEXTURE_IMAGE_UNITS = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS,
MAX_FRAGMENT_UNIFORM_VECTORS = 224 - 3, // Reserve space for gl_DepthRange
MAX_DRAW_BUFFERS = 1,
......@@ -495,29 +490,6 @@ struct State
GLint unpackAlignment;
GLint packAlignment;
bool unpackSwapBytes;
bool unpackLsbFirst;
GLint unpackRowLength;
GLint unpackSkipRows;
GLint unpackSkipPixels;
GLint unpackSkipImages;
GLint unpackImageHeight;
GLenum textureEnvMode;
};
struct ClientAttributes
{
GLint unpackAlignment;
GLint packAlignment;
bool unpackSwapBytes;
bool unpackLsbFirst;
GLint unpackRowLength;
GLint unpackSkipRows;
GLint unpackSkipPixels;
GLint unpackSkipImages;
GLint unpackImageHeight;
GLbitfield mask;
};
class Context
......@@ -611,20 +583,6 @@ public:
void setPackAlignment(GLint alignment);
GLint getPackAlignment() const;
void setUnpackSwapBytes(bool swapBytes);
bool getUnpackSwapBytes() const;
void setUnpackLsbFirst(bool length);
bool getUnpackLsbFirst() const;
void setUnpackRowLength(GLint length);
GLint getUnpackRowLength() const;
void setUnpackSkipRows(GLint skipRows);
GLint getUnpackSkipRows() const;
void setUnpackSkipPixels(GLint skipRows);
GLint getUnpackSkipPixels() const;
void setUnpackSkipImages(GLint skipImage);
GLint getUnpackSkipImages() const;
void setUnpackImageHeight(GLint imageHeight);
GLint getUnpackImageHeight() const;
// These create and destroy methods are merely pass-throughs to
// ResourceManager, which owns these object types
......@@ -654,7 +612,6 @@ public:
void bindArrayBuffer(GLuint buffer);
void bindElementArrayBuffer(GLuint buffer);
void bindTexture1D(GLuint texture);
void bindTexture2D(GLuint texture);
void bindTextureCubeMap(GLuint texture);
void bindReadFramebuffer(GLuint framebuffer);
......@@ -686,7 +643,6 @@ public:
Texture2D *getTexture2D(GLenum target);
TextureCubeMap *getTextureCubeMap();
Texture *getSamplerTexture(unsigned int sampler, TextureType type);
Texture1D *getTexture1D();
Framebuffer *getReadFramebuffer();
Framebuffer *getDrawFramebuffer();
......@@ -703,9 +659,6 @@ public:
void finish();
void flush();
void setTextureEnvMode(GLenum texEnvMode);
GLenum getTextureEnvMode();
void recordInvalidEnum();
void recordInvalidValue();
void recordInvalidOperation();
......@@ -732,9 +685,6 @@ public:
void frustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
void ortho(double left, double right, double bottom, double top, double zNear, double zFar); // FIXME: GLdouble
void pushClientAttrib(GLbitfield mask);
void popClientAttrib();
void setLighting(bool enabled);
void setFog(bool enabled);
void setAlphaTest(bool enabled);
......@@ -743,10 +693,6 @@ public:
void setShadeModel(GLenum mode);
void setLight(int index, bool enable);
void setNormalizeNormals(bool enable);
void setRectangleTextureEnable(bool enable);
bool getRectangleTextureEnable();
void set1DTextureEnable(bool enable);
bool get1DTextureEnable();
GLuint genLists(GLsizei range);
void newList(GLuint list, GLenum mode);
......@@ -756,7 +702,6 @@ public:
GLuint getListIndex() {return listIndex;}
GLenum getListMode() {return listMode;}
void listCommand(Command *command);
void shareDisplayListSpace(HGLRC hglrc);
void captureAttribs();
void captureDrawArrays(GLenum mode, GLint first, GLsizei count);
......@@ -797,7 +742,6 @@ private:
BindingPointer<Texture2D> mTexture2DZero;
BindingPointer<Texture2D> mProxyTexture2DZero;
BindingPointer<TextureCubeMap> mTextureCubeMapZero;
BindingPointer<Texture1D> mTexture1DZero;
typedef std::map<GLint, Framebuffer*> FramebufferMap;
FramebufferMap mFramebufferMap;
......@@ -845,16 +789,12 @@ private:
sw::MatrixStack projection;
sw::MatrixStack texture[8];
std::stack<ClientAttributes> *clientAttribStack;
GLenum listMode;
//std::map<GLuint, GLuint> listMap;
std::map<GLuint, DisplayList*> displayList;
DisplayList *list;
GLuint listIndex;
GLuint firstFreeIndex;
bool sharedList;
HGLRC sharedContextHandle;
GLenum clientTexture;
......
......@@ -157,9 +157,6 @@ namespace gl
setSpecularMaterialSource(sw::MATERIAL_MATERIAL);
setAmbientMaterialSource(sw::MATERIAL_COLOR1);
setEmissiveMaterialSource(sw::MATERIAL_MATERIAL);
rectangleTextureEnable = false;
oneDTextureEnable = false;
}
Device::~Device()
......@@ -444,26 +441,6 @@ namespace gl
scissorEnable = enable;
}
void Device::setRectangleTextureEnable(bool enable)
{
rectangleTextureEnable = enable;
}
bool Device::getRectangleTextureEnable()
{
return rectangleTextureEnable;
}
void Device::set1DTextureEnable(bool enable)
{
oneDTextureEnable = enable;
}
bool Device::get1DTextureEnable()
{
return oneDTextureEnable;
}
void Device::setRenderTarget(Image *renderTarget)
{
if(renderTarget)
......
......@@ -59,10 +59,6 @@ namespace gl
virtual void setPixelShader(sw::PixelShader *shader);
virtual void setPixelShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count);
virtual void setScissorEnable(bool enable);
virtual void setRectangleTextureEnable(bool enable);
virtual bool getRectangleTextureEnable();
virtual void set1DTextureEnable(bool enable);
virtual bool get1DTextureEnable();
virtual void setRenderTarget(Image *renderTarget);
virtual void setScissorRect(const sw::Rect &rect);
virtual void setVertexShader(sw::VertexShader *shader);
......
......@@ -323,11 +323,7 @@ void ResourceManager::checkTextureAllocation(GLuint texture, TextureType type)
{
Texture *textureObject;
if(type == TEXTURE_1D)
{
textureObject = new Texture1D(texture);
}
else if(type == TEXTURE_2D)
if(type == TEXTURE_2D)
{
textureObject = new Texture2D(texture);
}
......
......@@ -37,7 +37,6 @@ enum TextureType
TEXTURE_2D,
PROXY_TEXTURE_2D,
TEXTURE_CUBE,
TEXTURE_1D,
TEXTURE_TYPE_COUNT,
TEXTURE_UNKNOWN
......
......@@ -167,7 +167,6 @@ TranslatorASM *Shader::createCompiler(GLenum shaderType)
resources.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
resources.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
resources.MaxTextureCoords = MAX_TEXTURE_COORDS;
resources.MaxFragmentUniformVectors = MAX_FRAGMENT_UNIFORM_VECTORS;
resources.MaxDrawBuffers = MAX_DRAW_BUFFERS;
resources.OES_standard_derivatives = 1;
......
......@@ -168,11 +168,11 @@ GLfloat Texture::getMaxAnisotropy() const
return mMaxAnisotropy;
}
void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image, int xOffset)
void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image)
{
if(pixels && image)
{
image->loadImageData(xOffset/*0*/, 0, 0, image->getWidth(), image->getHeight(), 1, format, type, unpackAlignment, pixels);
image->loadImageData(0, 0, 0, image->getWidth(), image->getHeight(), 1, format, type, unpackAlignment, pixels);
}
}
......@@ -184,7 +184,7 @@ void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *i
}
}
void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image, bool is2DTexture)
void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image)
{
if(!image)
{
......@@ -201,7 +201,7 @@ void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
return error(GL_INVALID_OPERATION);
}
if(format != image->getFormat() && is2DTexture)
if(format != image->getFormat())
{
return error(GL_INVALID_OPERATION);
}
......@@ -367,7 +367,7 @@ int Texture2D::getLevelCount() const
return levels;
}
void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, int xOffset)
void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
{
if(image[level])
{
......@@ -381,7 +381,7 @@ void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum form
return error(GL_OUT_OF_MEMORY);
}
Texture::setImage(format, type, unpackAlignment, pixels, image[level], xOffset);
Texture::setImage(format, type, unpackAlignment, pixels, image[level]);
}
void Texture2D::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
......@@ -1038,57 +1038,4 @@ Image *TextureCubeMap::getRenderTarget(GLenum target, unsigned int level)
return image[face][level];
}
Texture1D::Texture1D(GLuint name) : Texture2D(name)
{
}
Texture1D::~Texture1D()
{
}
GLenum Texture1D::getTarget() const
{
return GL_TEXTURE_1D;
}
GLenum Texture1D::getFormat(GLenum target, GLint level) const
{
ASSERT(target == GL_TEXTURE_1D);
return image[level] ? image[level]->getFormat() : 0;
}
GLenum Texture1D::getType(GLenum target, GLint level) const
{
ASSERT(target == GL_TEXTURE_1D);
return image[level] ? image[level]->getType() : 0;
}
GLsizei Texture1D::getWidth(GLenum target, GLint level) const
{
ASSERT(target == GL_TEXTURE_1D || target == GL_PROXY_TEXTURE_1D);
return image[level] ? image[level]->getWidth() : 0;
}
GLsizei Texture1D::getHeight(GLenum target, GLint level) const
{
ASSERT(target == GL_TEXTURE_1D || target == GL_PROXY_TEXTURE_1D);
return image[level] ? image[level]->getHeight() : 0;
}
sw::Format Texture1D::getInternalFormat(GLenum target, GLint level) const
{
ASSERT(target == GL_TEXTURE_1D || target == GL_PROXY_TEXTURE_1D);
return image[level] ? image[level]->getInternalFormat() : sw::FORMAT_NULL;
}
void Texture1D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
{
Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, image[level], false);
}
bool Texture1D::isCompressed(GLenum target, GLint level) const
{
return IsCompressed(getFormat(target, level));
}
}
......@@ -88,8 +88,8 @@ public:
virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
protected:
void setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image, int xOffset = 0);
void subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image, bool is2DTexture = true);
void setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image);
void subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image);
void setCompressedImage(GLsizei imageSize, const void *pixels, Image *image);
void subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *image);
......@@ -126,7 +126,7 @@ public:
virtual sw::Format getInternalFormat(GLenum target, GLint level) const;
virtual int getLevelCount() const;
void setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, int xOffset = 0);
void setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
......@@ -216,21 +216,6 @@ private:
unsigned int mFaceProxyRefs[6];
};
class Texture1D : public Texture2D
{
public:
explicit Texture1D(GLuint name);
virtual ~Texture1D();
virtual GLenum getTarget() const;
virtual GLenum getFormat(GLenum target, GLint level) const;
virtual GLenum getType(GLenum target, GLint level) const;
virtual GLsizei getWidth(GLenum target, GLint level) const;
virtual GLsizei getHeight(GLenum target, GLint level) const;
virtual sw::Format getInternalFormat(GLenum target, GLint level) const;
virtual void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
virtual bool isCompressed(GLenum target, GLint level) const;
};
}
#endif // LIBGL_TEXTURE_H_
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -368,6 +368,5 @@ EXPORTS
wglUseFontBitmapsW @366
wglUseFontOutlinesA @367
wglUseFontOutlinesW @368
wglCreateContextAttribsARB @369
Register
\ No newline at end of file
......@@ -309,7 +309,7 @@ namespace gl
bool IsTextureTarget(GLenum target)
{
return target == GL_TEXTURE_1D || target == GL_TEXTURE_RECTANGLE || target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
}
// Verify that format/type are one of the combinations from table 3.4.
......@@ -617,59 +617,6 @@ namespace es2sw
}
}
void ConvertTextureOperations(GLenum texEnvMode, GLenum texFormat, sw::TextureStage::StageOperation *rgbOperation, sw::TextureStage::StageOperation *alphaOperation)
{
switch(texEnvMode)
{
case GL_MODULATE:
switch(texFormat)
{
case GL_LUMINANCE_ALPHA:
*rgbOperation = sw::TextureStage::STAGE_MODULATE;
*alphaOperation = sw::TextureStage::STAGE_MODULATE;
break;
case GL_RGB:
*rgbOperation = sw::TextureStage::STAGE_MODULATE;
*alphaOperation = sw::TextureStage::STAGE_SELECTARG2;
break;
case GL_RGBA:
*rgbOperation = sw::TextureStage::STAGE_MODULATE;
*alphaOperation = sw::TextureStage::STAGE_MODULATE;
break;
case GL_ALPHA:
case GL_LUMINANCE:
UNIMPLEMENTED();
// Default operations for compatibility
*rgbOperation = sw::TextureStage::STAGE_MODULATE;
*alphaOperation = sw::TextureStage::STAGE_MODULATE;
break;
default: UNREACHABLE();
}
break;
case GL_REPLACE:
*rgbOperation = sw::TextureStage::STAGE_SELECTARG1;
*alphaOperation = sw::TextureStage::STAGE_SELECTARG1;
break;
case GL_ADD:
*rgbOperation = sw::TextureStage::STAGE_ADD;
*alphaOperation = sw::TextureStage::STAGE_SELECTARG1;
break;
case GL_DECAL:
case GL_BLEND:
// Default operations for compatibility
*rgbOperation = sw::TextureStage::STAGE_MODULATE;
*alphaOperation = sw::TextureStage::STAGE_MODULATE;
UNIMPLEMENTED();
break;
default:
UNREACHABLE();
}
}
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, gl::PrimitiveType &swPrimitiveType, int &primitiveCount)
{
switch(primitiveType)
......
......@@ -69,7 +69,6 @@ namespace es2sw
void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, gl::PrimitiveType &swPrimitiveType, int &primitiveCount);
sw::Format ConvertRenderbufferFormat(GLenum format);
void ConvertTextureOperations(GLenum texEnvMode, GLenum texFormat, sw::TextureStage::StageOperation *rgbOperation, sw::TextureStage::StageOperation *alphaOperation);
}
namespace sw2es
......
......@@ -284,8 +284,6 @@ namespace sw
// Set fixed-function pixel pipeline states, return true when modified
bool setDepthBufferEnable(bool depthBufferEnable);
void setRectangleTextureEnable(bool rectangleTextureEnable);
bool setAlphaBlendEnable(bool alphaBlendEnable);
bool setSourceBlendFactor(BlendFactor sourceBlendFactor);
bool setDestBlendFactor(BlendFactor destBlendFactor);
......
......@@ -213,16 +213,6 @@ namespace sw
updateLighting = true;
}
void VertexProcessor::setRectangleTextureEnable(bool enable)
{
rectangleTextureEnable = enable;
}
bool VertexProcessor::getRectangleTextureEnable()
{
return rectangleTextureEnable;
}
void VertexProcessor::setSpecularEnable(bool specularEnable)
{
context->setSpecularEnable(specularEnable);
......
......@@ -196,9 +196,6 @@ namespace sw
virtual void setLightEnable(unsigned int light, bool lightEnable);
virtual void setSpecularEnable(bool specularEnable);
void setRectangleTextureEnable(bool enable);
bool getRectangleTextureEnable();
virtual void setGlobalAmbient(const Color<float> &globalAmbient);
virtual void setLightPosition(unsigned int light, const Point &lightPosition);
virtual void setLightViewPosition(unsigned int light, const Point &lightPosition);
......@@ -299,8 +296,6 @@ namespace sw
bool updateBaseMatrix;
bool updateProjectionMatrix;
bool updateLighting;
bool rectangleTextureEnable;
bool oneDTextureEnable;
};
}
......
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