st/mesa: add texture buffer object support to state tracker (v1.1)
This adds the necessary changes to the st to allow texture buffer object support if the driver advertises it. v1.1: remove extra blank line and whitespace Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -215,13 +215,19 @@ update_single_texture(struct st_context *st,
|
||||
|
||||
/* Determine the format of the texture sampler view */
|
||||
st_view_format = stObj->pt->format;
|
||||
|
||||
{
|
||||
gl_format texFormat;
|
||||
enum pipe_format firstImageFormat;
|
||||
|
||||
if (texObj->Target == GL_TEXTURE_BUFFER) {
|
||||
texFormat = stObj->base._BufferObjectFormat;
|
||||
} else {
|
||||
const struct st_texture_image *firstImage =
|
||||
st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
|
||||
const gl_format texFormat = firstImage->base.TexFormat;
|
||||
enum pipe_format firstImageFormat =
|
||||
st_mesa_format_to_pipe_format(texFormat);
|
||||
|
||||
texFormat = firstImage->base.TexFormat;
|
||||
}
|
||||
firstImageFormat = st_mesa_format_to_pipe_format(texFormat);
|
||||
if ((samp->sRGBDecode == GL_SKIP_DECODE_EXT) &&
|
||||
(_mesa_get_format_color_encoding(texFormat) == GL_SRGB)) {
|
||||
/* Don't do sRGB->RGB conversion. Interpret the texture data as
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_cb_flush.h"
|
||||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_cb_bufferobjects.h"
|
||||
#include "state_tracker/st_format.h"
|
||||
#include "state_tracker/st_texture.h"
|
||||
#include "state_tracker/st_gen_mipmap.h"
|
||||
@@ -1229,6 +1230,20 @@ st_finalize_texture(struct gl_context *ctx,
|
||||
stObj->lastLevel = stObj->base._MaxLevel;
|
||||
}
|
||||
|
||||
if (tObj->Target == GL_TEXTURE_BUFFER) {
|
||||
struct st_buffer_object *st_obj = st_buffer_object(tObj->BufferObject);
|
||||
|
||||
if (st_obj->buffer != stObj->pt) {
|
||||
pipe_resource_reference(&stObj->pt, st_obj->buffer);
|
||||
pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
|
||||
stObj->width0 = stObj->pt->width0 / _mesa_get_format_bytes(tObj->_BufferObjectFormat);
|
||||
stObj->height0 = 1;
|
||||
stObj->depth0 = 1;
|
||||
}
|
||||
return GL_TRUE;
|
||||
|
||||
}
|
||||
|
||||
firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
|
||||
assert(firstImage);
|
||||
|
||||
|
@@ -643,4 +643,6 @@ void st_init_extensions(struct st_context *st)
|
||||
if (ctx->Const.MinMapBufferAlignment >= 64) {
|
||||
ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE;
|
||||
}
|
||||
if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS))
|
||||
ctx->Extensions.ARB_texture_buffer_object = GL_TRUE;
|
||||
}
|
||||
|
@@ -2776,7 +2776,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
|
||||
inst->tex_target = TEXTURE_RECT_INDEX;
|
||||
break;
|
||||
case GLSL_SAMPLER_DIM_BUF:
|
||||
assert(!"FINISHME: Implement ARB_texture_buffer_object");
|
||||
inst->tex_target = TEXTURE_BUFFER_INDEX;
|
||||
break;
|
||||
case GLSL_SAMPLER_DIM_EXTERNAL:
|
||||
inst->tex_target = TEXTURE_EXTERNAL_INDEX;
|
||||
|
@@ -269,6 +269,7 @@ st_translate_texture_target( GLuint textarget,
|
||||
}
|
||||
|
||||
switch( textarget ) {
|
||||
case TEXTURE_BUFFER_INDEX: return TGSI_TEXTURE_BUFFER;
|
||||
case TEXTURE_1D_INDEX: return TGSI_TEXTURE_1D;
|
||||
case TEXTURE_2D_INDEX: return TGSI_TEXTURE_2D;
|
||||
case TEXTURE_3D_INDEX: return TGSI_TEXTURE_3D;
|
||||
|
Reference in New Issue
Block a user