This commit is contained in:
jp9000
2013-12-23 19:00:11 -07:00
8 changed files with 149 additions and 0 deletions

View File

@@ -165,5 +165,9 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
GRAPHICS_IMPORT(shader_setval);
GRAPHICS_IMPORT(shader_setdefault);
/* OSX/Cocoa specific functions */
GRAPHICS_IMPORT_OPTIONAL(texture_create_from_iosurface);
GRAPHICS_IMPORT_OPTIONAL(texture_rebind_iosurface);
return success;
}

View File

@@ -201,6 +201,10 @@ struct gs_exports {
void (*shader_setval)(shader_t shader, sparam_t param, const void *val,
size_t size);
void (*shader_setdefault)(shader_t shader, sparam_t param);
/* OSX/Cocoa specific functions */
texture_t (*texture_create_from_iosurface)(device_t dev, void *iosurf);
bool (*texture_rebind_iosurface)(texture_t texture, void *iosurf);
};
struct graphics_subsystem {

View File

@@ -1589,3 +1589,25 @@ enum gs_index_type indexbuffer_gettype(indexbuffer_t indexbuffer)
{
return thread_graphics->exports.indexbuffer_gettype(indexbuffer);
}
/** Platform specific functions */
texture_t gs_create_texture_from_iosurface(void *iosurf)
{
graphics_t graphics = thread_graphics;
if (!graphics->exports.texture_create_from_iosurface)
return NULL;
return graphics->exports.texture_create_from_iosurface(
graphics->device, iosurf);
}
bool texture_rebind_iosurface(texture_t texture, void *iosurf)
{
graphics_t graphics = thread_graphics;
if (!graphics->exports.texture_rebind_iosurface)
return false;
return graphics->exports.texture_rebind_iosurface(texture, iosurf);
}

View File

@@ -678,6 +678,11 @@ EXPORT void *indexbuffer_getdata(indexbuffer_t indexbuffer);
EXPORT size_t indexbuffer_numindices(indexbuffer_t indexbuffer);
EXPORT enum gs_index_type indexbuffer_gettype(indexbuffer_t indexbuffer);
/** platform specific function for creating (GL_TEXTURE_RECTANGLE) textures
* from shared surface resources */
EXPORT texture_t gs_create_texture_from_iosurface(void *iosurf);
EXPORT bool texture_rebind_iosurface(texture_t texture, void *iosurf);
/* inline functions used by modules */
static inline uint32_t gs_get_format_bpp(enum gs_color_format format)