mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-25 08:59:58 +00:00
Merge pull request #8104 from bparker06/d3d_scissor
implement scissor test for D3D10/11
This commit is contained in:
commit
1546ba05d4
@ -68,6 +68,18 @@ d3d10_overlay_vertex_geom(void* data, unsigned index, float x, float y, float w,
|
||||
D3D10UnmapBuffer(d3d10->overlays.vbo);
|
||||
}
|
||||
|
||||
static void d3d10_clear_scissor(d3d10_video_t *d3d10)
|
||||
{
|
||||
D3D10_RECT scissor_rect = {0};
|
||||
|
||||
scissor_rect.left = d3d10->vp.x;
|
||||
scissor_rect.top = d3d10->vp.y;
|
||||
scissor_rect.right = d3d10->vp.width;
|
||||
scissor_rect.bottom = d3d10->vp.height;
|
||||
|
||||
D3D10SetScissorRects(d3d10->device, 1, &scissor_rect);
|
||||
}
|
||||
|
||||
static void d3d10_overlay_tex_geom(void* data, unsigned index, float u, float v, float w, float h)
|
||||
{
|
||||
d3d10_sprite_t* sprites = NULL;
|
||||
@ -257,6 +269,8 @@ static void d3d10_update_viewport(void* data, bool force_full)
|
||||
d3d10->frame.output_size.w = 1.0f / d3d10->vp.height;
|
||||
|
||||
d3d10->resize_viewport = false;
|
||||
|
||||
d3d10_clear_scissor(d3d10);
|
||||
}
|
||||
|
||||
static void d3d10_free_shader_preset(d3d10_video_t* d3d10)
|
||||
@ -921,6 +935,7 @@ d3d10_gfx_init(const video_info_t* video,
|
||||
|
||||
desc.FillMode = D3D10_FILL_SOLID;
|
||||
desc.CullMode = D3D10_CULL_NONE;
|
||||
desc.ScissorEnable = TRUE;
|
||||
|
||||
D3D10CreateRasterizerState(d3d10->device, &desc, &d3d10->state);
|
||||
}
|
||||
@ -1318,6 +1333,8 @@ static bool d3d10_gfx_frame(
|
||||
D3D10ClearRenderTargetView(context, d3d10->renderTargetView, d3d10->clearcolor);
|
||||
D3D10SetViewports(context, 1, &d3d10->frame.viewport);
|
||||
|
||||
d3d10_clear_scissor(d3d10);
|
||||
|
||||
D3D10Draw(context, 4, 0);
|
||||
|
||||
D3D10SetBlendState(context, d3d10->blend_enable, NULL, D3D10_DEFAULT_SAMPLE_MASK);
|
||||
|
@ -81,6 +81,18 @@ d3d11_overlay_vertex_geom(void* data, unsigned index, float x, float y, float w,
|
||||
D3D11UnmapBuffer(d3d11->context, d3d11->overlays.vbo, 0);
|
||||
}
|
||||
|
||||
static void d3d11_clear_scissor(d3d11_video_t *d3d11)
|
||||
{
|
||||
D3D11_RECT scissor_rect = {0};
|
||||
|
||||
scissor_rect.left = d3d11->vp.x;
|
||||
scissor_rect.top = d3d11->vp.y;
|
||||
scissor_rect.right = d3d11->vp.width;
|
||||
scissor_rect.bottom = d3d11->vp.height;
|
||||
|
||||
D3D11SetScissorRects(d3d11->context, 1, &scissor_rect);
|
||||
}
|
||||
|
||||
static void d3d11_overlay_tex_geom(void* data, unsigned index, float u, float v, float w, float h)
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE mapped_vbo;
|
||||
@ -272,6 +284,8 @@ static void d3d11_update_viewport(void* data, bool force_full)
|
||||
d3d11->frame.output_size.w = 1.0f / d3d11->vp.height;
|
||||
|
||||
d3d11->resize_viewport = false;
|
||||
|
||||
d3d11_clear_scissor(d3d11);
|
||||
}
|
||||
|
||||
static void d3d11_free_shader_preset(d3d11_video_t* d3d11)
|
||||
@ -993,6 +1007,7 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
|
||||
|
||||
desc.FillMode = D3D11_FILL_SOLID;
|
||||
desc.CullMode = D3D11_CULL_NONE;
|
||||
desc.ScissorEnable = TRUE;
|
||||
|
||||
D3D11CreateRasterizerState(d3d11->device, &desc, &d3d11->state);
|
||||
}
|
||||
|
@ -275,6 +275,40 @@ static bool menu_display_d3d10_font_init_first(
|
||||
return true;
|
||||
}
|
||||
|
||||
void menu_display_d3d10_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height)
|
||||
{
|
||||
D3D10_RECT rect = {0};
|
||||
d3d10_video_t *d3d10 = video_info ?
|
||||
(d3d10_video_t*)video_info->userdata : NULL;
|
||||
|
||||
rect.left = x;
|
||||
rect.top = y;
|
||||
rect.right = width + x;
|
||||
rect.bottom = height + y;
|
||||
|
||||
if (!d3d10 || !width || !height)
|
||||
return;
|
||||
|
||||
D3D10SetScissorRects(d3d10->device, 1, &rect);
|
||||
}
|
||||
|
||||
void menu_display_d3d10_scissor_end(video_frame_info_t *video_info)
|
||||
{
|
||||
D3D10_RECT rect = {0};
|
||||
d3d10_video_t *d3d10 = video_info ?
|
||||
(d3d10_video_t*)video_info->userdata : NULL;
|
||||
|
||||
if (!d3d10)
|
||||
return;
|
||||
|
||||
rect.left = d3d10->vp.x;
|
||||
rect.top = d3d10->vp.y;
|
||||
rect.right = d3d10->vp.width;
|
||||
rect.bottom = d3d10->vp.height;
|
||||
|
||||
D3D10SetScissorRects(d3d10->device, 1, &rect);
|
||||
}
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_d3d10 = {
|
||||
menu_display_d3d10_draw,
|
||||
menu_display_d3d10_draw_pipeline,
|
||||
@ -290,6 +324,6 @@ menu_display_ctx_driver_t menu_display_ctx_d3d10 = {
|
||||
MENU_VIDEO_DRIVER_DIRECT3D10,
|
||||
"d3d10",
|
||||
true,
|
||||
NULL,
|
||||
NULL
|
||||
menu_display_d3d10_scissor_begin,
|
||||
menu_display_d3d10_scissor_end
|
||||
};
|
||||
|
@ -274,6 +274,40 @@ static bool menu_display_d3d11_font_init_first(
|
||||
return true;
|
||||
}
|
||||
|
||||
void menu_display_d3d11_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height)
|
||||
{
|
||||
D3D11_RECT rect = {0};
|
||||
d3d11_video_t *d3d11 = video_info ?
|
||||
(d3d11_video_t*)video_info->userdata : NULL;
|
||||
|
||||
rect.left = x;
|
||||
rect.top = y;
|
||||
rect.right = width + x;
|
||||
rect.bottom = height + y;
|
||||
|
||||
if (!d3d11 || !width || !height)
|
||||
return;
|
||||
|
||||
D3D11SetScissorRects(d3d11->context, 1, &rect);
|
||||
}
|
||||
|
||||
void menu_display_d3d11_scissor_end(video_frame_info_t *video_info)
|
||||
{
|
||||
D3D11_RECT rect = {0};
|
||||
d3d11_video_t *d3d11 = video_info ?
|
||||
(d3d11_video_t*)video_info->userdata : NULL;
|
||||
|
||||
if (!d3d11)
|
||||
return;
|
||||
|
||||
rect.left = d3d11->vp.x;
|
||||
rect.top = d3d11->vp.y;
|
||||
rect.right = d3d11->vp.width;
|
||||
rect.bottom = d3d11->vp.height;
|
||||
|
||||
D3D11SetScissorRects(d3d11->context, 1, &rect);
|
||||
}
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_d3d11 = {
|
||||
menu_display_d3d11_draw,
|
||||
menu_display_d3d11_draw_pipeline,
|
||||
@ -289,6 +323,6 @@ menu_display_ctx_driver_t menu_display_ctx_d3d11 = {
|
||||
MENU_VIDEO_DRIVER_DIRECT3D11,
|
||||
"d3d11",
|
||||
true,
|
||||
NULL,
|
||||
NULL
|
||||
menu_display_d3d11_scissor_begin,
|
||||
menu_display_d3d11_scissor_end
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user