mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user