summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libGLESv2/ProgramBinary.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libGLESv2/ProgramBinary.h')
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ProgramBinary.h133
1 files changed, 20 insertions, 113 deletions
diff --git a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.h b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.h
index ad470d417b..3142d66c6d 100644
--- a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.h
+++ b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.h
@@ -24,11 +24,6 @@
#include <string>
#include <vector>
-// TODO(jmadill): place this in workarounds library
-#define ANGLE_WORKAROUND_ENABLED 1
-#define ANGLE_WORKAROUND_DISABLED 2
-#define ANGLE_MRT_PERF_WORKAROUND ANGLE_WORKAROUND_ENABLED
-
namespace sh
{
class HLSLBlockEncoder;
@@ -44,7 +39,6 @@ class HLSLBlockEncoder;
namespace rx
{
class ShaderExecutable;
-class Renderer;
struct TranslatedAttribute;
class UniformStorage;
class ProgramImpl;
@@ -58,6 +52,7 @@ class InfoLog;
class AttributeBindings;
class Buffer;
class Framebuffer;
+struct Data;
// Struct used for correlating uniforms/elements of uniform arrays to handles
struct VariableLocation
@@ -91,6 +86,14 @@ struct LinkedVarying
unsigned int semanticIndexCount;
};
+struct LinkResult
+{
+ bool linkSuccess;
+ Error error;
+
+ LinkResult(bool linkSuccess, const Error &error);
+};
+
// This is the result of linking a program. It is the state that would be passed to ProgramBinary.
class ProgramBinary : public RefCountObject
{
@@ -101,11 +104,6 @@ class ProgramBinary : public RefCountObject
rx::ProgramImpl *getImplementation() { return mProgram; }
const rx::ProgramImpl *getImplementation() const { return mProgram; }
- rx::ShaderExecutable *getPixelExecutableForFramebuffer(const Framebuffer *fbo);
- rx::ShaderExecutable *getPixelExecutableForOutputLayout(const std::vector<GLenum> &outputLayout);
- rx::ShaderExecutable *getVertexExecutableForInputLayout(const VertexFormat inputLayout[MAX_VERTEX_ATTRIBS]);
- rx::ShaderExecutable *getGeometryExecutable() const;
-
GLuint getAttributeLocation(const char *name);
int getSemanticIndex(int attributeIndex);
@@ -113,8 +111,6 @@ class ProgramBinary : public RefCountObject
GLenum getSamplerTextureType(SamplerType type, unsigned int samplerIndex);
GLint getUsedSamplerRange(SamplerType type);
bool usesPointSize() const;
- bool usesPointSpriteEmulation() const;
- bool usesGeometryShader() const;
GLint getUniformLocation(std::string name);
GLuint getUniformIndex(std::string name);
@@ -145,18 +141,17 @@ class ProgramBinary : public RefCountObject
void getUniformiv(GLint location, GLint *params);
void getUniformuiv(GLint location, GLuint *params);
- void dirtyAllUniforms();
-
Error applyUniforms();
Error applyUniformBuffers(const std::vector<Buffer*> boundBuffers, const Caps &caps);
- bool load(InfoLog &infoLog, GLenum binaryFormat, const void *binary, GLsizei length);
- bool save(GLenum *binaryFormat, void *binary, GLsizei bufSize, GLsizei *length);
+ LinkResult load(InfoLog &infoLog, GLenum binaryFormat, const void *binary, GLsizei length);
+ Error save(GLenum *binaryFormat, void *binary, GLsizei bufSize, GLsizei *length);
GLint getLength();
- bool link(InfoLog &infoLog, const AttributeBindings &attributeBindings, Shader *fragmentShader, Shader *vertexShader,
- const std::vector<std::string>& transformFeedbackVaryings, GLenum transformFeedbackBufferMode, const Caps &caps);
- void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
+ LinkResult link(const Data &data, InfoLog &infoLog, const AttributeBindings &attributeBindings,
+ Shader *fragmentShader, Shader *vertexShader,
+ const std::vector<std::string> &transformFeedbackVaryings,
+ GLenum transformFeedbackBufferMode);
void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
GLint getActiveAttributeCount() const;
@@ -188,30 +183,23 @@ class ProgramBinary : public RefCountObject
void updateSamplerMapping();
unsigned int getSerial() const;
- int getShaderVersion() const;
void initAttributesByLayout();
void sortAttributesByLayout(rx::TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const;
- const std::vector<LinkedUniform*> &getUniforms() const { return mUniforms; }
-
static bool linkVaryings(InfoLog &infoLog, Shader *fragmentShader, Shader *vertexShader);
+ static bool linkValidateUniforms(InfoLog &infoLog, const std::string &uniformName, const sh::Uniform &vertexUniform, const sh::Uniform &fragmentUniform);
+ static bool linkValidateInterfaceBlockFields(InfoLog &infoLog, const std::string &uniformName, const sh::InterfaceBlockField &vertexUniform, const sh::InterfaceBlockField &fragmentUniform);
private:
DISALLOW_COPY_AND_ASSIGN(ProgramBinary);
- struct Sampler
- {
- Sampler();
-
- bool active;
- GLint logicalTextureUnit;
- GLenum textureType;
- };
-
void reset();
bool linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, const Shader *vertexShader);
+ bool linkUniformBlocks(InfoLog &infoLog, const Shader &vertexShader, const Shader &fragmentShader, const Caps &caps);
+ bool areMatchingInterfaceBlocks(gl::InfoLog &infoLog, const sh::InterfaceBlock &vertexInterfaceBlock,
+ const sh::InterfaceBlock &fragmentInterfaceBlock);
static bool linkValidateVariablesBase(InfoLog &infoLog,
const std::string &variableName,
@@ -219,102 +207,21 @@ class ProgramBinary : public RefCountObject
const sh::ShaderVariable &fragmentVariable,
bool validatePrecision);
- static bool linkValidateUniforms(InfoLog &infoLog, const std::string &uniformName, const sh::Uniform &vertexUniform, const sh::Uniform &fragmentUniform);
static bool linkValidateVaryings(InfoLog &infoLog, const std::string &varyingName, const sh::Varying &vertexVarying, const sh::Varying &fragmentVarying);
- static bool linkValidateInterfaceBlockFields(InfoLog &infoLog, const std::string &uniformName, const sh::InterfaceBlockField &vertexUniform, const sh::InterfaceBlockField &fragmentUniform);
- bool linkUniforms(InfoLog &infoLog, const Shader &vertexShader, const Shader &fragmentShader, const Caps &caps);
- void defineUniformBase(GLenum shader, const sh::Uniform &uniform, unsigned int uniformRegister);
- void defineUniform(GLenum shader, const sh::ShaderVariable &uniform, const std::string &fullName, sh::HLSLBlockEncoder *encoder);
- bool indexSamplerUniform(const LinkedUniform &uniform, InfoLog &infoLog, const Caps &caps);
- bool indexUniforms(InfoLog &infoLog, const Caps &caps);
- static bool assignSamplers(unsigned int startSamplerIndex, GLenum samplerType, unsigned int samplerCount,
- std::vector<Sampler> &outSamplers, GLuint *outUsedRange);
- bool areMatchingInterfaceBlocks(InfoLog &infoLog, const sh::InterfaceBlock &vertexInterfaceBlock, const sh::InterfaceBlock &fragmentInterfaceBlock);
- bool linkUniformBlocks(InfoLog &infoLog, const Shader &vertexShader, const Shader &fragmentShader, const Caps &caps);
bool gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, const std::vector<LinkedVarying> &linkedVaryings,
const std::vector<std::string> &transformFeedbackVaryingNames,
GLenum transformFeedbackBufferMode,
std::vector<LinkedVarying> *outTransformFeedbackLinkedVaryings,
const Caps &caps) const;
- template <typename VarT>
- void defineUniformBlockMembers(const std::vector<VarT> &fields, const std::string &prefix, int blockIndex,
- sh::BlockLayoutEncoder *encoder, std::vector<unsigned int> *blockUniformIndexes,
- bool inRowMajorLayout);
- bool defineUniformBlock(InfoLog &infoLog, const Shader &shader, const sh::InterfaceBlock &interfaceBlock, const Caps &caps);
bool assignUniformBlockRegister(InfoLog &infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex, const Caps &caps);
void defineOutputVariables(Shader *fragmentShader);
- template <typename T>
- void setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType);
-
- template <int cols, int rows>
- void setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType);
-
- template <typename T>
- void getUniformv(GLint location, T *params, GLenum uniformType);
-
- class VertexExecutable
- {
- public:
- VertexExecutable(const VertexFormat inputLayout[MAX_VERTEX_ATTRIBS],
- const GLenum signature[MAX_VERTEX_ATTRIBS],
- rx::ShaderExecutable *shaderExecutable);
- ~VertexExecutable();
-
- bool matchesSignature(const GLenum convertedLayout[MAX_VERTEX_ATTRIBS]) const;
-
- const VertexFormat *inputs() const { return mInputs; }
- const GLenum *signature() const { return mSignature; }
- rx::ShaderExecutable *shaderExecutable() const { return mShaderExecutable; }
-
- private:
- VertexFormat mInputs[MAX_VERTEX_ATTRIBS];
- GLenum mSignature[MAX_VERTEX_ATTRIBS];
- rx::ShaderExecutable *mShaderExecutable;
- };
-
- class PixelExecutable
- {
- public:
- PixelExecutable(const std::vector<GLenum> &outputSignature, rx::ShaderExecutable *shaderExecutable);
- ~PixelExecutable();
-
- bool matchesSignature(const std::vector<GLenum> &signature) const { return mOutputSignature == signature; }
-
- const std::vector<GLenum> &outputSignature() const { return mOutputSignature; }
- rx::ShaderExecutable *shaderExecutable() const { return mShaderExecutable; }
-
- private:
- std::vector<GLenum> mOutputSignature;
- rx::ShaderExecutable *mShaderExecutable;
- };
-
rx::ProgramImpl *mProgram;
- std::vector<VertexExecutable *> mVertexExecutables;
- std::vector<PixelExecutable *> mPixelExecutables;
-
- rx::ShaderExecutable *mGeometryExecutable;
-
sh::Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS];
- sh::Attribute mShaderAttributes[MAX_VERTEX_ATTRIBS];
int mSemanticIndex[MAX_VERTEX_ATTRIBS];
int mAttributesByLayout[MAX_VERTEX_ATTRIBS];
- GLenum mTransformFeedbackBufferMode;
- std::vector<LinkedVarying> mTransformFeedbackLinkedVaryings;
-
- std::vector<Sampler> mSamplersPS;
- std::vector<Sampler> mSamplersVS;
- GLuint mUsedVertexSamplerRange;
- GLuint mUsedPixelSamplerRange;
- bool mUsesPointSize;
- int mShaderVersion;
- bool mDirtySamplerMapping;
-
- std::vector<LinkedUniform*> mUniforms;
- std::vector<UniformBlock*> mUniformBlocks;
- std::vector<VariableLocation> mUniformIndex;
std::map<int, VariableLocation> mOutputVariables;
bool mValidated;