(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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user