GL/D3D11: Add scissor support
parent
327c2f7ace
commit
5e2d283b9c
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue