Added support for GLSL 3 shaders (GLSL 3.30 and GLSL ES 3.00).

To use GLSL 3 in a shader, the first line of the shader has to be: #pragma language glsl3

glsl1 is the default language.

Added “glsl3” graphics feature as part of the table returned by love.graphics.getSupported().

Added love.graphics.validateShader(boolean gles, shadercode). It returns a boolean along with an error string if the shader code has errors for its target language and platform (gles or desktop).

Implemented support for Core Profile OpenGL 3.3 in love.graphics.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-01-22 18:54:04 -04:00
parent a6669a8bb2
commit 731b5d5cf0
85 changed files with 50255 additions and 299 deletions
+20 -2
View File
@@ -166,6 +166,7 @@ public:
FEATURE_LIGHTEN,
FEATURE_FULL_NPOT,
FEATURE_PIXEL_SHADER_HIGHP,
FEATURE_GLSL3,
FEATURE_MAX_ENUM
};
@@ -313,6 +314,8 @@ public:
virtual Shader *newShader(const Shader::ShaderSource &source) = 0;
bool validateShader(bool gles, const Shader::ShaderSource &source, std::string &err);
/**
* Resets the current color, background color, line style, and so forth.
**/
@@ -634,6 +637,11 @@ public:
**/
virtual double getSystemLimit(SystemLimit limittype) const = 0;
/**
* Gets the renderer used by love.graphics.
**/
virtual Renderer getRenderer() const = 0;
/**
* Returns system-dependent renderer information.
* Returned strings can vary greatly between systems! Do not rely on it for
@@ -667,6 +675,9 @@ public:
virtual void flushStreamDraws() = 0;
StreamVertexData requestStreamDraw(const StreamDrawRequest &request);
virtual Shader::Language getShaderLanguageTarget() const = 0;
const Shader::ShaderSource &getCurrentDefaultShaderCode() const;
template <typename T>
T *getScratchBuffer(size_t count)
{
@@ -712,8 +723,8 @@ public:
static bool getConstant(StackType in, const char *&out);
// Default shader code (a shader is always required internally.)
static Shader::ShaderSource defaultShaderCode[RENDERER_MAX_ENUM][2];
static Shader::ShaderSource defaultVideoShaderCode[RENDERER_MAX_ENUM][2];
static Shader::ShaderSource defaultShaderCode[Shader::LANGUAGE_MAX_ENUM][2];
static Shader::ShaderSource defaultVideoShaderCode[Shader::LANGUAGE_MAX_ENUM][2];
protected:
@@ -756,6 +767,7 @@ protected:
{
StreamBuffer *vb[2];
StreamBuffer *indexBuffer = nullptr;
vertex::PrimitiveMode primitiveMode = vertex::PrimitiveMode::TRIANGLES;
vertex::CommonFormat formats[2];
StrongRef<Texture> texture;
@@ -763,13 +775,19 @@ protected:
int vertexCount = 0;
int indexCount = 0;
StreamBuffer::MapInfo vbMap[2];
StreamBuffer::MapInfo indexBufferMap = StreamBuffer::MapInfo();
StreamBufferState()
{
vb[0] = vb[1] = nullptr;
formats[0] = formats[1] = vertex::CommonFormat::NONE;
vbMap[0] = vbMap[1] = StreamBuffer::MapInfo();
}
};
virtual StreamBuffer *newStreamBuffer(BufferType type, size_t size) = 0;
void restoreState(const DisplayState &s);
void restoreStateChecked(const DisplayState &s);