1
0
Fork 0

cogl: Remove unused Texture2DSliced.new_from_data

Nothing uses it and can be re-implemented externally if needed anyways.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3806>
This commit is contained in:
Bilal Elmoussaoui 2024-06-14 11:29:29 +02:00
parent 4f896e55d6
commit 4eb555a2f0
2 changed files with 0 additions and 104 deletions

View file

@ -1270,45 +1270,3 @@ cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
loader); loader);
} }
CoglTexture *
cogl_texture_2d_sliced_new_from_data (CoglContext *ctx,
int width,
int height,
int max_waste,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
GError **error)
{
CoglBitmap *bmp;
CoglTexture *tex_2ds;
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (cogl_pixel_format_get_n_planes (format) == 1, NULL);
g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */
if (rowstride == 0)
rowstride = width * cogl_pixel_format_get_bytes_per_pixel (format, 0);
/* Wrap the data into a bitmap */
bmp = cogl_bitmap_new_for_data (ctx,
width, height,
format,
rowstride,
(uint8_t *) data);
tex_2ds = cogl_texture_2d_sliced_new_from_bitmap (bmp, max_waste);
g_object_unref (bmp);
if (tex_2ds &&
!cogl_texture_allocate (COGL_TEXTURE (tex_2ds), error))
{
g_object_unref (tex_2ds);
return NULL;
}
return tex_2ds;
}

View file

@ -126,68 +126,6 @@ cogl_texture_2d_sliced_new_with_size (CoglContext *ctx,
int height, int height,
int max_waste); int max_waste);
/**
* cogl_texture_2d_sliced_new_from_data:
* @ctx: A #CoglContext
* @width: width of texture in pixels
* @height: height of texture in pixels
* @format: the #CoglPixelFormat the buffer is stored in in RAM
* @max_waste: The threshold of how wide a strip of wasted texels
* are allowed along the right and bottom textures before
* they must be sliced to reduce the amount of waste. A
* negative can be passed to disable slicing.
* @rowstride: the memory offset in bytes between the start of each
* row in @data. A value of 0 will make Cogl automatically
* calculate @rowstride from @width and @format.
* @data: (array): pointer the memory region where the source buffer resides
* @error: A #GError to catch exceptional errors or %NULL
*
* Creates a new #CoglTexture2DSliced texture based on data residing
* in memory.
*
* A #CoglTexture2DSliced may internally be comprised of 1 or more
* #CoglTexture2D textures depending on GPU limitations. For example
* if the GPU only supports power-of-two sized textures then a sliced
* texture will turn a non-power-of-two size into a combination of
* smaller power-of-two sized textures. If the requested texture size
* is larger than is supported by the hardware then the texture will
* be sliced into smaller textures that can be accessed by the
* hardware.
*
* @max_waste is used as a threshold for recursively slicing the
* right-most or bottom-most slices into smaller sizes until the
* wasted padding at the bottom and right of the textures is less than
* specified. A negative @max_waste will disable slicing.
*
* This api will always immediately allocate GPU memory for all
* the required texture slices and upload the given data so that the
* @data pointer does not need to remain valid once this function
* returns. This means it is not possible to configure the texture
* before it is allocated. If you do need to configure the texture
* before allocation (to specify constraints on the internal format
* for example) then you can instead create a #CoglBitmap for your
* data and use cogl_texture_2d_sliced_new_from_bitmap() or use
* cogl_texture_2d_sliced_new_with_size() and then upload data using
* cogl_texture_set_data()
*
* It's possible for the allocation of a sliced texture to fail
* due to impossible slicing constraints if a negative @max_waste
* value is given. If the given virtual texture size is larger than is
* supported by the hardware but slicing is disabled the texture size
* would be too large to handle.
*
* Return value: (transfer full): A newly created #CoglTexture2DSliced
* or %NULL on failure and @error will be updated.
*/
COGL_EXPORT CoglTexture *
cogl_texture_2d_sliced_new_from_data (CoglContext *ctx,
int width,
int height,
int max_waste,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
GError **error);
/** /**
* cogl_texture_2d_sliced_new_from_bitmap: * cogl_texture_2d_sliced_new_from_bitmap: