Mesa (i965g-restart): i965g: add some missing texture creation code

Keith Whitwell keithw at kemper.freedesktop.org
Wed Nov 4 21:38:36 UTC 2009


Module: Mesa
Branch: i965g-restart
Commit: 99394a737a46999a2fc08915e9f1408246109c4a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=99394a737a46999a2fc08915e9f1408246109c4a

Author: Keith Whitwell <keithw at vmware.com>
Date:   Wed Nov  4 16:42:44 2009 +0000

i965g: add some missing texture creation code

---

 src/gallium/drivers/i965/brw_context.c        |    1 +
 src/gallium/drivers/i965/brw_screen_texture.c |   32 ++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/i965/brw_context.c b/src/gallium/drivers/i965/brw_context.c
index 30cc243..0692412 100644
--- a/src/gallium/drivers/i965/brw_context.c
+++ b/src/gallium/drivers/i965/brw_context.c
@@ -107,6 +107,7 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen)
    //ctx->Shader.EmitCondCodes = GL_TRUE;
    //ctx->Shader.EmitNVTempInitialization = GL_TRUE;
 
+   brw->base.screen = screen;
    brw->base.destroy = brw_destroy_context;
 
    brw_pipe_blend_init( brw );
diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c
index 48b3451..fe3e57d 100644
--- a/src/gallium/drivers/i965/brw_screen_texture.c
+++ b/src/gallium/drivers/i965/brw_screen_texture.c
@@ -30,6 +30,7 @@
   */
 
 #include "util/u_memory.h"
+#include "util/u_simple_list.h"
 
 #include "brw_screen.h"
 #include "brw_defines.h"
@@ -190,8 +191,18 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
    if (tex == NULL)
       return NULL;
 
+   memcpy(&tex->base, templ, sizeof *templ);
+   pipe_reference_init(&tex->base.reference, 1);
+   tex->base.screen = screen;
+
+   /* XXX: compressed textures need special treatment here
+    */
+   tex->cpp = pf_get_size(tex->base.format);
    tex->compressed = pf_is_compressed(tex->base.format);
 
+   make_empty_list(&tex->views[0]);
+   make_empty_list(&tex->views[1]);
+
    /* XXX: No tiling with compressed textures??
     */
    if (tex->compressed == 0 
@@ -209,11 +220,30 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
    }
 
 
-   memcpy(&tex->base, templ, sizeof *templ);
+
 
    if (!brw_texture_layout( bscreen, tex ))
       goto fail;
 
+   
+   if (templ->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
+   } 
+   else if (templ->tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+                            PIPE_TEXTURE_USAGE_PRIMARY)) {
+   }
+   else if (templ->tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
+   }
+   else if (templ->tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) {
+   }
+   
+   if (templ->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC) {
+   }
+
+   tex->bo = bscreen->sws->bo_alloc( bscreen->sws,
+                                     BRW_USAGE_SAMPLER,
+                                     tex->pitch * tex->total_height * tex->cpp,
+                                     64 );
+
    tex->ss.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
    tex->ss.ss0.surface_type = translate_tex_target(tex->base.target);
    tex->ss.ss0.surface_format = translate_tex_format(tex->base.format);




More information about the mesa-commit mailing list