GL/D3D11: Add scissor support

master
jp9000 2014-05-01 11:26:17 -07:00
parent 327c2f7ace
commit 5e2d283b9c
2 changed files with 21 additions and 8 deletions

View File

@ -1386,11 +1386,16 @@ void device_getviewport(device_t device, struct gs_rect *rect)
void device_setscissorrect(device_t device, struct gs_rect *rect)
{
D3D11_RECT d3drect;
d3drect.left = rect->x;
d3drect.top = rect->y;
d3drect.right = rect->x + rect->cx;
d3drect.bottom = rect->y + rect->cy;
device->context->RSSetScissorRects(1, &d3drect);
device->rasterState.scissorEnabled = (rect != NULL);
if (rect != NULL) {
d3drect.left = rect->x;
d3drect.top = rect->y;
d3drect.right = rect->x + rect->cx;
d3drect.bottom = rect->y + rect->cy;
device->context->RSSetScissorRects(1, &d3drect);
}
}
void device_ortho(device_t device, float left, float right, float top,

View File

@ -1180,9 +1180,17 @@ void device_getviewport(device_t device, struct gs_rect *rect)
void device_setscissorrect(device_t device, struct gs_rect *rect)
{
UNUSED_PARAMETER(device);
glScissor(rect->x, rect->y, rect->cx, rect->cy);
if (!gl_success("glScissor"))
blog(LOG_ERROR, "device_setscissorrect (GL) failed");
if (rect != NULL) {
glScissor(rect->x, rect->y, rect->cx, rect->cy);
if (gl_success("glScissor") && gl_enable(GL_SCISSOR_TEST))
return;
} else if (gl_disable(GL_SCISSOR_TEST)) {
return;
}
blog(LOG_ERROR, "device_setscissorrect (GL) failed");
}
void device_ortho(device_t device, float left, float right,