summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_texture.c
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-04-12 16:13:33 +0800
committerChia-I Wu <olv@lunarg.com>2010-04-13 15:15:43 +0800
commitda8412ec19ad00627ae9139dc02f46f344bbb6ac (patch)
tree2d94aaab96316afb0267251d978830812ed701af /src/mesa/state_tracker/st_texture.c
parenta1dbd009d4a725b432a08093dc52486f896915d9 (diff)
st/mesa: Drop st_public support.
There is no user of st_public now.
Diffstat (limited to 'src/mesa/state_tracker/st_texture.c')
-rw-r--r--src/mesa/state_tracker/st_texture.c221
1 files changed, 0 insertions, 221 deletions
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index a623eed50a..c80736ffd7 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -27,7 +27,6 @@
#include "st_context.h"
#include "st_format.h"
-#include "st_public.h"
#include "st_texture.h"
#include "st_cb_fbo.h"
#include "st_inlines.h"
@@ -357,226 +356,6 @@ st_texture_image_copy(struct pipe_context *pipe,
}
-/**
- * Bind a pipe surface to a texture object. After the call,
- * the texture object is marked dirty and will be (re-)validated.
- *
- * If this is the first surface bound, the texture object is said to
- * switch from normal to surface based. It will be cleared first in
- * this case.
- *
- * \param ps pipe surface to be unbound
- * \param target texture target
- * \param level image level
- * \param format internal format of the texture
- */
-int
-st_bind_texture_surface(struct pipe_surface *ps, int target, int level,
- enum pipe_format format)
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- struct st_texture_object *stObj;
- struct st_texture_image *stImage;
- GLenum internalFormat;
-
- switch (target) {
- case ST_TEXTURE_2D:
- target = GL_TEXTURE_2D;
- break;
- case ST_TEXTURE_RECT:
- target = GL_TEXTURE_RECTANGLE_ARB;
- break;
- default:
- return 0;
- }
-
- /* map pipe format to base format for now */
- if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3) > 0)
- internalFormat = GL_RGBA;
- else
- internalFormat = GL_RGB;
-
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- _mesa_lock_texture(ctx, texObj);
-
- stObj = st_texture_object(texObj);
- /* switch to surface based */
- if (!stObj->surface_based) {
- _mesa_clear_texture_object(ctx, texObj);
- stObj->surface_based = GL_TRUE;
- }
-
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
- stImage = st_texture_image(texImage);
-
- _mesa_init_teximage_fields(ctx, target, texImage,
- ps->width, ps->height, 1, 0, internalFormat);
- texImage->TexFormat = st_ChooseTextureFormat(ctx, internalFormat,
- GL_RGBA, GL_UNSIGNED_BYTE);
- _mesa_set_fetch_functions(texImage, 2);
- pipe_resource_reference(&stImage->pt, ps->texture);
-
- _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
- _mesa_unlock_texture(ctx, texObj);
-
- return 1;
-}
-
-
-/**
- * Unbind a pipe surface from a texture object. After the call,
- * the texture object is marked dirty and will be (re-)validated.
- *
- * \param ps pipe surface to be unbound
- * \param target texture target
- * \param level image level
- */
-int
-st_unbind_texture_surface(struct pipe_surface *ps, int target, int level)
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- struct st_texture_object *stObj;
- struct st_texture_image *stImage;
-
- switch (target) {
- case ST_TEXTURE_2D:
- target = GL_TEXTURE_2D;
- break;
- case ST_TEXTURE_RECT:
- target = GL_TEXTURE_RECTANGLE_ARB;
- break;
- default:
- return 0;
- }
-
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
-
- _mesa_lock_texture(ctx, texObj);
-
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
- stObj = st_texture_object(texObj);
- stImage = st_texture_image(texImage);
-
- /* Make sure the pipe surface is still bound. The texture object is still
- * considered surface based even if this is the last bound surface. */
- if (stImage->pt == ps->texture) {
- pipe_resource_reference(&stImage->pt, NULL);
- _mesa_clear_texture_image(ctx, texImage);
-
- _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
- }
-
- _mesa_unlock_texture(ctx, texObj);
-
- return 1;
-}
-
-
-/** Redirect rendering into stfb's surface to a texture image */
-int
-st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex,
- int target, int format, int level)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct st_context *st = ctx->st;
- struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
- const GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- struct st_texture_image *stImage;
- struct st_renderbuffer *strb;
- GLint face = 0, slice = 0;
-
- assert(surfIndex <= ST_SURFACE_DEPTH);
-
- strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
-
- if (strb->texture_save || strb->surface_save) {
- /* Error! */
- return 0;
- }
-
- if (target == ST_TEXTURE_2D) {
- texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX];
- texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, level);
- stImage = st_texture_image(texImage);
- }
- else {
- /* unsupported target */
- return 0;
- }
-
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
- /* save the renderbuffer's surface/texture info */
- pipe_resource_reference(&strb->texture_save, strb->texture);
- pipe_surface_reference(&strb->surface_save, strb->surface);
- pipe_sampler_view_reference(&strb->sampler_view_save, strb->sampler_view);
-
- /* plug in new surface/texture info */
- pipe_resource_reference(&strb->texture, stImage->pt);
-
- /* XXX: Shouldn't we release reference to old surface here?
- */
-
- strb->surface = screen->get_tex_surface(screen, strb->texture,
- face, level, slice,
- (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION));
-
- pipe_sampler_view_reference(&strb->sampler_view, NULL);
-
- st->dirty.st |= ST_NEW_FRAMEBUFFER;
-
- return 1;
-}
-
-
-/** Undo surface-to-texture binding */
-int
-st_release_teximage(struct st_framebuffer *stfb, uint surfIndex,
- int target, int format, int level)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct st_context *st = ctx->st;
- struct st_renderbuffer *strb;
-
- assert(surfIndex <= ST_SURFACE_DEPTH);
-
- strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
-
- if (!strb->texture_save || !strb->surface_save) {
- /* Error! */
- return 0;
- }
-
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
- /* free tex surface, restore original */
- pipe_surface_reference(&strb->surface, strb->surface_save);
- pipe_resource_reference(&strb->texture, strb->texture_save);
- pipe_sampler_view_reference(&strb->sampler_view, strb->sampler_view_save);
-
- pipe_surface_reference(&strb->surface_save, NULL);
- pipe_resource_reference(&strb->texture_save, NULL);
- pipe_sampler_view_reference(&strb->sampler_view, NULL);
-
- st->dirty.st |= ST_NEW_FRAMEBUFFER;
-
- return 1;
-}
-
void
st_teximage_flush_before_map(struct st_context *st,
struct pipe_resource *pt,