mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-12 18:45:33 -10:00
formats: no file I/O - image_texture's path loaders go through streams/
formats/image_texture.c loaded images by path through the data_transfer file adapter. Its four path loaders (image_texture_load, _load_ex, _load_request, _load_request_ex) move to streams/image_texture_file.c, declared in streams/image_texture_file.h, the same split data_transfer, cdfs and the DVD reader got. The names and behaviour are unchanged; callers include the new header. formats/image_texture.c keeps the buffer decoders and makes image_texture_load_buffer_probe public so the adapter can reach it. image_texture_load_set stays in formats/image_texture_set.c: it does no file I/O of its own, and gfx_surface_still tests it against a stubbed load_request. griffin, Makefile.common, the companion test scripts and the sample Makefiles that build the loaders add streams/image_texture_file.c; the overlay task sample, which stubs image loading, does not.
This commit is contained in:
1 parent
1656558977
commit
fd17192acb
42 files changed
+225
-108
No files matched your search
+1
-1
@@ -528,7 +528,7 @@ ifneq ($(HAVE_STRL), 1)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/compat/compat_strl.o
|
||||
endif
|
||||
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/image_texture.o \
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/image_texture.o $(LIBRETRO_COMM_DIR)/streams/image_texture_file.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_scale.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_set.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image/image_yuv_blit.o
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "stb_image.h"
|
||||
#else
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#endif
|
||||
|
||||
#include <libretro.h>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <retro_math.h>
|
||||
#include <compat/strl.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <encodings/utf.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
|
||||
#include <dxgi.h>
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <encodings/utf.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <formats/image_yuv_blit.h>
|
||||
#include "../common/video_import_color.h"
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <encodings/utf.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <formats/image_yuv_blit.h>
|
||||
#include "../common/video_import_color.h"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define CINTERFACE
|
||||
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <gfx/scaler/scaler.h>
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <encodings/utf.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <gfx/scaler/scaler.h>
|
||||
#include <gfx/video_frame.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <formats/image_yuv_blit.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "slang_process.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <retro_atomic.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <formats/image_yuv_blit.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
|
||||
#include "gfx_surface.h"
|
||||
#include "gfx_instrument.h"
|
||||
|
||||
@@ -576,6 +576,7 @@ VIDEO IMAGE
|
||||
============================================================ */
|
||||
|
||||
#include "../libretro-common/formats/image_texture.c"
|
||||
#include "../libretro-common/streams/image_texture_file.c"
|
||||
#include "../libretro-common/formats/image/image_yuv_blit.c"
|
||||
#include "../libretro-common/formats/image_texture_scale.c"
|
||||
#include "../libretro-common/formats/image_texture_set.c"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <boolean.h>
|
||||
#include <formats/image.h>
|
||||
#include <formats/data_transfer.h>
|
||||
#include <streams/data_transfer_file.h>
|
||||
#ifdef HAVE_RPNG
|
||||
#include <formats/rpng.h>
|
||||
#endif
|
||||
@@ -495,7 +494,7 @@ static void image_texture_clear(struct texture_image *img)
|
||||
img->fp16 = false;
|
||||
}
|
||||
|
||||
static bool image_texture_load_buffer_probe(data_transfer_t *keep,
|
||||
bool image_texture_load_buffer_probe(data_transfer_t *keep,
|
||||
bool *kept, struct texture_image *out_img,
|
||||
enum image_type_enum type, const void *ptr, size_t len,
|
||||
const image_texture_request_t *req,
|
||||
@@ -544,56 +543,6 @@ bool image_texture_load_buffer_request(struct texture_image *out_img,
|
||||
should_abort, abort_ud, NULL);
|
||||
}
|
||||
|
||||
bool image_texture_load_request(struct texture_image *out_img,
|
||||
const char *path, const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud)
|
||||
{
|
||||
return image_texture_load_request_ex(out_img, path, req,
|
||||
should_abort, ud, NULL);
|
||||
}
|
||||
|
||||
bool image_texture_load_request_ex(struct texture_image *out_img,
|
||||
const char *path, const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud, int *png_probe)
|
||||
{
|
||||
enum image_type_enum type = image_texture_get_type(path);
|
||||
|
||||
if (png_probe)
|
||||
*png_probe = -1;
|
||||
|
||||
if (type != IMAGE_TYPE_NONE)
|
||||
{
|
||||
/* The synchronous read rides the data_transfer prefix spine
|
||||
* like every other loader: filestream/VFS routing (overlays
|
||||
* and driver assets from archive members or content://
|
||||
* documents), 64-bit lengths, the hardware guard behind the
|
||||
* read, and honest short-read detection. A zero budget fills
|
||||
* to completion in one blocking call, which is this API's
|
||||
* contract. */
|
||||
struct data_transfer *dt = data_transfer_open_prefix(path, 0);
|
||||
if (dt)
|
||||
{
|
||||
size_t file_len = 0;
|
||||
const uint8_t *ptr = NULL;
|
||||
bool kept = false;
|
||||
bool loaded;
|
||||
|
||||
data_transfer_iterate(dt, 0);
|
||||
ptr = data_transfer_ptr(dt, &file_len);
|
||||
loaded = data_transfer_complete(dt) && ptr && file_len
|
||||
&& image_texture_load_buffer_probe(dt, &kept, out_img, type,
|
||||
ptr, file_len, req, should_abort, ud, png_probe);
|
||||
if (!kept)
|
||||
data_transfer_free(dt);
|
||||
if (loaded)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (out_img)
|
||||
image_texture_clear(out_img);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* The request the plain loads carry: the caller's image, whose
|
||||
* ->pix10 asks for 10-bit on the way in */
|
||||
static void image_texture_request_of(const struct texture_image *img,
|
||||
@@ -605,10 +554,6 @@ static void image_texture_request_of(const struct texture_image *img,
|
||||
req->want_compressed = true;
|
||||
}
|
||||
|
||||
bool image_texture_load(struct texture_image *out_img, const char *path)
|
||||
{
|
||||
return image_texture_load_ex(out_img, path, NULL, NULL);
|
||||
}
|
||||
|
||||
void image_texture_free(struct texture_image *img)
|
||||
{
|
||||
@@ -828,11 +773,3 @@ bool image_texture_load_buffer(struct texture_image *out_img,
|
||||
buffer_len, &req, NULL, NULL);
|
||||
}
|
||||
|
||||
bool image_texture_load_ex(struct texture_image *out_img,
|
||||
const char *path, bool (*should_abort)(void *ud), void *ud)
|
||||
{
|
||||
image_texture_request_t req;
|
||||
image_texture_request_of(out_img, &req);
|
||||
return image_texture_load_request(out_img, path, &req,
|
||||
should_abort, ud);
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <boolean.h>
|
||||
#include <formats/image.h>
|
||||
#include <formats/data_transfer.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#ifdef HAVE_GCD
|
||||
#include <dispatch/dispatch.h>
|
||||
#elif defined(HAVE_THREADS)
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
struct data_transfer;
|
||||
|
||||
enum image_process_code
|
||||
{
|
||||
IMAGE_PROCESS_ERROR = -2,
|
||||
@@ -344,24 +346,25 @@ bool image_texture_scale(struct texture_image *img,
|
||||
bool image_texture_load_buffer(struct texture_image *img,
|
||||
enum image_type_enum type, void *s, size_t len);
|
||||
|
||||
/* The loader run to completion over a whole buffer or a file, with
|
||||
* @req naming what the caller takes (NULL: the ordinary image). The
|
||||
* abort hook is asked between steps; it may be NULL. False leaves
|
||||
* @img empty. */
|
||||
/* The loader run to completion over a whole buffer, with @req naming
|
||||
* what the caller takes (NULL: the ordinary image). The abort hook is
|
||||
* asked between steps; it may be NULL. False leaves @img empty. Loading
|
||||
* by path - image_texture_load and the rest - is in
|
||||
* <streams/image_texture_file.h>. */
|
||||
bool image_texture_load_buffer_request(struct texture_image *img,
|
||||
enum image_type_enum type, const void *buf, size_t len,
|
||||
const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud);
|
||||
bool image_texture_load_request(struct texture_image *img,
|
||||
const char *path, const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud);
|
||||
|
||||
/* image_texture_load_request answering, from the bytes it read, whether
|
||||
* the file is an animated PNG: 1 yes, 0 a still, -1 not a PNG or no
|
||||
* decode. Spares a caller that keeps an animation's bytes a second
|
||||
* read of every still to ask. @png_probe may be NULL. */
|
||||
bool image_texture_load_request_ex(struct texture_image *img,
|
||||
const char *path, const image_texture_request_t *req,
|
||||
/* image_texture_load_buffer_request over bytes @keep, a data_transfer,
|
||||
* holds: an image that can go on reading them (a compressed texture)
|
||||
* takes @keep, frees it with itself and sets *@kept; *@png_probe, where
|
||||
* not NULL, says whether the bytes are an animated PNG - 1 yes, 0 a
|
||||
* still, -1 not a PNG or no decode. @keep and @kept may be NULL. */
|
||||
bool image_texture_load_buffer_probe(struct data_transfer *keep,
|
||||
bool *kept, struct texture_image *img,
|
||||
enum image_type_enum type, const void *buf, size_t len,
|
||||
const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud, int *png_probe);
|
||||
|
||||
/* Run @fn for every index below @n, across the cores at once where
|
||||
@@ -382,27 +385,14 @@ void image_texture_set_run_ex(unsigned n,
|
||||
void (*thread_done)(void));
|
||||
|
||||
/* Decode the @n files @paths name into @imgs together, each as
|
||||
* image_texture_load_request does with @req; a path that is NULL,
|
||||
* empty or unreadable leaves its image empty. Returns how many
|
||||
* decoded. In formats/image_texture_set.c. */
|
||||
* image_texture_load_request (<streams/image_texture_file.h>) does with
|
||||
* @req; a path that is NULL, empty or unreadable leaves its image
|
||||
* empty. Returns how many decoded. In formats/image_texture_set.c. */
|
||||
unsigned image_texture_load_set(const char *const *paths,
|
||||
struct texture_image *imgs, unsigned n,
|
||||
const image_texture_request_t *req);
|
||||
|
||||
/* ->pix10 is an ask on the way in and an answer on the way out: set
|
||||
* it before the call to have a decoder that can emit XRGB2101010 do
|
||||
* so, and read it after to find out whether it did. Clear on entry
|
||||
* means the ordinary 8-bit image, as before. */
|
||||
bool image_texture_load(struct texture_image *img, const char *path);
|
||||
|
||||
/* image_texture_load with an abort hook: both decode stages are
|
||||
* incremental (one chunk / one pass per step) and @should_abort is
|
||||
* asked between steps; returning true abandons the decode, which then
|
||||
* fails cleanly. For decodes on worker threads that must stop promptly
|
||||
* at shutdown or when their result is no longer wanted. @should_abort
|
||||
* may be NULL. */
|
||||
bool image_texture_load_ex(struct texture_image *img, const char *path,
|
||||
bool (*should_abort)(void *ud), void *ud);
|
||||
void image_texture_free(struct texture_image *img);
|
||||
|
||||
/* Force a CPU decode of a compressed texture_image into ->pixels (RGBA8).
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2010-2026 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (image_texture_file.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LIBRETRO_SDK_STREAMS_IMAGE_TEXTURE_FILE_H__
|
||||
#define __LIBRETRO_SDK_STREAMS_IMAGE_TEXTURE_FILE_H__
|
||||
|
||||
#include <retro_common_api.h>
|
||||
#include <boolean.h>
|
||||
#include <formats/image.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
/* Images loaded by path: the file read whole through
|
||||
* data_transfer_open_prefix - filestream/VFS routing, so overlays and
|
||||
* driver assets from archive members or content:// documents load like
|
||||
* any other, 64-bit lengths, honest short reads - and decoded by
|
||||
* image_texture_load_buffer_probe. */
|
||||
|
||||
/* ->pix10 is an ask on the way in and an answer on the way out: set
|
||||
* it before the call to have a decoder that can emit XRGB2101010 do
|
||||
* so, and read it after to find out whether it did. Clear on entry
|
||||
* means the ordinary 8-bit image, as before. */
|
||||
bool image_texture_load(struct texture_image *img, const char *path);
|
||||
|
||||
/* image_texture_load with an abort hook: both decode stages are
|
||||
* incremental (one chunk / one pass per step) and @should_abort is
|
||||
* asked between steps; returning true abandons the decode, which then
|
||||
* fails cleanly. For decodes on worker threads that must stop promptly
|
||||
* at shutdown or when their result is no longer wanted. @should_abort
|
||||
* may be NULL. */
|
||||
bool image_texture_load_ex(struct texture_image *img, const char *path,
|
||||
bool (*should_abort)(void *ud), void *ud);
|
||||
|
||||
bool image_texture_load_request(struct texture_image *img,
|
||||
const char *path, const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud);
|
||||
|
||||
/* image_texture_load_request answering, from the bytes it read, whether
|
||||
* the file is an animated PNG: 1 yes, 0 a still, -1 not a PNG or no
|
||||
* decode. Spares a caller that keeps an animation's bytes a second
|
||||
* read of every still to ask. @png_probe may be NULL. */
|
||||
bool image_texture_load_request_ex(struct texture_image *img,
|
||||
const char *path, const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud, int *png_probe);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -20,7 +20,7 @@ SOURCES := image_loader_test.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/data_transfer.c $(LIBRETRO_COMM_DIR)/streams/data_transfer_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/dds/rdds.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_scale.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_set.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_transfer.c \
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <boolean.h>
|
||||
#include <encodings/crc32.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
|
||||
#define W 24
|
||||
#define H 16
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/* Copyright (C) 2010-2026 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (image_texture_file.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/* The path side of image loading: formats/image_texture.c decodes the
|
||||
* bytes it is given, and this reads them from the file. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <formats/image.h>
|
||||
#include <formats/data_transfer.h>
|
||||
#include <streams/data_transfer_file.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
|
||||
bool image_texture_load_request(struct texture_image *out_img,
|
||||
const char *path, const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud)
|
||||
{
|
||||
return image_texture_load_request_ex(out_img, path, req,
|
||||
should_abort, ud, NULL);
|
||||
}
|
||||
|
||||
bool image_texture_load_request_ex(struct texture_image *out_img,
|
||||
const char *path, const image_texture_request_t *req,
|
||||
bool (*should_abort)(void *ud), void *ud, int *png_probe)
|
||||
{
|
||||
enum image_type_enum type = image_texture_get_type(path);
|
||||
|
||||
if (png_probe)
|
||||
*png_probe = -1;
|
||||
|
||||
if (type != IMAGE_TYPE_NONE)
|
||||
{
|
||||
/* A zero budget fills to completion in one blocking call, which
|
||||
* is this API's contract */
|
||||
struct data_transfer *dt = data_transfer_open_prefix(path, 0);
|
||||
if (dt)
|
||||
{
|
||||
size_t file_len = 0;
|
||||
const uint8_t *ptr = NULL;
|
||||
bool kept = false;
|
||||
bool loaded;
|
||||
|
||||
data_transfer_iterate(dt, 0);
|
||||
ptr = data_transfer_ptr(dt, &file_len);
|
||||
loaded = data_transfer_complete(dt) && ptr && file_len
|
||||
&& image_texture_load_buffer_probe(dt, &kept, out_img, type,
|
||||
ptr, file_len, req, should_abort, ud, png_probe);
|
||||
if (!kept)
|
||||
data_transfer_free(dt);
|
||||
if (loaded)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/* nothing to decode leaves the image empty */
|
||||
if (out_img)
|
||||
image_texture_load_buffer_probe(NULL, NULL, out_img, type, NULL, 0,
|
||||
req, NULL, NULL, NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool image_texture_load_ex(struct texture_image *out_img,
|
||||
const char *path, bool (*should_abort)(void *ud), void *ud)
|
||||
{
|
||||
image_texture_request_t req;
|
||||
req.rgba = out_img->supports_rgba;
|
||||
req.want_10bit = out_img->pix10;
|
||||
req.want_fp16 = false;
|
||||
req.want_compressed = true;
|
||||
return image_texture_load_request(out_img, path, &req,
|
||||
should_abort, ud);
|
||||
}
|
||||
|
||||
bool image_texture_load(struct texture_image *out_img, const char *path)
|
||||
{
|
||||
return image_texture_load_ex(out_img, path, NULL, NULL);
|
||||
}
|
||||
@@ -13,7 +13,7 @@ SOURCES := image_avail_test.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/png/rpng_apng.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/jpeg/rjpeg.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_transfer.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image/image_hdr_blit.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/data_transfer.c $(LIBRETRO_COMM_DIR)/streams/data_transfer_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/encodings/encoding_deflate.c \
|
||||
|
||||
@@ -16,7 +16,7 @@ SOURCES := video_hdr_fp16_test.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/data_transfer.c $(LIBRETRO_COMM_DIR)/streams/data_transfer_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_transfer.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image/image_hdr_blit.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image/image_blit_bands.c \
|
||||
|
||||
@@ -42,7 +42,7 @@ SOURCES := gfx_thumbnail_anim_test.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/data_transfer.c $(LIBRETRO_COMM_DIR)/streams/data_transfer_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image/image_yuv_blit.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_set.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_transfer.c \
|
||||
|
||||
@@ -58,7 +58,7 @@ SOURCES := gfx_thumbnail_preview_test.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/audio_transfer.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/data_transfer.c $(LIBRETRO_COMM_DIR)/streams/data_transfer_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image/image_yuv_blit.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_set.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_transfer.c \
|
||||
@@ -168,7 +168,7 @@ ANIM_WINDOW_SOURCES := preview_anim_window_test.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/data_transfer.c $(LIBRETRO_COMM_DIR)/streams/data_transfer_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_transfer.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/png/rpng.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/png/rpng_apng.c \
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "../../../gfx/drivers_shader/shader_glsl.h"
|
||||
#include "../../../menu/menu_driver.h"
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <glsym/glsym.h>
|
||||
|
||||
void RARCH_LOG(const char *fmt, ...) { va_list ap; va_start(ap, fmt); printf(" [log] "); vprintf(fmt, ap); va_end(ap); }
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "../../../gfx/drivers_shader/shader_glsl.h"
|
||||
#include "../../../menu/menu_driver.h"
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <glsym/glsym.h>
|
||||
|
||||
void RARCH_LOG(const char *fmt, ...) { va_list ap; va_start(ap, fmt); printf(" [log] "); vprintf(fmt, ap); va_end(ap); }
|
||||
|
||||
@@ -23,7 +23,7 @@ SOURCES := \
|
||||
$(LIBRETRO_COMM_DIR)/features/features_cpu.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_set.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/png/rpng.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/png/rpng_apng.c \
|
||||
|
||||
@@ -17,7 +17,7 @@ SOURCES := \
|
||||
$(REPO_ROOT)/gfx/gfx_surface_player.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/video_player.c \
|
||||
$(REPO_ROOT)/libretro-common/formats/image/image_yuv_blit.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_set.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_transfer.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/dds/rdds.c \
|
||||
|
||||
@@ -33,7 +33,7 @@ SOURCES := image_decode_slice_test.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/data_transfer.c $(LIBRETRO_COMM_DIR)/streams/data_transfer_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture.c $(LIBRETRO_COMM_DIR)/streams/image_texture_file.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_scale.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_texture_set.c \
|
||||
$(LIBRETRO_COMM_DIR)/formats/image_transfer.c \
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <boolean.h>
|
||||
#include <retro_atomic.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <features/features_cpu.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
#include <formats/data_transfer.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <features/features_cpu.h>
|
||||
#include <queues/task_queue.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
@@ -73,7 +73,7 @@ CSRCS="ui/companion/companion_core.c \
|
||||
ui/companion/test/companion_core_stubs.c \
|
||||
ui/companion/test/companion_core_test.c \
|
||||
playlist.c core_option_manager.c $LC/lists/nested_list.c $LC/file/config_file_io.c \
|
||||
$LC/formats/json/rjson.c $LC/formats/image_texture.c $LC/formats/image_transfer.c \
|
||||
$LC/formats/json/rjson.c $LC/formats/image_texture.c $LC/streams/image_texture_file.c $LC/formats/image_transfer.c \
|
||||
$LC/formats/video_player.c \
|
||||
$LC/formats/data_transfer.c $LC/streams/data_transfer_file.c $LC/formats/png/rpng.c $LC/formats/png/rpng_apng.c \
|
||||
$LC/formats/png/rpng_encode.c $LC/file/rpng_file.c $LC/formats/tga/rtga.c $LC/memmap/memmap.c $LC/memory/mem_stats.c \
|
||||
|
||||
@@ -25,7 +25,7 @@ CSRCS="ui/companion/companion_core.c \
|
||||
ui/companion/test/companion_core_stubs.c \
|
||||
ui/companion/test/companion_core_test.c \
|
||||
playlist.c core_option_manager.c $LC/lists/nested_list.c $LC/file/config_file_io.c \
|
||||
$LC/formats/json/rjson.c $LC/formats/image_texture.c $LC/formats/image_transfer.c \
|
||||
$LC/formats/json/rjson.c $LC/formats/image_texture.c $LC/streams/image_texture_file.c $LC/formats/image_transfer.c \
|
||||
$LC/formats/video_player.c \
|
||||
$LC/formats/data_transfer.c $LC/streams/data_transfer_file.c $LC/formats/png/rpng.c $LC/formats/png/rpng_apng.c \
|
||||
$LC/formats/png/rpng_encode.c $LC/file/rpng_file.c $LC/formats/tga/rtga.c $LC/memmap/memmap.c $LC/memory/mem_stats.c \
|
||||
|
||||
@@ -38,7 +38,7 @@ SRCS="ui/companion/companion_core.c \
|
||||
core_option_manager.c \
|
||||
$LC/lists/nested_list.c \
|
||||
$LC/formats/json/rjson.c \
|
||||
$LC/formats/image_texture.c \
|
||||
$LC/formats/image_texture.c $LC/streams/image_texture_file.c \
|
||||
$LC/formats/image_transfer.c \
|
||||
$LC/formats/video_player.c \
|
||||
$LC/formats/data_transfer.c $LC/streams/data_transfer_file.c \
|
||||
|
||||
@@ -38,7 +38,7 @@ SRCS="ui/companion/companion_thumbs.c \
|
||||
$LC/formats/image/image_blit_bands.c \
|
||||
$LC/memory/mem_stats.c \
|
||||
ui/companion/test/companion_thumbs_test.c \
|
||||
$LC/formats/image_texture.c \
|
||||
$LC/formats/image_texture.c $LC/streams/image_texture_file.c \
|
||||
$LC/formats/image_transfer.c \
|
||||
$LC/formats/video_player.c \
|
||||
$LC/formats/data_transfer.c $LC/streams/data_transfer_file.c \
|
||||
|
||||
@@ -34,7 +34,7 @@ CSRCS="ui/companion/companion_core.c \
|
||||
ui/companion/test/companion_core_stubs.c \
|
||||
ui/companion/test/companion_core_test.c \
|
||||
playlist.c core_option_manager.c $LC/lists/nested_list.c $LC/file/config_file_io.c \
|
||||
$LC/formats/json/rjson.c $LC/formats/image_texture.c $LC/formats/image_transfer.c \
|
||||
$LC/formats/json/rjson.c $LC/formats/image_texture.c $LC/streams/image_texture_file.c $LC/formats/image_transfer.c \
|
||||
$LC/formats/video_player.c \
|
||||
$LC/formats/data_transfer.c $LC/streams/data_transfer_file.c $LC/formats/png/rpng.c $LC/formats/png/rpng_apng.c \
|
||||
$LC/formats/png/rpng_encode.c $LC/file/rpng_file.c $LC/formats/tga/rtga.c $LC/memmap/memmap.c $LC/memory/mem_stats.c \
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <file/archive_file.h>
|
||||
#include <file/file_path.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <formats/data_transfer.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <time.h> /* struct timespec, for retro_timers.h */
|
||||
|
||||
@@ -122,6 +122,7 @@ static void writef(const char *path, const char *text)
|
||||
}
|
||||
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
static void write_tga_rgba(const char *path, unsigned w, unsigned h, uint32_t argb)
|
||||
{
|
||||
FILE *f = fopen(path, "wb");
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include <features/features_cpu.h>
|
||||
#include <file/file_path.h>
|
||||
#include <formats/image.h>
|
||||
#include <streams/image_texture_file.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <compat/msvc.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
Reference in new issue
Block a user