Add a 'flush' command to graphics subsystem

...I'm actually concerned that I went a bit overkill trying to prevent
backwards compatibility issues with this abstraction design, because
this is a large number of files that have to be modified just to add a
single graphics subsystem export.  Someone's going to strangle me, and
when you know that someone might strangle you, that means that you did
something wrong.  We'll have to look in to simplifying this in the
future without killing backward compatibility safety.
master
jp9000 2014-06-25 19:32:34 -07:00
parent 749cff2e3a
commit 27010a2f56
7 changed files with 22 additions and 0 deletions

View File

@ -1204,6 +1204,11 @@ void device_present(device_t device)
device->curSwapChain->swap->Present(0, 0);
}
void device_flush(device_t device)
{
device->context->Flush();
}
void device_setcullmode(device_t device, enum gs_cull_mode mode)
{
if (mode == device->rasterState.cullMode)

View File

@ -972,6 +972,11 @@ void device_clear(device_t device, uint32_t clear_flags,
UNUSED_PARAMETER(device);
}
void device_flush(device_t device)
{
glFlush();
}
void device_setcullmode(device_t device, enum gs_cull_mode mode)
{
if (device->cur_cull_mode == mode)

View File

@ -94,6 +94,7 @@ EXPORT void device_load_swapchain(device_t device, swapchain_t swapchain);
EXPORT void device_clear(device_t device, uint32_t clear_flags,
struct vec4 *color, float depth, uint8_t stencil);
EXPORT void device_present(device_t device);
EXPORT void device_flush(device_t device);
EXPORT void device_setcullmode(device_t device, enum gs_cull_mode mode);
EXPORT enum gs_cull_mode device_getcullmode(device_t device);
EXPORT void device_enable_blending(device_t device, bool enable);

View File

@ -83,6 +83,7 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
GRAPHICS_IMPORT(device_endscene);
GRAPHICS_IMPORT(device_clear);
GRAPHICS_IMPORT(device_present);
GRAPHICS_IMPORT(device_flush);
GRAPHICS_IMPORT(device_setcullmode);
GRAPHICS_IMPORT(device_getcullmode);
GRAPHICS_IMPORT(device_enable_blending);

View File

@ -100,6 +100,7 @@ struct gs_exports {
void (*device_clear)(device_t device, uint32_t clear_flags,
struct vec4 *color, float depth, uint8_t stencil);
void (*device_present)(device_t device);
void (*device_flush)(device_t device);
void (*device_setcullmode)(device_t device, enum gs_cull_mode mode);
enum gs_cull_mode (*device_getcullmode)(device_t device);
void (*device_enable_blending)(device_t device, bool enable);

View File

@ -1309,6 +1309,14 @@ void gs_present(void)
graphics->exports.device_present(graphics->device);
}
void gs_flush(void)
{
graphics_t graphics = thread_graphics;
if (!graphics) return;
graphics->exports.device_flush(graphics->device);
}
void gs_setcullmode(enum gs_cull_mode mode)
{
graphics_t graphics = thread_graphics;

View File

@ -594,6 +594,7 @@ EXPORT void gs_load_swapchain(swapchain_t swapchain);
EXPORT void gs_clear(uint32_t clear_flags, struct vec4 *color,
float depth, uint8_t stencil);
EXPORT void gs_present(void);
EXPORT void gs_flush(void);
EXPORT void gs_setcullmode(enum gs_cull_mode mode);
EXPORT enum gs_cull_mode gs_getcullmode(void);