summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/Shader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/Shader.h')
-rw-r--r--src/3rdparty/angle/src/libANGLE/Shader.h102
1 files changed, 68 insertions, 34 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/Shader.h b/src/3rdparty/angle/src/libANGLE/Shader.h
index 10e79c7499..997977c87b 100644
--- a/src/3rdparty/angle/src/libANGLE/Shader.h
+++ b/src/3rdparty/angle/src/libANGLE/Shader.h
@@ -21,50 +21,83 @@
#include "common/angleutils.h"
#include "libANGLE/angletypes.h"
+#include "libANGLE/Debug.h"
namespace rx
{
+class ImplFactory;
class ShaderImpl;
+class ShaderSh;
}
namespace gl
{
class Compiler;
+struct Limitations;
class ResourceManager;
struct Data;
-struct PackedVarying : public sh::Varying
-{
- unsigned int registerIndex; // Assigned during link
- unsigned int columnIndex; // Assigned during link, defaults to 0
-
- PackedVarying(const sh::Varying &varying)
- : sh::Varying(varying),
- registerIndex(GL_INVALID_INDEX),
- columnIndex(0)
- {}
-
- bool registerAssigned() const { return registerIndex != GL_INVALID_INDEX; }
- bool isBuiltIn() const { return name.compare(0, 3, "gl_") == 0; }
-
- void resetRegisterAssignment()
- {
- registerIndex = GL_INVALID_INDEX;
- }
-};
-
-class Shader : angle::NonCopyable
+class Shader final : angle::NonCopyable, public LabeledObject
{
public:
- Shader(ResourceManager *manager, rx::ShaderImpl *impl, GLenum type, GLuint handle);
+ class Data final : angle::NonCopyable
+ {
+ public:
+ Data(GLenum shaderType);
+ ~Data();
+
+ const std::string &getLabel() const { return mLabel; }
+
+ const std::string &getSource() const { return mSource; }
+ const std::string &getTranslatedSource() const { return mTranslatedSource; }
+
+ GLenum getShaderType() const { return mShaderType; }
+ int getShaderVersion() const { return mShaderVersion; }
+
+ const std::vector<sh::Varying> &getVaryings() const { return mVaryings; }
+ const std::vector<sh::Uniform> &getUniforms() const { return mUniforms; }
+ const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const
+ {
+ return mInterfaceBlocks;
+ }
+ const std::vector<sh::Attribute> &getActiveAttributes() const { return mActiveAttributes; }
+ const std::vector<sh::OutputVariable> &getActiveOutputVariables() const
+ {
+ return mActiveOutputVariables;
+ }
+
+ private:
+ friend class Shader;
+
+ std::string mLabel;
+
+ GLenum mShaderType;
+ int mShaderVersion;
+ std::string mTranslatedSource;
+ std::string mSource;
+
+ std::vector<sh::Varying> mVaryings;
+ std::vector<sh::Uniform> mUniforms;
+ std::vector<sh::InterfaceBlock> mInterfaceBlocks;
+ std::vector<sh::Attribute> mActiveAttributes;
+ std::vector<sh::OutputVariable> mActiveOutputVariables;
+ };
+
+ Shader(ResourceManager *manager,
+ rx::ImplFactory *implFactory,
+ const gl::Limitations &rendererLimitations,
+ GLenum type,
+ GLuint handle);
virtual ~Shader();
+ void setLabel(const std::string &label) override;
+ const std::string &getLabel() const override;
+
GLenum getType() const { return mType; }
GLuint getHandle() const;
- rx::ShaderImpl *getImplementation() { return mShader; }
- const rx::ShaderImpl *getImplementation() const { return mShader; }
+ const rx::ShaderImpl *getImplementation() const { return mImplementation; }
void deleteSource();
void setSource(GLsizei count, const char *const *string, const GLint *length);
@@ -73,6 +106,8 @@ class Shader : angle::NonCopyable
int getSourceLength() const;
void getSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
int getTranslatedSourceLength() const;
+ int getTranslatedSourceWithDebugInfoLength() const;
+ const std::string &getTranslatedSource() const { return mData.getTranslatedSource(); }
void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
void getTranslatedSourceWithDebugInfo(GLsizei bufSize, GLsizei *length, char *buffer) const;
@@ -85,34 +120,33 @@ class Shader : angle::NonCopyable
bool isFlaggedForDeletion() const;
void flagForDeletion();
- const std::vector<gl::PackedVarying> &getVaryings() const;
+ int getShaderVersion() const;
+
+ const std::vector<sh::Varying> &getVaryings() const;
const std::vector<sh::Uniform> &getUniforms() const;
const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const;
const std::vector<sh::Attribute> &getActiveAttributes() const;
- const std::vector<sh::Attribute> &getActiveOutputVariables() const;
-
- std::vector<gl::PackedVarying> &getVaryings();
- std::vector<sh::Uniform> &getUniforms();
- std::vector<sh::InterfaceBlock> &getInterfaceBlocks();
- std::vector<sh::Attribute> &getActiveAttributes();
- std::vector<sh::Attribute> &getActiveOutputVariables();
+ const std::vector<sh::OutputVariable> &getActiveOutputVariables() const;
int getSemanticIndex(const std::string &attributeName) const;
private:
static void getSourceImpl(const std::string &source, GLsizei bufSize, GLsizei *length, char *buffer);
- rx::ShaderImpl *mShader;
+ Data mData;
+ rx::ShaderImpl *mImplementation;
+ const gl::Limitations &mRendererLimitations;
const GLuint mHandle;
const GLenum mType;
- std::string mSource;
unsigned int mRefCount; // Number of program objects this shader is attached to
bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use
bool mCompiled; // Indicates if this shader has been successfully compiled
+ std::string mInfoLog;
ResourceManager *mResourceManager;
};
+bool CompareShaderVar(const sh::ShaderVariable &x, const sh::ShaderVariable &y);
}
#endif // LIBANGLE_SHADER_H_