Optimize some struct sizes.

This is the list of reduced sizes:

file: dsound.c         - struct dsound_t reduced from 56 bytes to 52 bytes.
file: shader_parse.h   - struct gfx_fbo_scale reduced from 32 bytes to 28 bytes.
file: thread_wrapper.c - struct texture reduced from 28 bytes to 24 bytes.
file: libretro.h       - struct retro_hw_render_callback reduced from 40 bytes to 36 bytes.
file: movie.c          - struct bsv_movie reduced from 36 bytes to 32 bytes.
file: netplay.c        - struct delta_frame reduced from 16 bytes to 12 bytes.
file: performance.h    - struct rarch_perf_counter_t reduced from 40 bytes to 32 bytes.
This commit is contained in:
Lioncash 2013-11-03 23:57:41 -05:00
parent 4118fd4670
commit fac2783a09
7 changed files with 46 additions and 22 deletions

View File

@ -54,15 +54,17 @@ typedef struct dsound
{ {
LPDIRECTSOUND ds; LPDIRECTSOUND ds;
LPDIRECTSOUNDBUFFER dsb; LPDIRECTSOUNDBUFFER dsb;
HANDLE event;
bool nonblock;
fifo_buffer_t *buffer; fifo_buffer_t *buffer;
CRITICAL_SECTION crit; CRITICAL_SECTION crit;
volatile bool thread_alive; HANDLE event;
HANDLE thread; HANDLE thread;
unsigned buffer_size; unsigned buffer_size;
bool nonblock;
volatile bool thread_alive;
} dsound_t; } dsound_t;
static inline unsigned write_avail(unsigned read_ptr, unsigned write_ptr, unsigned buffer_size) static inline unsigned write_avail(unsigned read_ptr, unsigned write_ptr, unsigned buffer_size)

View File

@ -54,7 +54,6 @@ enum gfx_wrap_type
struct gfx_fbo_scale struct gfx_fbo_scale
{ {
bool valid;
enum gfx_scale_type type_x; enum gfx_scale_type type_x;
enum gfx_scale_type type_y; enum gfx_scale_type type_y;
float scale_x; float scale_x;
@ -62,6 +61,7 @@ struct gfx_fbo_scale
unsigned abs_x; unsigned abs_x;
unsigned abs_y; unsigned abs_y;
bool fp_fbo; bool fp_fbo;
bool valid;
}; };
struct gfx_shader_pass struct gfx_shader_pass

View File

@ -74,11 +74,11 @@ typedef struct thread_video
{ {
void *frame; void *frame;
size_t frame_cap; size_t frame_cap;
bool frame_updated;
bool rgb32;
unsigned width; unsigned width;
unsigned height; unsigned height;
float alpha; float alpha;
bool frame_updated;
bool rgb32;
bool enable; bool enable;
bool full_screen; bool full_screen;
} texture; } texture;

View File

@ -633,22 +633,42 @@ enum retro_hw_context_type
struct retro_hw_render_callback struct retro_hw_render_callback
{ {
enum retro_hw_context_type context_type; // Which API to use. Set by libretro core. // Which API to use. Set by libretro core.
retro_hw_context_reset_t context_reset; // Called when a context has been created or when it has been reset. enum retro_hw_context_type context_type;
retro_hw_get_current_framebuffer_t get_current_framebuffer; // Set by frontend.
retro_hw_get_proc_address_t get_proc_address; // Set by frontend. // Called when a context has been created or when it has been reset.
bool depth; // Set if render buffers should have depth component attached. retro_hw_context_reset_t context_reset;
bool stencil; // Set if stencil buffers should be attached.
// If depth and stencil are true, a packed 24/8 buffer will be added. Only attaching stencil is invalid and will be ignored. // A callback to be called before the context is destroyed.
bool bottom_left_origin; // Use conventional bottom-left origin convention. Is false, standard libretro top-left origin semantics are used. // Resources can be deinitialized at this step. This can be set to NULL, in which resources will just be destroyed without any notification.
retro_hw_context_reset_t context_destroy;
// Set by frontend
retro_hw_get_current_framebuffer_t get_current_framebuffer;
// Set by frontend
retro_hw_get_proc_address_t get_proc_address;
unsigned version_major; // Major version number for core GL context. unsigned version_major; // Major version number for core GL context.
unsigned version_minor; // Minor version number for core GL context. unsigned version_minor; // Minor version number for core GL context.
bool cache_context; // If this is true, the frontend will go very far to avoid resetting context in scenarios like toggling fullscreen, etc. // Set if render buffers should have depth component attached.
bool depth;
// Set if stencil buffers should be attached.
// If depth and stencil are true, a packed 24/8 buffer will be added. Only attaching stencil is invalid and will be ignored.
bool stencil;
// Use conventional bottom-left origin convention. Is false, standard libretro top-left origin semantics are used.
bool bottom_left_origin;
// If this is true, the frontend will go very far to avoid resetting context in scenarios like toggling fullscreen, etc.
// The reset callback might still be called in extreme situations such as if the context is lost beyond recovery. // The reset callback might still be called in extreme situations such as if the context is lost beyond recovery.
// For optimal stability, set this to false, and allow context to be reset at any time. // For optimal stability, set this to false, and allow context to be reset at any time.
retro_hw_context_reset_t context_destroy; // A callback to be called before the context is destroyed. Resources can be deinitialized at this step. This can be set to NULL, in which resources will just be destroyed without any notification. bool cache_context;
bool debug_context; // Creates a debug context.
// Creates a debug context.
bool debug_context;
}; };
// Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. Called by the frontend in response to keyboard events. // Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. Called by the frontend in response to keyboard events.

View File

@ -24,16 +24,17 @@
struct bsv_movie struct bsv_movie
{ {
FILE *file; FILE *file;
uint8_t *state;
size_t state_size;
size_t *frame_pos; // A ring buffer keeping track of positions in the file for each frame. size_t *frame_pos; // A ring buffer keeping track of positions in the file for each frame.
size_t frame_mask; size_t frame_mask;
size_t frame_ptr; size_t frame_ptr;
bool playback;
size_t min_file_pos; size_t min_file_pos;
size_t state_size;
uint8_t *state;
bool playback;
bool first_rewind; bool first_rewind;
bool did_rewind; bool did_rewind;
}; };

View File

@ -49,8 +49,9 @@ struct delta_frame
uint16_t real_input_state; uint16_t real_input_state;
uint16_t simulated_input_state; uint16_t simulated_input_state;
bool is_simulated;
uint16_t self_state; uint16_t self_state;
bool is_simulated;
bool used_real; bool used_real;
}; };

View File

@ -32,11 +32,11 @@ typedef int64_t rarch_time_t;
typedef struct rarch_perf_counter typedef struct rarch_perf_counter
{ {
const char *ident;
rarch_perf_tick_t start; rarch_perf_tick_t start;
rarch_perf_tick_t total; rarch_perf_tick_t total;
rarch_perf_tick_t call_cnt; rarch_perf_tick_t call_cnt;
const char *ident;
bool registered; bool registered;
} rarch_perf_counter_t; } rarch_perf_counter_t;