(API Change) Remove pointers from all typedefs

Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
This commit is contained in:
jp9000
2014-09-25 17:44:05 -07:00
parent 4a06960188
commit c9df41c1e2
146 changed files with 3105 additions and 3079 deletions

View File

@@ -96,7 +96,7 @@ static NSOpenGLContext *gl_context_create(struct gs_init_data *info)
return context;
}
static bool gl_init_default_swap(struct gl_platform *plat, gs_device_t dev,
static bool gl_init_default_swap(struct gl_platform *plat, gs_device_t *dev,
struct gs_init_data *info)
{
if(!(plat->context = gl_context_create(info)))
@@ -109,7 +109,7 @@ static bool gl_init_default_swap(struct gl_platform *plat, gs_device_t dev,
return plat->swap.wi != NULL;
}
struct gl_platform *gl_platform_create(gs_device_t device,
struct gl_platform *gl_platform_create(gs_device_t *device,
struct gs_init_data *info)
{
struct gl_platform *plat = bzalloc(sizeof(struct gl_platform));
@@ -186,24 +186,24 @@ void gl_windowinfo_destroy(struct gl_windowinfo *wi)
bfree(wi);
}
void gl_update(gs_device_t device)
void gl_update(gs_device_t *device)
{
[device->plat->context update];
}
void device_enter_context(gs_device_t device)
void device_enter_context(gs_device_t *device)
{
[device->plat->context makeCurrentContext];
}
void device_leave_context(gs_device_t device)
void device_leave_context(gs_device_t *device)
{
UNUSED_PARAMETER(device);
[NSOpenGLContext clearCurrentContext];
}
void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap)
{
if(!swap)
swap = &device->plat->swap;
@@ -215,7 +215,7 @@ void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
[device->plat->context setView:swap->wi->view];
}
void device_present(gs_device_t device)
void device_present(gs_device_t *device)
{
[device->plat->context flushBuffer];
}
@@ -227,7 +227,7 @@ void gl_getclientsize(struct gs_swap_chain *swap, uint32_t *width,
if(height) *height = swap->info.cy;
}
gs_texture_t device_texture_create_from_iosurface(gs_device_t device,
gs_texture_t *device_texture_create_from_iosurface(gs_device_t *device,
void *iosurf)
{
IOSurfaceRef ref = (IOSurfaceRef)iosurf;
@@ -285,15 +285,15 @@ gs_texture_t device_texture_create_from_iosurface(gs_device_t device,
if (!gl_bind_texture(tex->base.gl_target, 0))
goto fail;
return (gs_texture_t)tex;
return (gs_texture_t*)tex;
fail:
gs_texture_destroy((gs_texture_t)tex);
gs_texture_destroy((gs_texture_t*)tex);
blog(LOG_ERROR, "device_texture_create_from_iosurface (GL) failed");
return NULL;
}
bool gs_texture_rebind_iosurface(gs_texture_t texture, void *iosurf)
bool gs_texture_rebind_iosurface(gs_texture_t *texture, void *iosurf)
{
if (!texture)
return false;

View File

@@ -33,7 +33,7 @@ static inline bool init_ib(struct gs_index_buffer *ib)
return success;
}
gs_indexbuffer_t device_indexbuffer_create(gs_device_t device,
gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device,
enum gs_index_type type, void *indices, size_t num,
uint32_t flags)
{
@@ -59,7 +59,7 @@ gs_indexbuffer_t device_indexbuffer_create(gs_device_t device,
return ib;
}
void gs_indexbuffer_destroy(gs_indexbuffer_t ib)
void gs_indexbuffer_destroy(gs_indexbuffer_t *ib)
{
if (ib) {
if (ib->buffer)
@@ -70,7 +70,7 @@ void gs_indexbuffer_destroy(gs_indexbuffer_t ib)
}
}
void gs_indexbuffer_flush(gs_indexbuffer_t ib)
void gs_indexbuffer_flush(gs_indexbuffer_t *ib)
{
if (!ib->dynamic) {
blog(LOG_ERROR, "Index buffer is not dynamic");
@@ -86,22 +86,22 @@ fail:
blog(LOG_ERROR, "gs_indexbuffer_flush (GL) failed");
}
void *gs_indexbuffer_get_data(gs_indexbuffer_t ib)
void *gs_indexbuffer_get_data(gs_indexbuffer_t *ib)
{
return ib->data;
}
size_t gs_indexbuffer_get_num_indices(gs_indexbuffer_t ib)
size_t gs_indexbuffer_get_num_indices(gs_indexbuffer_t *ib)
{
return ib->num;
}
enum gs_index_type gs_indexbuffer_get_type(gs_indexbuffer_t ib)
enum gs_index_type gs_indexbuffer_get_type(gs_indexbuffer_t *ib)
{
return ib->type;
}
void device_load_indexbuffer(gs_device_t device, gs_indexbuffer_t ib)
void device_load_indexbuffer(gs_device_t *device, gs_indexbuffer_t *ib)
{
if (ib == device->cur_index_buffer)
return;

View File

@@ -108,7 +108,7 @@ static inline bool gl_add_params(struct gs_shader *shader,
static inline void gl_add_sampler(struct gs_shader *shader,
struct shader_sampler *sampler)
{
gs_samplerstate_t new_sampler;
gs_samplerstate_t *new_sampler;
struct gs_sampler_info info;
shader_sampler_convert(sampler, &info);
@@ -236,7 +236,7 @@ static bool gl_shader_init(struct gs_shader *shader,
return success;
}
static struct gs_shader *shader_create(gs_device_t device,
static struct gs_shader *shader_create(gs_device_t *device,
enum gs_shader_type type, const char *shader_str,
const char *file, char **error_string)
{
@@ -262,7 +262,7 @@ static struct gs_shader *shader_create(gs_device_t device,
return shader;
}
gs_shader_t device_vertexshader_create(gs_device_t device,
gs_shader_t *device_vertexshader_create(gs_device_t *device,
const char *shader, const char *file,
char **error_string)
{
@@ -274,7 +274,7 @@ gs_shader_t device_vertexshader_create(gs_device_t device,
return ptr;
}
gs_shader_t device_pixelshader_create(gs_device_t device,
gs_shader_t *device_pixelshader_create(gs_device_t *device,
const char *shader, const char *file,
char **error_string)
{
@@ -309,7 +309,7 @@ static void remove_program_references(struct gs_shader *shader)
}
}
void gs_shader_destroy(gs_shader_t shader)
void gs_shader_destroy(gs_shader_t *shader)
{
size_t i;
@@ -338,18 +338,18 @@ void gs_shader_destroy(gs_shader_t shader)
bfree(shader);
}
int gs_shader_get_num_params(gs_shader_t shader)
int gs_shader_get_num_params(gs_shader_t *shader)
{
return (int)shader->params.num;
}
gs_sparam_t gs_shader_get_param_by_idx(gs_shader_t shader, uint32_t param)
gs_sparam_t *gs_shader_get_param_by_idx(gs_shader_t *shader, uint32_t param)
{
assert(param < shader->params.num);
return shader->params.array+param;
}
gs_sparam_t gs_shader_get_param_by_name(gs_shader_t shader, const char *name)
gs_sparam_t *gs_shader_get_param_by_name(gs_shader_t *shader, const char *name)
{
size_t i;
for (i = 0; i < shader->params.num; i++) {
@@ -362,40 +362,40 @@ gs_sparam_t gs_shader_get_param_by_name(gs_shader_t shader, const char *name)
return NULL;
}
gs_sparam_t gs_shader_get_viewproj_matrix(gs_shader_t shader)
gs_sparam_t *gs_shader_get_viewproj_matrix(gs_shader_t *shader)
{
return shader->viewproj;
}
gs_sparam_t gs_shader_get_world_matrix(gs_shader_t shader)
gs_sparam_t *gs_shader_get_world_matrix(gs_shader_t *shader)
{
return shader->world;
}
void gs_shader_get_param_info(gs_sparam_t param,
void gs_shader_get_param_info(gs_sparam_t *param,
struct gs_shader_param_info *info)
{
info->type = param->type;
info->name = param->name;
}
void gs_shader_set_bool(gs_sparam_t param, bool val)
void gs_shader_set_bool(gs_sparam_t *param, bool val)
{
int int_val = val;
da_copy_array(param->cur_value, &int_val, sizeof(int_val));
}
void gs_shader_set_float(gs_sparam_t param, float val)
void gs_shader_set_float(gs_sparam_t *param, float val)
{
da_copy_array(param->cur_value, &val, sizeof(val));
}
void gs_shader_set_int(gs_sparam_t param, int val)
void gs_shader_set_int(gs_sparam_t *param, int val)
{
da_copy_array(param->cur_value, &val, sizeof(val));
}
void gs_shader_setmatrix3(gs_sparam_t param, const struct matrix3 *val)
void gs_shader_setmatrix3(gs_sparam_t *param, const struct matrix3 *val)
{
struct matrix4 mat;
matrix4_from_matrix3(&mat, val);
@@ -403,27 +403,27 @@ void gs_shader_setmatrix3(gs_sparam_t param, const struct matrix3 *val)
da_copy_array(param->cur_value, &mat, sizeof(mat));
}
void gs_shader_set_matrix4(gs_sparam_t param, const struct matrix4 *val)
void gs_shader_set_matrix4(gs_sparam_t *param, const struct matrix4 *val)
{
da_copy_array(param->cur_value, val, sizeof(*val));
}
void gs_shader_set_vec2(gs_sparam_t param, const struct vec2 *val)
void gs_shader_set_vec2(gs_sparam_t *param, const struct vec2 *val)
{
da_copy_array(param->cur_value, val->ptr, sizeof(*val));
}
void gs_shader_set_vec3(gs_sparam_t param, const struct vec3 *val)
void gs_shader_set_vec3(gs_sparam_t *param, const struct vec3 *val)
{
da_copy_array(param->cur_value, val->ptr, sizeof(*val));
}
void gs_shader_set_vec4(gs_sparam_t param, const struct vec4 *val)
void gs_shader_set_vec4(gs_sparam_t *param, const struct vec4 *val)
{
da_copy_array(param->cur_value, val->ptr, sizeof(*val));
}
void gs_shader_set_texture(gs_sparam_t param, gs_texture_t val)
void gs_shader_set_texture(gs_sparam_t *param, gs_texture_t *val)
{
param->texture = val;
}
@@ -681,7 +681,7 @@ void gs_program_destroy(struct gs_program *program)
bfree(program);
}
void gs_shader_set_val(gs_sparam_t param, const void *val, size_t size)
void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size)
{
int count = param->array_count;
size_t expected_size = 0;
@@ -711,12 +711,12 @@ void gs_shader_set_val(gs_sparam_t param, const void *val, size_t size)
}
if (param->type == GS_SHADER_PARAM_TEXTURE)
gs_shader_set_texture(param, *(gs_texture_t*)val);
gs_shader_set_texture(param, *(gs_texture_t**)val);
else
da_copy_array(param->cur_value, val, size);
}
void gs_shader_set_default(gs_sparam_t param)
void gs_shader_set_default(gs_sparam_t *param)
{
gs_shader_set_val(param, param->def_value.array, param->def_value.num);
}

View File

@@ -42,7 +42,7 @@ static bool create_pixel_pack_buffer(struct gs_stage_surface *surf)
return success;
}
gs_stagesurf_t device_stagesurface_create(gs_device_t device, uint32_t width,
gs_stagesurf_t *device_stagesurface_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_color_format color_format)
{
struct gs_stage_surface *surf;
@@ -65,7 +65,7 @@ gs_stagesurf_t device_stagesurface_create(gs_device_t device, uint32_t width,
return surf;
}
void gs_stagesurface_destroy(gs_stagesurf_t stagesurf)
void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf)
{
if (stagesurf) {
if (stagesurf->pack_buffer)
@@ -110,8 +110,8 @@ static bool can_stage(struct gs_stage_surface *dst, struct gs_texture_2d *src)
/* Apparently for mac, PBOs won't do an asynchronous transfer unless you use
* FBOs aong with glReadPixels, which is really dumb. */
void device_stage_texture(gs_device_t device, gs_stagesurf_t dst,
gs_texture_t src)
void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst,
gs_texture_t *src)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)src;
struct fbo_info *fbo;
@@ -156,8 +156,8 @@ failed:
#else
void device_stage_texture(gs_device_t device, gs_stagesurf_t dst,
gs_texture_t src)
void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst,
gs_texture_t *src)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)src;
if (!can_stage(dst, tex2d))
@@ -186,22 +186,22 @@ failed:
#endif
uint32_t gs_stagesurface_get_width(gs_stagesurf_t stagesurf)
uint32_t gs_stagesurface_get_width(gs_stagesurf_t *stagesurf)
{
return stagesurf->width;
}
uint32_t gs_stagesurface_get_height(gs_stagesurf_t stagesurf)
uint32_t gs_stagesurface_get_height(gs_stagesurf_t *stagesurf)
{
return stagesurf->height;
}
enum gs_color_format gs_stagesurface_get_color_format(gs_stagesurf_t stagesurf)
enum gs_color_format gs_stagesurface_get_color_format(gs_stagesurf_t *stagesurf)
{
return stagesurf->format;
}
bool gs_stagesurface_map(gs_stagesurf_t stagesurf, uint8_t **data,
bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data,
uint32_t *linesize)
{
if (!gl_bind_buffer(GL_PIXEL_PACK_BUFFER, stagesurf->pack_buffer))
@@ -221,7 +221,7 @@ fail:
return false;
}
void gs_stagesurface_unmap(gs_stagesurf_t stagesurf)
void gs_stagesurface_unmap(gs_stagesurf_t *stagesurf)
{
if (!gl_bind_buffer(GL_PIXEL_PACK_BUFFER, stagesurf->pack_buffer))
return;

View File

@@ -191,7 +191,7 @@ const char *device_preprocessor_name(void)
return "_OPENGL";
}
int device_create(gs_device_t *p_device, struct gs_init_data *info)
int device_create(gs_device_t **p_device, struct gs_init_data *info)
{
struct gs_device *device = bzalloc(sizeof(struct gs_device));
int errorcode = GS_ERROR_FAIL;
@@ -221,7 +221,7 @@ fail:
return errorcode;
}
void device_destroy(gs_device_t device)
void device_destroy(gs_device_t *device)
{
if (device) {
size_t i;
@@ -239,7 +239,7 @@ void device_destroy(gs_device_t device)
}
}
gs_swapchain_t device_swapchain_create(gs_device_t device,
gs_swapchain_t *device_swapchain_create(gs_device_t *device,
struct gs_init_data *info)
{
struct gs_swap_chain *swap = bzalloc(sizeof(struct gs_swap_chain));
@@ -262,7 +262,7 @@ gs_swapchain_t device_swapchain_create(gs_device_t device,
return swap;
}
void device_resize(gs_device_t device, uint32_t cx, uint32_t cy)
void device_resize(gs_device_t *device, uint32_t cx, uint32_t cy)
{
/* GL automatically resizes the device, so it doesn't do much */
device->cur_swap->info.cx = cx;
@@ -271,23 +271,23 @@ void device_resize(gs_device_t device, uint32_t cx, uint32_t cy)
gl_update(device);
}
void device_get_size(gs_device_t device, uint32_t *cx, uint32_t *cy)
void device_get_size(gs_device_t *device, uint32_t *cx, uint32_t *cy)
{
*cx = device->cur_swap->info.cx;
*cy = device->cur_swap->info.cy;
}
uint32_t device_get_width(gs_device_t device)
uint32_t device_get_width(gs_device_t *device)
{
return device->cur_swap->info.cx;
}
uint32_t device_get_height(gs_device_t device)
uint32_t device_get_height(gs_device_t *device)
{
return device->cur_swap->info.cy;
}
gs_texture_t device_voltexture_create(gs_device_t device, uint32_t width,
gs_texture_t *device_voltexture_create(gs_device_t *device, uint32_t width,
uint32_t height, uint32_t depth,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags)
@@ -304,7 +304,7 @@ gs_texture_t device_voltexture_create(gs_device_t device, uint32_t width,
return NULL;
}
gs_samplerstate_t device_samplerstate_create(gs_device_t device,
gs_samplerstate_t *device_samplerstate_create(gs_device_t *device,
struct gs_sampler_info *info)
{
struct gs_sampler_state *sampler;
@@ -317,7 +317,7 @@ gs_samplerstate_t device_samplerstate_create(gs_device_t device,
return sampler;
}
enum gs_texture_type device_get_texture_type(gs_texture_t texture)
enum gs_texture_type device_get_texture_type(gs_texture_t *texture)
{
return texture->type;
}
@@ -350,7 +350,7 @@ static inline void apply_swizzle(struct gs_texture *tex)
}
}
static bool load_texture_sampler(gs_texture_t tex, gs_samplerstate_t ss)
static bool load_texture_sampler(gs_texture_t *tex, gs_samplerstate_t *ss)
{
bool success = true;
GLint min_filter;
@@ -391,7 +391,7 @@ static bool load_texture_sampler(gs_texture_t tex, gs_samplerstate_t ss)
return success;
}
static inline struct gs_shader_param *get_texture_param(gs_device_t device,
static inline struct gs_shader_param *get_texture_param(gs_device_t *device,
int unit)
{
struct gs_shader *shader = device->cur_pixel_shader;
@@ -408,7 +408,7 @@ static inline struct gs_shader_param *get_texture_param(gs_device_t device,
return NULL;
}
void device_load_texture(gs_device_t device, gs_texture_t tex, int unit)
void device_load_texture(gs_device_t *device, gs_texture_t *tex, int unit)
{
struct gs_shader_param *param;
struct gs_sampler_state *sampler;
@@ -452,7 +452,7 @@ fail:
blog(LOG_ERROR, "device_load_texture (GL) failed");
}
static bool load_sampler_on_textures(gs_device_t device, gs_samplerstate_t ss,
static bool load_sampler_on_textures(gs_device_t *device, gs_samplerstate_t *ss,
int sampler_unit)
{
struct gs_shader *shader = device->cur_pixel_shader;
@@ -474,7 +474,7 @@ static bool load_sampler_on_textures(gs_device_t device, gs_samplerstate_t ss,
return true;
}
void device_load_samplerstate(gs_device_t device, gs_samplerstate_t ss,
void device_load_samplerstate(gs_device_t *device, gs_samplerstate_t *ss,
int unit)
{
/* need a pixel shader to properly bind samplers */
@@ -495,7 +495,7 @@ void device_load_samplerstate(gs_device_t device, gs_samplerstate_t ss,
return;
}
void device_load_vertexshader(gs_device_t device, gs_shader_t vertshader)
void device_load_vertexshader(gs_device_t *device, gs_shader_t *vertshader)
{
if (device->cur_vertex_shader == vertshader)
return;
@@ -525,7 +525,7 @@ static void load_default_pixelshader_samplers(struct gs_device *device,
device->cur_samplers[i] = NULL;
}
void device_load_pixelshader(gs_device_t device, gs_shader_t pixelshader)
void device_load_pixelshader(gs_device_t *device, gs_shader_t *pixelshader)
{
if (device->cur_pixel_shader == pixelshader)
return;
@@ -547,7 +547,7 @@ fail:
blog(LOG_ERROR, "device_load_pixelshader (GL) failed");
}
void device_load_default_samplerstate(gs_device_t device, bool b_3d, int unit)
void device_load_default_samplerstate(gs_device_t *device, bool b_3d, int unit)
{
/* TODO */
UNUSED_PARAMETER(device);
@@ -555,27 +555,27 @@ void device_load_default_samplerstate(gs_device_t device, bool b_3d, int unit)
UNUSED_PARAMETER(unit);
}
gs_shader_t device_get_vertex_shader(gs_device_t device)
gs_shader_t *device_get_vertex_shader(gs_device_t *device)
{
return device->cur_vertex_shader;
}
gs_shader_t device_get_pixel_shader(gs_device_t device)
gs_shader_t *device_get_pixel_shader(gs_device_t *device)
{
return device->cur_pixel_shader;
}
gs_texture_t device_get_render_target(gs_device_t device)
gs_texture_t *device_get_render_target(gs_device_t *device)
{
return device->cur_render_target;
}
gs_zstencil_t device_get_zstencil_target(gs_device_t device)
gs_zstencil_t *device_get_zstencil_target(gs_device_t *device)
{
return device->cur_zstencil_buffer;
}
static bool get_tex_dimensions(gs_texture_t tex, uint32_t *width,
static bool get_tex_dimensions(gs_texture_t *tex, uint32_t *width,
uint32_t *height)
{
if (tex->type == GS_TEXTURE_2D) {
@@ -632,7 +632,7 @@ struct fbo_info *get_fbo(struct gs_device *device,
}
static inline struct fbo_info *get_fbo_by_tex(struct gs_device *device,
gs_texture_t tex)
gs_texture_t *tex)
{
uint32_t width, height;
if (!get_tex_dimensions(tex, &width, &height))
@@ -641,7 +641,7 @@ static inline struct fbo_info *get_fbo_by_tex(struct gs_device *device,
return get_fbo(device, width, height, tex->format);
}
static bool set_current_fbo(gs_device_t device, struct fbo_info *fbo)
static bool set_current_fbo(gs_device_t *device, struct fbo_info *fbo)
{
if (device->cur_fbo != fbo) {
GLuint fbo_obj = fbo ? fbo->fbo : 0;
@@ -653,7 +653,7 @@ static bool set_current_fbo(gs_device_t device, struct fbo_info *fbo)
return true;
}
static bool attach_rendertarget(struct fbo_info *fbo, gs_texture_t tex,
static bool attach_rendertarget(struct fbo_info *fbo, gs_texture_t *tex,
int side)
{
if (fbo->cur_render_target == tex)
@@ -679,7 +679,7 @@ static bool attach_rendertarget(struct fbo_info *fbo, gs_texture_t tex,
return gl_success("glFramebufferTexture2D");
}
static bool attach_zstencil(struct fbo_info *fbo, gs_zstencil_t zs)
static bool attach_zstencil(struct fbo_info *fbo, gs_zstencil_t *zs)
{
GLuint zsbuffer = 0;
GLenum zs_attachment = GL_DEPTH_STENCIL_ATTACHMENT;
@@ -702,8 +702,8 @@ static bool attach_zstencil(struct fbo_info *fbo, gs_zstencil_t zs)
return true;
}
static bool set_target(gs_device_t device, gs_texture_t tex, int side,
gs_zstencil_t zs)
static bool set_target(gs_device_t *device, gs_texture_t *tex, int side,
gs_zstencil_t *zs)
{
struct fbo_info *fbo;
@@ -733,8 +733,8 @@ static bool set_target(gs_device_t device, gs_texture_t tex, int side,
return true;
}
void device_set_render_target(gs_device_t device, gs_texture_t tex,
gs_zstencil_t zstencil)
void device_set_render_target(gs_device_t *device, gs_texture_t *tex,
gs_zstencil_t *zstencil)
{
if (tex) {
if (tex->type != GS_TEXTURE_2D) {
@@ -757,8 +757,8 @@ fail:
blog(LOG_ERROR, "device_set_render_target (GL) failed");
}
void device_set_cube_render_target(gs_device_t device, gs_texture_t cubetex,
int side, gs_zstencil_t zstencil)
void device_set_cube_render_target(gs_device_t *device, gs_texture_t *cubetex,
int side, gs_zstencil_t *zstencil)
{
if (cubetex) {
if (cubetex->type != GS_TEXTURE_CUBE) {
@@ -781,9 +781,9 @@ fail:
blog(LOG_ERROR, "device_set_cube_render_target (GL) failed");
}
void device_copy_texture_region(gs_device_t device,
gs_texture_t dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t src, uint32_t src_x, uint32_t src_y,
void device_copy_texture_region(gs_device_t *device,
gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
{
struct gs_texture_2d *src2d = (struct gs_texture_2d*)src;
@@ -830,17 +830,18 @@ fail:
blog(LOG_ERROR, "device_copy_texture (GL) failed");
}
void device_copy_texture(gs_device_t device, gs_texture_t dst, gs_texture_t src)
void device_copy_texture(gs_device_t *device, gs_texture_t *dst,
gs_texture_t *src)
{
device_copy_texture_region(device, dst, 0, 0, src, 0, 0, 0, 0);
}
void device_begin_scene(gs_device_t device)
void device_begin_scene(gs_device_t *device)
{
clear_textures(device);
}
static inline bool can_render(gs_device_t device)
static inline bool can_render(gs_device_t *device)
{
if (!device->cur_vertex_shader) {
blog(LOG_ERROR, "No vertex shader specified");
@@ -898,12 +899,12 @@ static inline struct gs_program *get_shader_program(struct gs_device *device)
return program;
}
void device_draw(gs_device_t device, enum gs_draw_mode draw_mode,
void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode,
uint32_t start_vert, uint32_t num_verts)
{
struct gs_index_buffer *ib = device->cur_index_buffer;
GLenum topology = convert_gs_topology(draw_mode);
gs_effect_t effect = gs_get_effect();
gs_effect_t *effect = gs_get_effect();
struct gs_program *program;
if (!can_render(device))
@@ -957,13 +958,13 @@ fail:
blog(LOG_ERROR, "device_draw (GL) failed");
}
void device_end_scene(gs_device_t device)
void device_end_scene(gs_device_t *device)
{
/* does nothing */
UNUSED_PARAMETER(device);
}
void device_clear(gs_device_t device, uint32_t clear_flags,
void device_clear(gs_device_t *device, uint32_t clear_flags,
struct vec4 *color, float depth, uint8_t stencil)
{
GLbitfield gl_flags = 0;
@@ -990,14 +991,14 @@ void device_clear(gs_device_t device, uint32_t clear_flags,
UNUSED_PARAMETER(device);
}
void device_flush(gs_device_t device)
void device_flush(gs_device_t *device)
{
glFlush();
UNUSED_PARAMETER(device);
}
void device_set_cull_mode(gs_device_t device, enum gs_cull_mode mode)
void device_set_cull_mode(gs_device_t *device, enum gs_cull_mode mode)
{
if (device->cur_cull_mode == mode)
return;
@@ -1015,12 +1016,12 @@ void device_set_cull_mode(gs_device_t device, enum gs_cull_mode mode)
gl_disable(GL_CULL_FACE);
}
enum gs_cull_mode device_get_cull_mode(gs_device_t device)
enum gs_cull_mode device_get_cull_mode(gs_device_t *device)
{
return device->cur_cull_mode;
}
void device_enable_blending(gs_device_t device, bool enable)
void device_enable_blending(gs_device_t *device, bool enable)
{
if (enable)
gl_enable(GL_BLEND);
@@ -1030,7 +1031,7 @@ void device_enable_blending(gs_device_t device, bool enable)
UNUSED_PARAMETER(device);
}
void device_enable_depth_test(gs_device_t device, bool enable)
void device_enable_depth_test(gs_device_t *device, bool enable)
{
if (enable)
gl_enable(GL_DEPTH_TEST);
@@ -1040,7 +1041,7 @@ void device_enable_depth_test(gs_device_t device, bool enable)
UNUSED_PARAMETER(device);
}
void device_enable_stencil_test(gs_device_t device, bool enable)
void device_enable_stencil_test(gs_device_t *device, bool enable)
{
if (enable)
gl_enable(GL_STENCIL_TEST);
@@ -1050,7 +1051,7 @@ void device_enable_stencil_test(gs_device_t device, bool enable)
UNUSED_PARAMETER(device);
}
void device_enable_stencil_write(gs_device_t device, bool enable)
void device_enable_stencil_write(gs_device_t *device, bool enable)
{
if (enable)
glStencilMask(0xFFFFFFFF);
@@ -1060,7 +1061,7 @@ void device_enable_stencil_write(gs_device_t device, bool enable)
UNUSED_PARAMETER(device);
}
void device_enable_color(gs_device_t device, bool red, bool green,
void device_enable_color(gs_device_t *device, bool red, bool green,
bool blue, bool alpha)
{
glColorMask(red, green, blue, alpha);
@@ -1068,7 +1069,7 @@ void device_enable_color(gs_device_t device, bool red, bool green,
UNUSED_PARAMETER(device);
}
void device_blend_function(gs_device_t device, enum gs_blend_type src,
void device_blend_function(gs_device_t *device, enum gs_blend_type src,
enum gs_blend_type dest)
{
GLenum gl_src = convert_gs_blend_type(src);
@@ -1081,7 +1082,7 @@ void device_blend_function(gs_device_t device, enum gs_blend_type src,
UNUSED_PARAMETER(device);
}
void device_depth_function(gs_device_t device, enum gs_depth_test test)
void device_depth_function(gs_device_t *device, enum gs_depth_test test)
{
GLenum gl_test = convert_gs_depth_test(test);
@@ -1092,7 +1093,7 @@ void device_depth_function(gs_device_t device, enum gs_depth_test test)
UNUSED_PARAMETER(device);
}
void device_stencil_function(gs_device_t device, enum gs_stencil_side side,
void device_stencil_function(gs_device_t *device, enum gs_stencil_side side,
enum gs_depth_test test)
{
GLenum gl_side = convert_gs_stencil_side(side);
@@ -1105,7 +1106,7 @@ void device_stencil_function(gs_device_t device, enum gs_stencil_side side,
UNUSED_PARAMETER(device);
}
void device_stencil_op(gs_device_t device, enum gs_stencil_side side,
void device_stencil_op(gs_device_t *device, enum gs_stencil_side side,
enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail,
enum gs_stencil_op_type zpass)
{
@@ -1132,7 +1133,7 @@ static inline uint32_t get_target_height(struct gs_device *device)
return gs_cubetexture_get_size(device->cur_render_target);
}
void device_set_viewport(gs_device_t device, int x, int y, int width,
void device_set_viewport(gs_device_t *device, int x, int y, int width,
int height)
{
uint32_t base_height;
@@ -1155,12 +1156,12 @@ void device_set_viewport(gs_device_t device, int x, int y, int width,
device->cur_viewport.cy = height;
}
void device_get_viewport(gs_device_t device, struct gs_rect *rect)
void device_get_viewport(gs_device_t *device, struct gs_rect *rect)
{
*rect = device->cur_viewport;
}
void device_set_scissor_rect(gs_device_t device, struct gs_rect *rect)
void device_set_scissor_rect(gs_device_t *device, struct gs_rect *rect)
{
UNUSED_PARAMETER(device);
@@ -1176,7 +1177,7 @@ void device_set_scissor_rect(gs_device_t device, struct gs_rect *rect)
blog(LOG_ERROR, "device_set_scissor_rect (GL) failed");
}
void device_ortho(gs_device_t device, float left, float right,
void device_ortho(gs_device_t *device, float left, float right,
float top, float bottom, float near, float far)
{
struct matrix4 *dst = &device->cur_proj;
@@ -1202,7 +1203,7 @@ void device_ortho(gs_device_t device, float left, float right,
dst->t.w = 1.0f;
}
void device_frustum(gs_device_t device, float left, float right,
void device_frustum(gs_device_t *device, float left, float right,
float top, float bottom, float near, float far)
{
struct matrix4 *dst = &device->cur_proj;
@@ -1229,12 +1230,12 @@ void device_frustum(gs_device_t device, float left, float right,
dst->z.w = -1.0f;
}
void device_projection_push(gs_device_t device)
void device_projection_push(gs_device_t *device)
{
da_push_back(device->proj_stack, &device->cur_proj);
}
void device_projection_pop(gs_device_t device)
void device_projection_pop(gs_device_t *device)
{
struct matrix4 *end;
if (!device->proj_stack.num)
@@ -1245,7 +1246,7 @@ void device_projection_pop(gs_device_t device)
da_pop_back(device->proj_stack);
}
void gs_swapchain_destroy(gs_swapchain_t swapchain)
void gs_swapchain_destroy(gs_swapchain_t *swapchain)
{
if (!swapchain)
return;
@@ -1259,41 +1260,41 @@ void gs_swapchain_destroy(gs_swapchain_t swapchain)
bfree(swapchain);
}
void gs_voltexture_destroy(gs_texture_t voltex)
void gs_voltexture_destroy(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
}
uint32_t gs_voltexture_get_width(gs_texture_t voltex)
uint32_t gs_voltexture_get_width(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
uint32_t gs_voltexture_get_height(gs_texture_t voltex)
uint32_t gs_voltexture_get_height(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
uint32_t gs_voltexture_getdepth(gs_texture_t voltex)
uint32_t gs_voltexture_getdepth(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
enum gs_color_format gs_voltexture_get_color_format(gs_texture_t voltex)
enum gs_color_format gs_voltexture_get_color_format(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return GS_UNKNOWN;
}
void gs_samplerstate_destroy(gs_samplerstate_t samplerstate)
void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate)
{
if (!samplerstate)
return;

View File

@@ -273,7 +273,7 @@ extern void convert_sampler_info(struct gs_sampler_state *sampler,
struct gs_sampler_info *info);
struct gs_sampler_state {
gs_device_t device;
gs_device_t *device;
volatile long ref;
GLint min_filter;
@@ -284,12 +284,12 @@ struct gs_sampler_state {
GLint max_anisotropy;
};
static inline void samplerstate_addref(gs_samplerstate_t ss)
static inline void samplerstate_addref(gs_samplerstate_t *ss)
{
os_atomic_inc_long(&ss->ref);
}
static inline void samplerstate_release(gs_samplerstate_t ss)
static inline void samplerstate_release(gs_samplerstate_t *ss)
{
if (os_atomic_dec_long(&ss->ref) == 0)
bfree(ss);
@@ -299,7 +299,7 @@ struct gs_shader_param {
enum gs_shader_param_type type;
char *name;
gs_shader_t shader;
gs_shader_t *shader;
GLint texture_id;
size_t sampler_id;
int array_count;
@@ -327,7 +327,7 @@ struct shader_attrib {
};
struct gs_shader {
gs_device_t device;
gs_device_t *device;
enum gs_shader_type type;
GLuint obj;
@@ -336,7 +336,7 @@ struct gs_shader {
DARRAY(struct shader_attrib) attribs;
DARRAY(struct gs_shader_param) params;
DARRAY(gs_samplerstate_t) samplers;
DARRAY(gs_samplerstate_t*) samplers;
};
struct program_param {
@@ -345,7 +345,7 @@ struct program_param {
};
struct gs_program {
gs_device_t device;
gs_device_t *device;
GLuint obj;
struct gs_shader *vertex_shader;
struct gs_shader *pixel_shader;
@@ -370,7 +370,7 @@ struct gs_vertex_buffer {
DARRAY(GLuint) uv_buffers;
DARRAY(size_t) uv_sizes;
gs_device_t device;
gs_device_t *device;
size_t num;
bool dynamic;
struct gs_vb_data *data;
@@ -384,7 +384,7 @@ struct gs_index_buffer {
enum gs_index_type type;
GLuint gl_type;
gs_device_t device;
gs_device_t *device;
void *data;
size_t num;
size_t width;
@@ -393,7 +393,7 @@ struct gs_index_buffer {
};
struct gs_texture {
gs_device_t device;
gs_device_t *device;
enum gs_texture_type type;
enum gs_color_format format;
GLenum gl_format;
@@ -407,7 +407,7 @@ struct gs_texture {
bool is_dummy;
bool gen_mipmaps;
gs_samplerstate_t cur_sampler;
gs_samplerstate_t *cur_sampler;
};
struct gs_texture_2d {
@@ -426,7 +426,7 @@ struct gs_texture_cube {
};
struct gs_stage_surface {
gs_device_t device;
gs_device_t *device;
enum gs_color_format format;
uint32_t width;
@@ -440,14 +440,14 @@ struct gs_stage_surface {
};
struct gs_zstencil_buffer {
gs_device_t device;
gs_device_t *device;
GLuint buffer;
GLuint attachment;
GLenum format;
};
struct gs_swap_chain {
gs_device_t device;
gs_device_t *device;
struct gl_windowinfo *wi;
struct gs_init_data info;
};
@@ -458,9 +458,9 @@ struct fbo_info {
uint32_t height;
enum gs_color_format format;
gs_texture_t cur_render_target;
gs_texture_t *cur_render_target;
int cur_render_side;
gs_zstencil_t cur_zstencil_buffer;
gs_zstencil_t *cur_zstencil_buffer;
};
static inline void fbo_info_destroy(struct fbo_info *fbo)
@@ -477,16 +477,16 @@ struct gs_device {
struct gl_platform *plat;
enum copy_type copy_type;
gs_texture_t cur_render_target;
gs_zstencil_t cur_zstencil_buffer;
gs_texture_t *cur_render_target;
gs_zstencil_t *cur_zstencil_buffer;
int cur_render_side;
gs_texture_t cur_textures[GS_MAX_TEXTURES];
gs_samplerstate_t cur_samplers[GS_MAX_TEXTURES];
gs_vertbuffer_t cur_vertex_buffer;
gs_indexbuffer_t cur_index_buffer;
gs_shader_t cur_vertex_shader;
gs_shader_t cur_pixel_shader;
gs_swapchain_t cur_swap;
gs_texture_t *cur_textures[GS_MAX_TEXTURES];
gs_samplerstate_t *cur_samplers[GS_MAX_TEXTURES];
gs_vertbuffer_t *cur_vertex_buffer;
gs_indexbuffer_t *cur_index_buffer;
gs_shader_t *cur_vertex_shader;
gs_shader_t *cur_pixel_shader;
gs_swapchain_t *cur_swap;
struct gs_program *cur_program;
struct gs_program *first_program;
@@ -507,9 +507,9 @@ struct gs_device {
extern struct fbo_info *get_fbo(struct gs_device *device,
uint32_t width, uint32_t height, enum gs_color_format format);
extern void gl_update(gs_device_t device);
extern void gl_update(gs_device_t *device);
extern struct gl_platform *gl_platform_create(gs_device_t device,
extern struct gl_platform *gl_platform_create(gs_device_t *device,
struct gs_init_data *info);
extern struct gs_swap_chain *gl_platform_getswap(struct gl_platform *platform);
extern void gl_platform_destroy(struct gl_platform *platform);

View File

@@ -74,7 +74,7 @@ static bool create_pixel_unpack_buffer(struct gs_texture_2d *tex)
return success;
}
gs_texture_t device_texture_create(gs_device_t device, uint32_t width,
gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_color_format color_format,
uint32_t levels, const uint8_t **data, uint32_t flags)
{
@@ -104,15 +104,15 @@ gs_texture_t device_texture_create(gs_device_t device, uint32_t width,
goto fail;
}
return (gs_texture_t)tex;
return (gs_texture_t*)tex;
fail:
gs_texture_destroy((gs_texture_t)tex);
gs_texture_destroy((gs_texture_t*)tex);
blog(LOG_ERROR, "device_texture_create (GL) failed");
return NULL;
}
static inline bool is_texture_2d(gs_texture_t tex, const char *func)
static inline bool is_texture_2d(gs_texture_t *tex, const char *func)
{
bool is_tex2d = tex->type == GS_TEXTURE_2D;
if (!is_tex2d)
@@ -120,7 +120,7 @@ static inline bool is_texture_2d(gs_texture_t tex, const char *func)
return is_tex2d;
}
void gs_texture_destroy(gs_texture_t tex)
void gs_texture_destroy(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!tex)
@@ -141,7 +141,7 @@ void gs_texture_destroy(gs_texture_t tex)
bfree(tex);
}
uint32_t gs_texture_get_width(gs_texture_t tex)
uint32_t gs_texture_get_width(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_get_width"))
@@ -150,7 +150,7 @@ uint32_t gs_texture_get_width(gs_texture_t tex)
return tex2d->width;
}
uint32_t gs_texture_get_height(gs_texture_t tex)
uint32_t gs_texture_get_height(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_get_height"))
@@ -159,12 +159,12 @@ uint32_t gs_texture_get_height(gs_texture_t tex)
return tex2d->height;
}
enum gs_color_format gs_texture_get_color_format(gs_texture_t tex)
enum gs_color_format gs_texture_get_color_format(gs_texture_t *tex)
{
return tex->format;
}
bool gs_texture_map(gs_texture_t tex, uint8_t **ptr, uint32_t *linesize)
bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, uint32_t *linesize)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
@@ -194,7 +194,7 @@ fail:
return false;
}
void gs_texture_unmap(gs_texture_t tex)
void gs_texture_unmap(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_unmap"))
@@ -226,7 +226,7 @@ failed:
blog(LOG_ERROR, "gs_texture_unmap (GL) failed");
}
bool gs_texture_is_rect(gs_texture_t tex)
bool gs_texture_is_rect(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_unmap")) {
@@ -237,7 +237,7 @@ bool gs_texture_is_rect(gs_texture_t tex)
return tex2d->base.gl_target == GL_TEXTURE_RECTANGLE;
}
void *gs_texture_get_obj(gs_texture_t tex)
void *gs_texture_get_obj(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_unmap")) {

View File

@@ -58,7 +58,7 @@ static inline bool upload_texture_cube(struct gs_texture_cube *tex,
return success;
}
gs_texture_t device_cubetexture_create(gs_device_t device, uint32_t size,
gs_texture_t *device_cubetexture_create(gs_device_t *device, uint32_t size,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags)
{
@@ -79,15 +79,15 @@ gs_texture_t device_cubetexture_create(gs_device_t device, uint32_t size,
if (!upload_texture_cube(tex, data))
goto fail;
return (gs_texture_t)tex;
return (gs_texture_t*)tex;
fail:
gs_cubetexture_destroy((gs_texture_t)tex);
gs_cubetexture_destroy((gs_texture_t*)tex);
blog(LOG_ERROR, "device_cubetexture_create (GL) failed");
return NULL;
}
void gs_cubetexture_destroy(gs_texture_t tex)
void gs_cubetexture_destroy(gs_texture_t *tex)
{
if (!tex)
return;
@@ -100,7 +100,7 @@ void gs_cubetexture_destroy(gs_texture_t tex)
bfree(tex);
}
static inline bool is_texture_cube(gs_texture_t tex, const char *func)
static inline bool is_texture_cube(gs_texture_t *tex, const char *func)
{
bool is_texcube = tex->type == GS_TEXTURE_CUBE;
if (!is_texcube)
@@ -108,7 +108,7 @@ static inline bool is_texture_cube(gs_texture_t tex, const char *func)
return is_texcube;
}
uint32_t gs_cubetexture_get_size(gs_texture_t cubetex)
uint32_t gs_cubetexture_get_size(gs_texture_t *cubetex)
{
struct gs_texture_cube *cube = (struct gs_texture_cube*)cubetex;
if (!is_texture_cube(cubetex, "gs_cubetexture_get_size"))
@@ -117,7 +117,7 @@ uint32_t gs_cubetexture_get_size(gs_texture_t cubetex)
return cube->size;
}
enum gs_color_format gs_cubetexture_get_color_format(gs_texture_t cubetex)
enum gs_color_format gs_cubetexture_get_color_format(gs_texture_t *cubetex)
{
return cubetex->format;
}

View File

@@ -76,7 +76,7 @@ static bool create_buffers(struct gs_vertex_buffer *vb)
return true;
}
gs_vertbuffer_t device_vertexbuffer_create(gs_device_t device,
gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device,
struct gs_vb_data *data, uint32_t flags)
{
struct gs_vertex_buffer *vb = bzalloc(sizeof(struct gs_vertex_buffer));
@@ -94,7 +94,7 @@ gs_vertbuffer_t device_vertexbuffer_create(gs_device_t device,
return vb;
}
void gs_vertexbuffer_destroy(gs_vertbuffer_t vb)
void gs_vertexbuffer_destroy(gs_vertbuffer_t *vb)
{
if (vb) {
if (vb->vertex_buffer)
@@ -120,7 +120,7 @@ void gs_vertexbuffer_destroy(gs_vertbuffer_t vb)
}
}
void gs_vertexbuffer_flush(gs_vertbuffer_t vb)
void gs_vertexbuffer_flush(gs_vertbuffer_t *vb)
{
size_t i;
@@ -170,7 +170,7 @@ failed:
blog(LOG_ERROR, "gs_vertexbuffer_flush (GL) failed");
}
struct gs_vb_data *gs_vertexbuffer_get_data(gs_vertbuffer_t vb)
struct gs_vb_data *gs_vertexbuffer_get_data(gs_vertbuffer_t *vb)
{
return vb->data;
}
@@ -251,7 +251,7 @@ bool load_vb_buffers(struct gs_program *program, struct gs_vertex_buffer *vb)
return true;
}
void device_load_vertexbuffer(gs_device_t device, gs_vertbuffer_t vb)
void device_load_vertexbuffer(gs_device_t *device, gs_vertbuffer_t *vb)
{
device->cur_vertex_buffer = vb;
}

View File

@@ -350,7 +350,7 @@ static struct gl_windowinfo *gl_windowinfo_bare(struct gs_init_data *info)
return wi;
}
static bool init_default_swap(struct gl_platform *plat, gs_device_t device,
static bool init_default_swap(struct gl_platform *plat, gs_device_t *device,
int pixel_format, PIXELFORMATDESCRIPTOR *pfd,
struct gs_init_data *info)
{
@@ -366,13 +366,13 @@ static bool init_default_swap(struct gl_platform *plat, gs_device_t device,
return true;
}
void gl_update(gs_device_t device)
void gl_update(gs_device_t *device)
{
/* does nothing on windows */
UNUSED_PARAMETER(device);
}
struct gl_platform *gl_platform_create(gs_device_t device,
struct gl_platform *gl_platform_create(gs_device_t *device,
struct gs_init_data *info)
{
struct gl_platform *plat = bzalloc(sizeof(struct gl_platform));
@@ -475,7 +475,7 @@ void gl_windowinfo_destroy(struct gl_windowinfo *wi)
}
}
void device_enter_context(gs_device_t device)
void device_enter_context(gs_device_t *device)
{
HDC hdc = device->plat->swap.wi->hdc;
if (device->cur_swap)
@@ -485,13 +485,13 @@ void device_enter_context(gs_device_t device)
blog(LOG_ERROR, "device_load_swapchain (GL) failed");
}
void device_leave_context(gs_device_t device)
void device_leave_context(gs_device_t *device)
{
wglMakeCurrent(NULL, NULL);
UNUSED_PARAMETER(device);
}
void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap)
{
HDC hdc;
if (!swap)
@@ -510,7 +510,7 @@ void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
}
}
void device_present(gs_device_t device)
void device_present(gs_device_t *device)
{
if (!SwapBuffers(device->cur_swap->wi->hdc)) {
blog(LOG_ERROR, "SwapBuffers failed, GetLastError "

View File

@@ -135,7 +135,7 @@ static bool handle_x_error(Display *disp, const char *error_string)
return false;
}
struct gl_platform *gl_platform_create(gs_device_t device,
struct gl_platform *gl_platform_create(gs_device_t *device,
struct gs_init_data *info)
{
int num_configs = 0;
@@ -366,7 +366,7 @@ void gl_platform_cleanup_swapchain(struct gs_swap_chain *swap)
info->int_id = 0;
}
void device_enter_context(gs_device_t device)
void device_enter_context(gs_device_t *device)
{
GLXContext context = device->plat->context;
XID window = device->cur_swap->wi->glxid;
@@ -377,7 +377,7 @@ void device_enter_context(gs_device_t device)
}
}
void device_leave_context(gs_device_t device)
void device_leave_context(gs_device_t *device)
{
Display *display = device->cur_swap->wi->display;
@@ -386,7 +386,7 @@ void device_leave_context(gs_device_t device)
}
}
void gl_update(gs_device_t device)
void gl_update(gs_device_t *device)
{
Display *display = device->cur_swap->wi->display;
XID window = device->cur_swap->wi->int_id;
@@ -395,7 +395,7 @@ void gl_update(gs_device_t device)
device->cur_swap->info.cx, device->cur_swap->info.cy);
}
void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap)
{
if (!swap)
swap = &device->plat->swap;
@@ -414,7 +414,7 @@ void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
}
}
void device_present(gs_device_t device)
void device_present(gs_device_t *device)
{
Display *display = device->cur_swap->wi->display;
XID window = device->cur_swap->wi->glxid;

View File

@@ -48,7 +48,7 @@ static inline GLenum get_attachment(enum gs_zstencil_format format)
return 0;
}
gs_zstencil_t device_zstencil_create(gs_device_t device, uint32_t width,
gs_zstencil_t *device_zstencil_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_zstencil_format format)
{
struct gs_zstencil_buffer *zs;
@@ -67,7 +67,7 @@ gs_zstencil_t device_zstencil_create(gs_device_t device, uint32_t width,
return zs;
}
void gs_zstencil_destroy(gs_zstencil_t zs)
void gs_zstencil_destroy(gs_zstencil_t *zs)
{
if (zs) {
if (zs->buffer) {