/* Determine the format of the texture sampler view */
st_view_format = stObj->pt->format;
- {
- 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);
+ {
+ 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]);
+ 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
#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"
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);
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;
}
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;
}
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;