mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
(Gfx) Cleanups
This commit is contained in:
parent
35402884e5
commit
43c8f282db
@ -293,8 +293,8 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
|
||||
{
|
||||
/* Try to recreate the device completely. */
|
||||
#ifndef _XBOX
|
||||
HRESULT res = d3d->dev->TestCooperativeLevel();
|
||||
const char *err;
|
||||
HRESULT res = d3d->dev->TestCooperativeLevel();
|
||||
const char *err = NULL;
|
||||
switch (res)
|
||||
{
|
||||
case D3DERR_DEVICELOST:
|
||||
@ -638,8 +638,8 @@ static bool d3d_construct(d3d_video_t *d3d,
|
||||
|
||||
#ifndef _XBOX
|
||||
#ifdef HAVE_WINDOW
|
||||
char buffer[128];
|
||||
unsigned win_width, win_height;
|
||||
char buffer[128] = {0};
|
||||
RECT rect = {0};
|
||||
|
||||
video_driver_get_size(&win_width, &win_height);
|
||||
|
@ -534,10 +534,13 @@ static void renderchain_bind_orig(void *data, void *pass_data)
|
||||
static void renderchain_bind_prev(void *data, void *pass_data)
|
||||
{
|
||||
unsigned i, index;
|
||||
char attr_texture[64], attr_input_size[64], attr_tex_size[64], attr_coord[64];
|
||||
D3DXVECTOR2 texture_size;
|
||||
Pass *pass = (Pass*)pass_data;
|
||||
cg_renderchain_t *chain = (cg_renderchain_t*)data;
|
||||
char attr_texture[64] = {0};
|
||||
char attr_input_size[64] = {0};
|
||||
char attr_tex_size[64] = {0};
|
||||
char attr_coord[64] = {0};
|
||||
Pass *pass = (Pass*)pass_data;
|
||||
cg_renderchain_t *chain = (cg_renderchain_t*)data;
|
||||
static const char *prev_names[] = {
|
||||
"PREV",
|
||||
"PREV1",
|
||||
@ -665,10 +668,13 @@ static void renderchain_bind_pass(void *data, void *pass_data, unsigned pass_ind
|
||||
|
||||
for (i = 1; i < pass_index - 1; i++)
|
||||
{
|
||||
char pass_base[64], attr_texture[64], attr_input_size[64], attr_tex_size[64],
|
||||
attr_coord[64];
|
||||
CGparameter param;
|
||||
D3DXVECTOR2 video_size, texture_size;
|
||||
char pass_base[64] = {0};
|
||||
char attr_texture[64] = {0};
|
||||
char attr_input_size[64] = {0};
|
||||
char attr_tex_size[64] = {0};
|
||||
char attr_coord[64] = {0};
|
||||
|
||||
snprintf(pass_base, sizeof(pass_base), "PASS%u", i);
|
||||
snprintf(attr_texture, sizeof(attr_texture), "%s.texture", pass_base);
|
||||
|
@ -281,7 +281,8 @@ static void android_gfx_ctx_set_resize(void *data,
|
||||
|
||||
static void android_gfx_ctx_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
video_monitor_get_fps(buf, sizeof(buf),
|
||||
@ -389,9 +390,9 @@ static int system_property_get_density(char *value)
|
||||
{
|
||||
FILE *pipe;
|
||||
int length = 0;
|
||||
char buffer[PATH_MAX_LENGTH];
|
||||
char cmd[PATH_MAX_LENGTH];
|
||||
char *curpos = NULL;
|
||||
char buffer[PATH_MAX_LENGTH] = {0};
|
||||
char cmd[PATH_MAX_LENGTH] = {0};
|
||||
char *curpos = NULL;
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "wm density");
|
||||
|
||||
@ -437,7 +438,7 @@ static bool android_gfx_ctx_get_metrics(void *data,
|
||||
enum display_metric_types type, float *value)
|
||||
{
|
||||
int dpi;
|
||||
char density[PROP_VALUE_MAX];
|
||||
char density[PROP_VALUE_MAX] = {0};
|
||||
dpi_get_density(density, sizeof(density));
|
||||
|
||||
switch (type)
|
||||
|
@ -353,7 +353,8 @@ static void gfx_ctx_qnx_set_resize(void *data, unsigned width, unsigned height)
|
||||
|
||||
static void gfx_ctx_qnx_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
@ -106,7 +106,8 @@ static void gfx_ctx_cgl_set_resize(void *data, unsigned width, unsigned height)
|
||||
|
||||
static void gfx_ctx_cgl_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
@ -357,7 +357,8 @@ static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned
|
||||
|
||||
static void cocoagl_gfx_ctx_update_window_title(void *data)
|
||||
{
|
||||
static char buf[128], buf_fps[128];
|
||||
static char buf[128] = {0};
|
||||
static char buf_fps[128] = {0};
|
||||
bool got_text = video_monitor_get_fps(buf, sizeof(buf),
|
||||
buf_fps, sizeof(buf_fps));
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -132,7 +132,8 @@ static void gfx_ctx_d3d_swap_buffers(void *data)
|
||||
|
||||
static void gfx_ctx_d3d_update_title(void *data)
|
||||
{
|
||||
char buf[128], buffer_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buffer_fps[128] = {0};
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -147,8 +148,9 @@ static void gfx_ctx_d3d_update_title(void *data)
|
||||
if (settings->fps_show)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
char mem[128];
|
||||
MEMORYSTATUS stat;
|
||||
char mem[128] = {0};
|
||||
|
||||
GlobalMemoryStatus(&stat);
|
||||
snprintf(mem, sizeof(mem), "|| MEM: %.2f/%.2fMB",
|
||||
stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f));
|
||||
|
@ -307,7 +307,8 @@ static void gfx_ctx_drm_egl_set_resize(void *data,
|
||||
|
||||
static void gfx_ctx_drm_egl_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
video_monitor_get_fps(buf, sizeof(buf),
|
||||
@ -427,12 +428,12 @@ static void gfx_ctx_drm_egl_destroy_resources(gfx_ctx_drm_egl_data_t *drm)
|
||||
|
||||
static bool gfx_ctx_drm_egl_init(void *data)
|
||||
{
|
||||
const char *gpu;
|
||||
int i;
|
||||
unsigned monitor_index;
|
||||
unsigned gpu_index = 0;
|
||||
unsigned gpu_index = 0;
|
||||
const char *gpu = NULL;
|
||||
struct string_list *gpu_descriptors = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned monitor = max(settings->video.monitor_index, 1);
|
||||
|
||||
gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)calloc(1, sizeof(gfx_ctx_drm_egl_data_t));
|
||||
|
@ -86,7 +86,8 @@ static void gfx_ctx_emscripten_set_resize(void *data,
|
||||
|
||||
static void gfx_ctx_emscripten_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
@ -205,7 +205,8 @@ static void gfx_ctx_glx_set_resize(void *data,
|
||||
|
||||
static void gfx_ctx_glx_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
|
||||
|
@ -200,7 +200,8 @@ static void gfx_ctx_mali_fbdev_set_resize(void *data,
|
||||
|
||||
static void gfx_ctx_mali_fbdev_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
@ -275,7 +276,7 @@ static void gfx_ctx_mali_fbdev_input_driver(void *data,
|
||||
static gfx_ctx_proc_t gfx_ctx_mali_fbdev_get_proc_address(const char *symbol)
|
||||
{
|
||||
gfx_ctx_proc_t ret;
|
||||
void *sym__;
|
||||
void *sym__ = NULL;
|
||||
|
||||
rarch_assert(sizeof(void*) == sizeof(void (*)(void)));
|
||||
|
||||
|
@ -217,7 +217,8 @@ static void gfx_ctx_ps3_set_resize(void *data,
|
||||
|
||||
static void gfx_ctx_ps3_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
@ -281,7 +281,8 @@ static void sdl_ctx_get_video_size(void *data,
|
||||
|
||||
static void sdl_ctx_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
|
@ -119,7 +119,8 @@ static void gfx_ctx_vc_set_resize(void *data, unsigned width, unsigned height)
|
||||
|
||||
static void gfx_ctx_vc_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
@ -187,7 +187,8 @@ static void gfx_ctx_vivante_set_resize(void *data,
|
||||
|
||||
static void gfx_ctx_vivante_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
@ -337,7 +337,8 @@ static void gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
|
||||
|
||||
static void gfx_ctx_wl_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
|
@ -346,7 +346,8 @@ static void gfx_ctx_wgl_set_resize(void *data,
|
||||
|
||||
static void gfx_ctx_wgl_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
@ -219,7 +219,8 @@ static void gfx_ctx_xegl_set_resize(void *data,
|
||||
|
||||
static void gfx_ctx_xegl_update_window_title(void *data)
|
||||
{
|
||||
char buf[128], buf_fps[128];
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
@ -772,7 +772,7 @@ static void set_program_base_attrib(cg_shader_data_t *cg, unsigned i)
|
||||
static void set_pass_attrib(struct cg_program *program, struct cg_fbo_params *fbo,
|
||||
const char *attr)
|
||||
{
|
||||
char attr_buf[64];
|
||||
char attr_buf[64] = {0};
|
||||
|
||||
snprintf(attr_buf, sizeof(attr_buf), "%s.texture", attr);
|
||||
if (!fbo->tex)
|
||||
@ -831,7 +831,7 @@ static void set_program_attributes(cg_shader_data_t *cg, unsigned i)
|
||||
|
||||
if (i > 1)
|
||||
{
|
||||
char pass_str[64];
|
||||
char pass_str[64] = {0};
|
||||
|
||||
snprintf(pass_str, sizeof(pass_str), "PASSPREV%u", i);
|
||||
set_pass_attrib(&cg->prg[i], &cg->prg[i].orig, pass_str);
|
||||
@ -839,8 +839,10 @@ static void set_program_attributes(cg_shader_data_t *cg, unsigned i)
|
||||
|
||||
for (j = 0; j < PREV_TEXTURES; j++)
|
||||
{
|
||||
char attr_buf_tex[64], attr_buf_vid_size[64];
|
||||
char attr_buf_tex_size[64], attr_buf_coord[64];
|
||||
char attr_buf_tex[64] = {0};
|
||||
char attr_buf_vid_size[64] = {0};
|
||||
char attr_buf_tex_size[64] = {0};
|
||||
char attr_buf_coord[64] = {0};
|
||||
static const char *prev_names[PREV_TEXTURES] = {
|
||||
"PREV",
|
||||
"PREV1",
|
||||
@ -877,7 +879,8 @@ static void set_program_attributes(cg_shader_data_t *cg, unsigned i)
|
||||
|
||||
for (j = 0; j + 1 < i; j++)
|
||||
{
|
||||
char pass_str[64];
|
||||
char pass_str[64] = {0};
|
||||
|
||||
snprintf(pass_str, sizeof(pass_str), "PASS%u", j + 1);
|
||||
set_pass_attrib(&cg->prg[i], &cg->prg[i].fbo[j], pass_str);
|
||||
snprintf(pass_str, sizeof(pass_str), "PASSPREV%u", i - (j + 1));
|
||||
|
@ -225,8 +225,8 @@ static GLint get_uniform(glsl_shader_data_t *glsl,
|
||||
GLuint prog, const char *base)
|
||||
{
|
||||
unsigned i;
|
||||
char buf[64];
|
||||
GLint loc;
|
||||
char buf[64] = {0};
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s%s", glsl->glsl_shader->prefix, base);
|
||||
loc = glGetUniformLocation(prog, buf);
|
||||
@ -248,8 +248,8 @@ static GLint get_attrib(glsl_shader_data_t *glsl,
|
||||
GLuint prog, const char *base)
|
||||
{
|
||||
unsigned i;
|
||||
char buf[64];
|
||||
GLint loc;
|
||||
char buf[64] = {0};
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s%s", glsl->glsl_shader->prefix, base);
|
||||
loc = glGetUniformLocation(prog, buf);
|
||||
@ -269,7 +269,7 @@ static GLint get_attrib(glsl_shader_data_t *glsl,
|
||||
|
||||
static void print_shader_log(GLuint obj)
|
||||
{
|
||||
char *info_log;
|
||||
char *info_log = NULL;
|
||||
GLint max_len, info_len = 0;
|
||||
|
||||
glGetShaderiv(obj, GL_INFO_LOG_LENGTH, &max_len);
|
||||
@ -291,7 +291,7 @@ static void print_shader_log(GLuint obj)
|
||||
|
||||
static void print_linker_log(GLuint obj)
|
||||
{
|
||||
char *info_log;
|
||||
char *info_log = NULL;
|
||||
GLint max_len, info_len = 0;
|
||||
|
||||
glGetProgramiv(obj, GL_INFO_LOG_LENGTH, &max_len);
|
||||
@ -554,8 +554,10 @@ static void find_uniforms_frame(glsl_shader_data_t *glsl,
|
||||
GLuint prog,
|
||||
struct shader_uniforms_frame *frame, const char *base)
|
||||
{
|
||||
char texture[64], texture_size[64];
|
||||
char input_size[64], tex_coord[64];
|
||||
char texture[64] = {0};
|
||||
char texture_size[64] = {0};
|
||||
char input_size[64] = {0};
|
||||
char tex_coord[64] = {0};
|
||||
|
||||
snprintf(texture, sizeof(texture), "%s%s", base, "Texture");
|
||||
snprintf(texture_size, sizeof(texture_size), "%s%s", base, "TextureSize");
|
||||
@ -576,8 +578,8 @@ static void find_uniforms(glsl_shader_data_t *glsl,
|
||||
unsigned pass, GLuint prog,
|
||||
struct shader_uniforms *uni)
|
||||
{
|
||||
char frame_base[64];
|
||||
unsigned i;
|
||||
char frame_base[64] = {0};
|
||||
|
||||
glUseProgram(prog);
|
||||
|
||||
@ -713,7 +715,7 @@ static bool gl_glsl_init(void *data, const char *path)
|
||||
glsl_shader_data_t *glsl = NULL;
|
||||
const char *stock_vertex = NULL;
|
||||
const char *stock_fragment = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -837,7 +839,8 @@ static bool gl_glsl_init(void *data, const char *path)
|
||||
{
|
||||
if (*glsl->glsl_shader->pass[i].alias)
|
||||
{
|
||||
char define[128];
|
||||
char define[128] = {0};
|
||||
|
||||
snprintf(define, sizeof(define), "#define %s_ALIAS\n",
|
||||
glsl->glsl_shader->pass[i].alias);
|
||||
strlcat(glsl->glsl_alias_define, define, sizeof(glsl->glsl_alias_define));
|
||||
|
@ -229,7 +229,8 @@ static void set_program_attributes(hlsl_shader_data_t *hlsl, unsigned i)
|
||||
static bool load_shader(hlsl_shader_data_t *hlsl,
|
||||
void *data, const char *cgp_path, unsigned i)
|
||||
{
|
||||
char path_buf[PATH_MAX_LENGTH];
|
||||
char path_buf[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
fill_pathname_resolve_relative(path_buf, cgp_path,
|
||||
hlsl->cg_shader->pass[i].source.path, sizeof(path_buf));
|
||||
|
||||
|
@ -99,7 +99,7 @@ static shader_dlg_t g_shader_dlg = {0};
|
||||
|
||||
static INLINE void shader_dlg_refresh_trackbar_label(int index)
|
||||
{
|
||||
char val_buffer[32];
|
||||
char val_buffer[32] = {0};
|
||||
struct video_shader* shader = video_shader_driver_get_current_shader();
|
||||
|
||||
if (floorf(shader->parameters[index].current) == shader->parameters[index].current)
|
||||
|
Loading…
Reference in New Issue
Block a user