mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 17:40:11 +01:00
main: Added entry point for glTextureBuffer.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
parent
499004e56a
commit
98e64e538a
4 changed files with 92 additions and 16 deletions
|
|
@ -15,6 +15,12 @@
|
||||||
<param name="textures" type="GLuint *" />
|
<param name="textures" type="GLuint *" />
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
|
<function name="TextureBuffer" offset="assign">
|
||||||
|
<param name="texture" type="GLuint" />
|
||||||
|
<param name="internalformat" type="GLenum" />
|
||||||
|
<param name="buffer" type="GLuint" />
|
||||||
|
</function>
|
||||||
|
|
||||||
<function name="TextureStorage1D" offset="assign">
|
<function name="TextureStorage1D" offset="assign">
|
||||||
<param name="texture" type="GLuint" />
|
<param name="texture" type="GLuint" />
|
||||||
<param name="levels" type="GLsizei" />
|
<param name="levels" type="GLsizei" />
|
||||||
|
|
|
||||||
|
|
@ -986,6 +986,7 @@ const struct function gl_core_functions_possible[] = {
|
||||||
{ "glGenerateTextureMipmap", 45, -1 },
|
{ "glGenerateTextureMipmap", 45, -1 },
|
||||||
{ "glTextureStorage2DMultisample", 45, -1 },
|
{ "glTextureStorage2DMultisample", 45, -1 },
|
||||||
{ "glTextureStorage3DMultisample", 45, -1 },
|
{ "glTextureStorage3DMultisample", 45, -1 },
|
||||||
|
{ "glTextureBuffer", 45, -1 },
|
||||||
|
|
||||||
{ NULL, 0, -1 }
|
{ NULL, 0, -1 }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4919,30 +4919,26 @@ _mesa_validate_texbuffer_format(const struct gl_context *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
void
|
||||||
texbufferrange(struct gl_context *ctx, GLenum target, GLenum internalFormat,
|
_mesa_texture_buffer_range(struct gl_context *ctx,
|
||||||
struct gl_buffer_object *bufObj,
|
struct gl_texture_object *texObj, GLenum target,
|
||||||
GLintptr offset, GLsizeiptr size)
|
GLenum internalFormat,
|
||||||
|
struct gl_buffer_object *bufObj,
|
||||||
|
GLintptr offset, GLsizeiptr size, bool range,
|
||||||
|
bool dsa)
|
||||||
{
|
{
|
||||||
struct gl_texture_object *texObj;
|
|
||||||
mesa_format format;
|
mesa_format format;
|
||||||
|
|
||||||
FLUSH_VERTICES(ctx, 0);
|
FLUSH_VERTICES(ctx, 0);
|
||||||
|
|
||||||
if (target != GL_TEXTURE_BUFFER_ARB) {
|
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(target)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
format = _mesa_validate_texbuffer_format(ctx, internalFormat);
|
format = _mesa_validate_texbuffer_format(ctx, internalFormat);
|
||||||
if (format == MESA_FORMAT_NONE) {
|
if (format == MESA_FORMAT_NONE) {
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(internalFormat 0x%x)",
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
internalFormat);
|
"glTex%sBuffer%s(internalFormat 0x%x)", dsa ? "ture" : "",
|
||||||
|
range ? "Range" : "", internalFormat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
texObj = _mesa_get_current_tex_object(ctx, target);
|
|
||||||
|
|
||||||
_mesa_lock_texture(ctx, texObj);
|
_mesa_lock_texture(ctx, texObj);
|
||||||
{
|
{
|
||||||
_mesa_reference_buffer_object(ctx, &texObj->BufferObject, bufObj);
|
_mesa_reference_buffer_object(ctx, &texObj->BufferObject, bufObj);
|
||||||
|
|
@ -4965,10 +4961,17 @@ texbufferrange(struct gl_context *ctx, GLenum target, GLenum internalFormat,
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
|
_mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
|
||||||
{
|
{
|
||||||
|
struct gl_texture_object *texObj;
|
||||||
struct gl_buffer_object *bufObj;
|
struct gl_buffer_object *bufObj;
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
|
/* Need to catch this before it gets to _mesa_get_current_tex_object */
|
||||||
|
if (target != GL_TEXTURE_BUFFER_ARB) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(target)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* NOTE: ARB_texture_buffer_object has interactions with
|
/* NOTE: ARB_texture_buffer_object has interactions with
|
||||||
* the compatibility profile that are not implemented.
|
* the compatibility profile that are not implemented.
|
||||||
*/
|
*/
|
||||||
|
|
@ -4984,7 +4987,12 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
texbufferrange(ctx, target, internalFormat, bufObj, 0, buffer ? -1 : 0);
|
texObj = _mesa_get_current_tex_object(ctx, target);
|
||||||
|
if (!texObj)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_mesa_texture_buffer_range(ctx, texObj, target, internalFormat, bufObj, 0,
|
||||||
|
buffer ? -1 : 0, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4993,10 +5001,17 @@ void GLAPIENTRY
|
||||||
_mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
|
_mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
|
||||||
GLintptr offset, GLsizeiptr size)
|
GLintptr offset, GLsizeiptr size)
|
||||||
{
|
{
|
||||||
|
struct gl_texture_object *texObj;
|
||||||
struct gl_buffer_object *bufObj;
|
struct gl_buffer_object *bufObj;
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
|
/* Need to catch this before it gets to _mesa_get_current_tex_object */
|
||||||
|
if (target != GL_TEXTURE_BUFFER_ARB) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_ENUM, "glTexBufferRange(target)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(ctx->API == API_OPENGL_CORE &&
|
if (!(ctx->API == API_OPENGL_CORE &&
|
||||||
ctx->Extensions.ARB_texture_buffer_range)) {
|
ctx->Extensions.ARB_texture_buffer_range)) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexBufferRange");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexBufferRange");
|
||||||
|
|
@ -5025,9 +5040,52 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
|
||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
texbufferrange(ctx, target, internalFormat, bufObj, offset, size);
|
texObj = _mesa_get_current_tex_object(ctx, target);
|
||||||
|
if (!texObj)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_mesa_texture_buffer_range(ctx, texObj, target, internalFormat, bufObj,
|
||||||
|
offset, size, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLAPIENTRY
|
||||||
|
_mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer)
|
||||||
|
{
|
||||||
|
struct gl_texture_object *texObj;
|
||||||
|
struct gl_buffer_object *bufObj;
|
||||||
|
|
||||||
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
|
/* NOTE: ARB_texture_buffer_object has interactions with
|
||||||
|
* the compatibility profile that are not implemented.
|
||||||
|
*/
|
||||||
|
if (!(ctx->API == API_OPENGL_CORE &&
|
||||||
|
ctx->Extensions.ARB_texture_buffer_object)) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glTextureBuffer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
|
||||||
|
if (!bufObj && buffer) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glTextureBuffer(buffer %u)",
|
||||||
|
buffer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the texture object by Name. */
|
||||||
|
texObj = _mesa_lookup_texture_err(ctx, texture,
|
||||||
|
"glTextureBuffer(texture)");
|
||||||
|
if (!texObj)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (texObj->Target != GL_TEXTURE_BUFFER_ARB) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_ENUM, "glTextureBuffer(target)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_mesa_texture_buffer_range(ctx, texObj, texObj->Target, internalFormat,
|
||||||
|
bufObj, 0, buffer ? -1 : 0, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
static GLboolean
|
static GLboolean
|
||||||
is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat)
|
is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat)
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,14 @@ _mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
|
||||||
GLsizei height, GLsizei depth,
|
GLsizei height, GLsizei depth,
|
||||||
GLboolean fixedsamplelocations,
|
GLboolean fixedsamplelocations,
|
||||||
GLboolean immutable, const char *func);
|
GLboolean immutable, const char *func);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
_mesa_texture_buffer_range(struct gl_context *ctx,
|
||||||
|
struct gl_texture_object *texObj, GLenum target,
|
||||||
|
GLenum internalFormat,
|
||||||
|
struct gl_buffer_object *bufObj,
|
||||||
|
GLintptr offset, GLsizeiptr size, bool range,
|
||||||
|
bool dsa);
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -394,6 +402,9 @@ extern void GLAPIENTRY
|
||||||
_mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
|
_mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
|
||||||
GLintptr offset, GLsizeiptr size);
|
GLintptr offset, GLsizeiptr size);
|
||||||
|
|
||||||
|
extern void GLAPIENTRY
|
||||||
|
_mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer);
|
||||||
|
|
||||||
|
|
||||||
extern void GLAPIENTRY
|
extern void GLAPIENTRY
|
||||||
_mesa_TexImage2DMultisample(GLenum target, GLsizei samples,
|
_mesa_TexImage2DMultisample(GLenum target, GLsizei samples,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue