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
+7 -4
View File
@@ -60,6 +60,7 @@ public:
TYPEFLAG_NONE = 0,
TYPEFLAG_VERTEX = 1 << BUFFERTYPE_VERTEX,
TYPEFLAG_INDEX = 1 << BUFFERTYPE_INDEX,
TYPEFLAG_TEXEL = 1 << BUFFERTYPE_TEXEL,
};
struct DataDeclaration
@@ -141,10 +142,6 @@ public:
/**
* Fill a portion of the buffer with data and marks the range as modified.
*
* @param offset The offset in the GLBuffer to store the data.
* @param size The size of the incoming data.
* @param data Pointer to memory to copy data from.
*/
virtual void fill(size_t offset, size_t size, const void *data) = 0;
@@ -153,6 +150,12 @@ public:
**/
virtual void copyTo(size_t offset, size_t size, Buffer *other, size_t otheroffset) = 0;
/**
* Texel buffers may use an additional texture handle as well as a buffer
* handle.
**/
virtual ptrdiff_t getTexelBufferHandle() const = 0;
static std::vector<DataDeclaration> getCommonFormatDeclaration(CommonFormat format);
class Mapper