Skip to content

Commit

Permalink
Fix scissoring for d3d10 and d3d11
Browse files Browse the repository at this point in the history
  • Loading branch information
natinusala committed Jan 28, 2019
1 parent e8e384a commit 04b2ffc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
14 changes: 6 additions & 8 deletions gfx/drivers/d3d10.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ 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)
static void d3d10_clear_scissor(d3d10_video_t *d3d10, video_frame_info_t *video_info)
{
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;
scissor_rect.left = 0;
scissor_rect.top = 0;
scissor_rect.right = video_info->width;
scissor_rect.bottom = video_info->height;

D3D10SetScissorRects(d3d10->device, 1, &scissor_rect);
}
Expand Down Expand Up @@ -269,8 +269,6 @@ 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)
Expand Down Expand Up @@ -1333,7 +1331,7 @@ static bool d3d10_gfx_frame(
D3D10ClearRenderTargetView(context, d3d10->renderTargetView, d3d10->clearcolor);
D3D10SetViewports(context, 1, &d3d10->frame.viewport);

d3d10_clear_scissor(d3d10);
d3d10_clear_scissor(d3d10, video_info);

D3D10Draw(context, 4, 0);

Expand Down
14 changes: 7 additions & 7 deletions gfx/drivers/d3d11.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ 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)
static void d3d11_clear_scissor(d3d11_video_t *d3d11, video_frame_info_t *video_info)
{
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;
scissor_rect.left = 0;
scissor_rect.top = 0;
scissor_rect.right = video_info->width;
scissor_rect.bottom = video_info->height;

D3D11SetScissorRects(d3d11->context, 1, &scissor_rect);
}
Expand Down Expand Up @@ -284,8 +284,6 @@ 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)
Expand Down Expand Up @@ -1393,6 +1391,8 @@ static bool d3d11_gfx_frame(
D3D11ClearRenderTargetView(context, d3d11->renderTargetView, d3d11->clearcolor);
D3D11SetViewports(context, 1, &d3d11->frame.viewport);

d3d11_clear_scissor(d3d11, video_info);

D3D11Draw(context, 4, 0);

D3D11SetBlendState(context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
Expand Down

0 comments on commit 04b2ffc

Please sign in to comment.