Skip to content

Commit

Permalink
Merge pull request #813 from libretro/master
Browse files Browse the repository at this point in the history
[pull] master from libretro:master
  • Loading branch information
pull[bot] committed Feb 22, 2023
2 parents 6221c50 + c0ccb8c commit 7a167fc
Show file tree
Hide file tree
Showing 18 changed files with 196 additions and 193 deletions.
2 changes: 1 addition & 1 deletion Makefile.psl1ght
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ LIBDIRS += -L. -L$(PORTLIBS)/lib
MACHDEP := -D__PSL1GHT__ -D__PS3__ -mcpu=cell
CFLAGS += -Wall $(MACHDEP) $(INCLUDE)
LDFLAGS := $(MACHDEP)
LIBS := -lretro_psl1ght -laudio -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 -lnet -lnetctl -lsysfs -lfreetype -lcamera -lgem -lspurs
LIBS := -lretro_psl1ght -lrt -laudio -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 -lnet -lnetctl -lsysfs -lfreetype -lcamera -lgem -lspurs

# system platform
system_platform = unix
Expand Down
4 changes: 2 additions & 2 deletions frontend/drivers/platform_ps3.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,14 @@ static void frontend_ps3_process_args(int *argc, char *argv[])
static size_t frontend_ps3_get_mem_total(void)
{
sys_memory_info_t mem_info;
sys_memory_get_user_memory_size(&mem_info);
sys_memory_get_user_memory_size((u64)&mem_info);
return mem_info.total;
}

static size_t frontend_ps3_get_mem_used(void)
{
sys_memory_info_t mem_info;
sys_memory_get_user_memory_size(&mem_info);
sys_memory_get_user_memory_size((u64)&mem_info);
return mem_info.avail;
}
#endif
Expand Down
79 changes: 35 additions & 44 deletions gfx/common/egl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,9 @@ bool egl_init_dll(void)
{
#if defined(HAVE_DYLIB) && defined(HAVE_DYNAMIC_EGL)
static dylib_t egl_dll;

if (!egl_dll)
{
egl_dll = dylib_load("libEGL.dll");
if (egl_dll)
if ((egl_dll = dylib_load("libEGL.dll")))
{
/* Setup function callbacks once */
_egl_query_surface = (PFN_EGL_QUERY_SURFACE)dylib_proc(
Expand Down Expand Up @@ -329,9 +327,9 @@ void egl_bind_hw_render(egl_ctx_data_t *egl, bool enable)
void egl_swap_buffers(void *data)
{
egl_ctx_data_t *egl = (egl_ctx_data_t*)data;
if ( egl &&
egl->dpy != EGL_NO_DISPLAY &&
egl->surf != EGL_NO_SURFACE
if ( (egl)
&& (egl->dpy != EGL_NO_DISPLAY)
&& (egl->surf != EGL_NO_SURFACE)
)
_egl_swap_buffers(egl->dpy, egl->surf);
}
Expand All @@ -344,7 +342,7 @@ void egl_set_swap_interval(egl_ctx_data_t *egl, int interval)
*/
egl->interval = interval;

if (egl->dpy == EGL_NO_DISPLAY)
if (egl->dpy == EGL_NO_DISPLAY)
return;
if (!_egl_get_current_context())
return;
Expand Down Expand Up @@ -372,51 +370,54 @@ void egl_get_video_size(egl_ctx_data_t *egl, unsigned *width, unsigned *height)
}
}

#if defined(EGL_VERSION_1_5)
static bool check_egl_version(int min_major_version, int min_minor_version)
{
int major, minor;
const char *str = _egl_query_string(EGL_NO_DISPLAY, EGL_VERSION);

if (!str)
return false;

if (sscanf(str, "%d.%d", &major, &minor) != 2)
return false;

if (major < min_major_version)
return false;

if (major > min_major_version)
return true;

if (minor >= min_minor_version)
return true;
if (str)
{
int major, minor;
if (sscanf(str, "%d.%d", &major, &minor) == 2)
{
if (major >= min_major_version)
{
if (major > min_major_version)
return true;
else if (minor >= min_minor_version)
return true;
}
}
}

return false;
}
#endif

#if defined(EGL_EXT_platform_base)
static bool check_egl_client_extension(const char *name, size_t name_len)
{
const char *str = _egl_query_string(EGL_NO_DISPLAY, EGL_EXTENSIONS);

/* The EGL implementation doesn't support client extensions at all. */
if (!str)
return false;

while (*str != '\0')
if (str)
{
/* Use strspn and strcspn to find the start position and length of each
* token in the extension string. Using strtok could also work, but
* that would require allocating a copy of the string. */
size_t len = strcspn(str, " ");
if (len == name_len && strncmp(str, name, name_len) == 0)
return true;
str += len;
str += strspn(str, " ");
while (*str != '\0')
{
/* Use strspn and strcspn to find the start position and length of each
* token in the extension string. Using strtok could also work, but
* that would require allocating a copy of the string. */
size_t len = strcspn(str, " ");
if (len == name_len && strncmp(str, name, name_len) == 0)
return true;
str += len;
str += strspn(str, " ");
}
}

return false;
}
#endif

static EGLDisplay get_egl_display(EGLenum platform, void *native)
{
Expand Down Expand Up @@ -623,13 +624,3 @@ bool egl_create_surface(egl_ctx_data_t *egl, void *native_window)

return true;
}

bool egl_has_config(egl_ctx_data_t *egl)
{
if (!egl->config)
{
RARCH_ERR("[EGL]: No EGL configurations available.\n");
return false;
}
return true;
}
4 changes: 2 additions & 2 deletions gfx/common/egl_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ extern bool g_egl_inited;
extern unsigned g_egl_major;
extern unsigned g_egl_minor;

void egl_report_error(void);

void egl_destroy(egl_ctx_data_t *egl);

gfx_ctx_proc_t egl_get_proc_address(const char *symbol);
Expand Down Expand Up @@ -123,6 +121,8 @@ bool egl_get_native_visual_id(egl_ctx_data_t *egl, EGLint *value);
bool egl_get_config_attrib(EGLDisplay dpy, EGLConfig config,
EGLint attribute, EGLint *value);

void egl_report_error(void);

bool egl_has_config(egl_ctx_data_t *egl);

RETRO_END_DECLS
Expand Down
3 changes: 3 additions & 0 deletions gfx/common/rsx_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#define RSX_MAX_TEXTURE_VERTICES 4096 // Set > 0 for preallocated texture vertices
#define RSX_MAX_FONT_VERTICES 8192

#define RSX_SHADER_STOCK_BLEND (RSX_MAX_SHADERS - 1)
#define RSX_SHADER_MENU (RSX_MAX_SHADERS - 2)

/* Shader objects */
extern const u8 modern_opaque_vpo_end[];
extern const u8 modern_opaque_vpo[];
Expand Down
13 changes: 7 additions & 6 deletions gfx/common/vulkan_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
enum vk_texture_type type)
{
unsigned i;
uint32_t buffer_width;
struct vk_texture tex;
VkFormat remap_tex_fmt;
VkMemoryRequirements mem_reqs;
VkSubresourceLayout layout;
VkDevice device = vk->context->device;
Expand All @@ -432,7 +434,6 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
VkCommandBufferAllocateInfo cmd_info = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO };
VkSubmitInfo submit_info = { VK_STRUCTURE_TYPE_SUBMIT_INFO };
VkCommandBufferBeginInfo begin_info = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
uint32_t buffer_width;

memset(&tex, 0, sizeof(tex));

Expand All @@ -452,19 +453,19 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
buffer_info.size = buffer_width * height;
buffer_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;

remap_tex_fmt = vulkan_remap_to_texture_format(format);

/* Compatibility concern. Some Apple hardware does not support rgb565.
* Use compute shader uploads instead.
* If we attempt to use streamed texture, force staging path.
* If we're creating fallback dynamic texture, force RGBA8888. */
if (vulkan_remap_to_texture_format(format) != format)
if (remap_tex_fmt != format)
{
if (type == VULKAN_TEXTURE_STREAMED)
{
type = VULKAN_TEXTURE_STAGING;
}
type = VULKAN_TEXTURE_STAGING;
else if (type == VULKAN_TEXTURE_DYNAMIC)
{
format = vulkan_remap_to_texture_format(format);
format = remap_tex_fmt;
info.format = format;
info.usage |= VK_IMAGE_USAGE_STORAGE_BIT;
}
Expand Down
7 changes: 3 additions & 4 deletions gfx/common/vulkan_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#endif

#include <lists/string_list.h>

#include <retro_inline.h>

#define VULKAN_DESCRIPTOR_MANAGER_BLOCK_SETS 16
#define VULKAN_MAX_DESCRIPTOR_POOL_SIZES 16
Expand Down Expand Up @@ -745,12 +745,11 @@ void vulkan_set_uniform_buffer(
void vulkan_debug_mark_image(VkDevice device, VkImage image);
void vulkan_debug_mark_memory(VkDevice device, VkDeviceMemory memory);

static inline VkFormat vulkan_remap_to_texture_format(VkFormat fmt)
static INLINE VkFormat vulkan_remap_to_texture_format(VkFormat fmt)
{
if (fmt == VK_FORMAT_R5G6B5_UNORM_PACK16)
return VK_FORMAT_R8G8B8A8_UNORM;
else
return fmt;
return fmt;
}

RETRO_END_DECLS
Expand Down
2 changes: 2 additions & 0 deletions gfx/drivers/metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ - (instancetype)initWithVideo:(const video_info_t *)video

[apple_platform setVideoMode:mode];

#ifdef HAVE_COCOATOUCH
[self mtkView:view drawableSizeWillChange:CGSizeMake(mode.width, mode.height)];
#endif

*input = NULL;
*inputData = NULL;
Expand Down
Loading

0 comments on commit 7a167fc

Please sign in to comment.