summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c18
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c15
-rw-r--r--src/mesa/state_tracker/st_extensions.c2
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp2
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c1
5 files changed, 31 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index df05e83c2d4..dba1d829c20 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -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;
- {
- 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
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 10db5bcb51a..ae069eb2cba 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -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);
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 62a736bb61b..0c6179577c6 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -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;
}
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index c030a6b372e..ae3b8b2c0d1 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -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;
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 81a870f8685..e326bcc7031 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -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;