[Mesa-dev] [PATCH 21/22] no-SetTextureStorageForBufferObject

Chris Wilson chris at chris-wilson.co.uk
Sat Aug 5 09:40:13 UTC 2017


---
 src/mesa/drivers/dri/i965/intel_tex.c | 63 -----------------------------------
 src/mesa/main/dd.h                    | 16 ---------
 2 files changed, 79 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c
index 7ce2ceb9a2..b04ccd3d57 100644
--- a/src/mesa/drivers/dri/i965/intel_tex.c
+++ b/src/mesa/drivers/dri/i965/intel_tex.c
@@ -302,67 +302,6 @@ intel_texture_view(struct gl_context *ctx,
    return GL_TRUE;
 }
 
-static bool
-intel_set_texture_storage_for_buffer_object(struct gl_context *ctx,
-                                            struct gl_texture_object *tex_obj,
-                                            struct gl_buffer_object *buffer_obj,
-                                            uint32_t buffer_offset,
-                                            uint32_t row_stride,
-                                            bool read_only)
-{
-   struct brw_context *brw = brw_context(ctx);
-   struct intel_texture_object *intel_texobj = intel_texture_object(tex_obj);
-   struct gl_texture_image *image = tex_obj->Image[0][0];
-   struct intel_texture_image *intel_image = intel_texture_image(image);
-   struct intel_buffer_object *intel_buffer_obj = intel_buffer_object(buffer_obj);
-
-   if (!read_only) {
-      /* Renderbuffers have the restriction that the buffer offset and
-       * surface pitch must be a multiple of the element size.  If it's
-       * not, we have to fail and fall back to software.
-       */
-      int cpp = _mesa_get_format_bytes(image->TexFormat);
-      if (buffer_offset % cpp || row_stride % cpp) {
-         perf_debug("Bad PBO alignment; fallback to CPU mapping\n");
-         return false;
-      }
-
-      if (!brw->mesa_format_supports_render[image->TexFormat]) {
-         perf_debug("Non-renderable PBO format; fallback to CPU mapping\n");
-         return false;
-      }
-   }
-
-   assert(intel_texobj->mt == NULL);
-
-   struct brw_bo *bo = intel_bufferobj_buffer(brw, intel_buffer_obj,
-                                             buffer_offset,
-                                             row_stride * image->Height,
-                                             !read_only);
-   intel_texobj->mt =
-      intel_miptree_create_for_bo(brw, bo,
-                                  image->TexFormat,
-                                  buffer_offset,
-                                  image->Width, image->Height, image->Depth,
-                                  row_stride,
-                                  0);
-   if (!intel_texobj->mt)
-      return false;
-
-   if (!_swrast_init_texture_image(image))
-      return false;
-
-   intel_miptree_reference(&intel_image->mt, intel_texobj->mt);
-
-   /* The miptree is in a validated state, so no need to check later. */
-   intel_texobj->needs_validate = false;
-   intel_texobj->validated_first_level = 0;
-   intel_texobj->validated_last_level = 0;
-   intel_texobj->_Format = intel_texobj->mt->format;
-
-   return true;
-}
-
 static void
 intel_texture_barrier(struct gl_context *ctx)
 {
@@ -394,7 +333,5 @@ intelInitTextureFuncs(struct dd_function_table *functions)
    functions->MapTextureImage = intel_map_texture_image;
    functions->UnmapTextureImage = intel_unmap_texture_image;
    functions->TextureView = intel_texture_view;
-   functions->SetTextureStorageForBufferObject =
-      intel_set_texture_storage_for_buffer_object;
    functions->TextureBarrier = intel_texture_barrier;
 }
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 462829d755..a65a94c3ba 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -426,22 +426,6 @@ struct dd_function_table {
                             struct gl_texture_object *texObj,
                             struct gl_texture_object *origTexObj);
 
-   /** Sets the given buffer object as the texture's storage.  The given
-    * texture must have target GL_TEXTURE_1D, GL_TEXTURE_2D,
-    * GL_TEXTURE_RECTANGLE, and GL_TEXTURE_2D_ARRAY; have only a single
-    * mipmap level; be immutable; and must not have any assigned storage.
-    * The format and dimensions of the gl_texture_object will already be
-    * initialized.
-    *
-    * This function is used by the meta PBO texture upload path.
-    */
-   bool (*SetTextureStorageForBufferObject)(struct gl_context *ctx,
-                                            struct gl_texture_object *texObj,
-                                            struct gl_buffer_object *bufferObj,
-                                            uint32_t buffer_offset,
-                                            uint32_t row_stride,
-                                            bool read_only);
-
    /**
     * Map a renderbuffer into user space.
     * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
-- 
2.13.3



More information about the mesa-dev mailing list