Add support for shared textures to graphics API
This commit is contained in:
@@ -174,9 +174,11 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
|
||||
/* win32 specific functions */
|
||||
#elif _WIN32
|
||||
GRAPHICS_IMPORT(device_gdi_texture_available);
|
||||
GRAPHICS_IMPORT(device_shared_texture_available);
|
||||
GRAPHICS_IMPORT_OPTIONAL(device_texture_create_gdi);
|
||||
GRAPHICS_IMPORT_OPTIONAL(gs_texture_get_dc);
|
||||
GRAPHICS_IMPORT_OPTIONAL(gs_texture_release_dc);
|
||||
GRAPHICS_IMPORT_OPTIONAL(device_texture_open_shared);
|
||||
#endif
|
||||
|
||||
return success;
|
||||
|
@@ -230,11 +230,16 @@ struct gs_exports {
|
||||
|
||||
#elif _WIN32
|
||||
bool (*device_gdi_texture_available)(void);
|
||||
bool (*device_shared_texture_available)(void);
|
||||
|
||||
gs_texture_t *(*device_texture_create_gdi)(gs_device_t *device,
|
||||
uint32_t width, uint32_t height);
|
||||
|
||||
void *(*gs_texture_get_dc)(gs_texture_t *gdi_tex);
|
||||
void (*gs_texture_release_dc)(gs_texture_t *gdi_tex);
|
||||
|
||||
gs_texture_t *(*device_texture_open_shared)(gs_device_t *device,
|
||||
uint32_t handle);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@@ -1959,6 +1959,14 @@ bool gs_gdi_texture_available(void)
|
||||
return thread_graphics->exports.device_gdi_texture_available();
|
||||
}
|
||||
|
||||
bool gs_shared_texture_available(void)
|
||||
{
|
||||
if (!thread_graphics)
|
||||
return false;
|
||||
|
||||
return thread_graphics->exports.device_shared_texture_available();
|
||||
}
|
||||
|
||||
/** creates a windows GDI-lockable texture */
|
||||
gs_texture_t *gs_texture_create_gdi(uint32_t width, uint32_t height)
|
||||
{
|
||||
@@ -1990,4 +1998,16 @@ void gs_texture_release_dc(gs_texture_t *gdi_tex)
|
||||
thread_graphics->exports.gs_texture_release_dc(gdi_tex);
|
||||
}
|
||||
|
||||
gs_texture_t *gs_texture_open_shared(uint32_t handle)
|
||||
{
|
||||
graphics_t *graphics = thread_graphics;
|
||||
if (!graphics)
|
||||
return NULL;
|
||||
|
||||
if (graphics->exports.device_texture_open_shared)
|
||||
return graphics->exports.device_texture_open_shared(
|
||||
graphics->device, handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -702,6 +702,7 @@ EXPORT bool gs_texture_rebind_iosurface(gs_texture_t *texture,
|
||||
#elif _WIN32
|
||||
|
||||
EXPORT bool gs_gdi_texture_available(void);
|
||||
EXPORT bool gs_shared_texture_available(void);
|
||||
|
||||
/** creates a windows GDI-lockable texture */
|
||||
EXPORT gs_texture_t *gs_texture_create_gdi(uint32_t width, uint32_t height);
|
||||
@@ -709,6 +710,8 @@ EXPORT gs_texture_t *gs_texture_create_gdi(uint32_t width, uint32_t height);
|
||||
EXPORT void *gs_texture_get_dc(gs_texture_t *gdi_tex);
|
||||
EXPORT void gs_texture_release_dc(gs_texture_t *gdi_tex);
|
||||
|
||||
/** creates a windows shared texture from a texture handle */
|
||||
EXPORT gs_texture_t *gs_texture_open_shared(uint32_t handle);
|
||||
#endif
|
||||
|
||||
/* inline functions used by modules */
|
||||
|
Reference in New Issue
Block a user