Add new texel buffer type.

GLSL 3+ shaders can read from texel buffers by declaring a uniform samplerBuffer variable and calling texelFetch with a 0-based index, in the shader code. All attributes in a texel buffer's format array must have the same data format (e.g. all 'floatvec4' formats).

Shader:send accepts a texel Buffer for samplerBuffer uniforms.

Added 'texelbuffer' to love.graphics.getSupported (requires GLSL 3+ and desktop OpenGL).
Added 'texelbuffersize' to love.graphics.getSystemLimits. Returns the max number of values in a texel buffer (array length multiplied by the number of attributes declared in the buffer's format array).
This commit is contained in:
Alex Szpakowski
2020-07-28 20:44:36 -03:00
parent 3c65d5ae41
commit b011487a3e
18 changed files with 445 additions and 62 deletions
+9 -1
View File
@@ -39,6 +39,7 @@ namespace graphics
{
class Graphics;
class Buffer;
// A GLSL shader
class Shader : public Object, public Resource
@@ -76,6 +77,7 @@ public:
UNIFORM_UINT,
UNIFORM_BOOL,
UNIFORM_SAMPLER,
UNIFORM_TEXELBUFFER,
UNIFORM_UNKNOWN,
UNIFORM_MAX_ENUM
};
@@ -115,6 +117,7 @@ public:
UniformType baseType;
TextureType textureType;
DataBaseType texelBufferType;
bool isDepthSampler;
std::string name;
@@ -128,7 +131,11 @@ public:
size_t dataSize;
Texture **textures;
union
{
Texture **textures;
Buffer **buffers;
};
};
// The members in here must respect uniform buffer alignment/padding rules.
@@ -178,6 +185,7 @@ public:
virtual void updateUniform(const UniformInfo *info, int count) = 0;
virtual void sendTextures(const UniformInfo *info, Texture **textures, int count) = 0;
virtual void sendBuffers(const UniformInfo *info, Buffer **buffers, int count) = 0;
/**
* Gets whether a uniform with the specified name exists and is actively