Remove QueueDrawLines from D3D, D3D11

This commit is contained in:
Sylvain 2022-01-07 22:43:30 +01:00 committed by Sam Lantinga
parent b88b6b3c23
commit 9cb2c549fa
2 changed files with 2 additions and 36 deletions

View File

@ -1207,30 +1207,8 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
break; break;
} }
case SDL_RENDERCMD_DRAW_LINES: { case SDL_RENDERCMD_DRAW_LINES: /* unused */
const size_t count = cmd->data.draw.count;
const size_t first = cmd->data.draw.first;
const Vertex *verts = (Vertex *) (((Uint8 *) vertices) + first);
/* DirectX 9 has the same line rasterization semantics as GDI,
so we need to close the endpoint of the line with a second draw call. */
const SDL_bool close_endpoint = ((count == 2) || (verts[0].x != verts[count-1].x) || (verts[0].y != verts[count-1].y));
SetDrawState(data, cmd);
if (vbo) {
IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_LINESTRIP, (UINT) (first / sizeof (Vertex)), (UINT) (count - 1));
if (close_endpoint) {
IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_POINTLIST, (UINT) ((first / sizeof (Vertex)) + (count - 1)), 1);
}
} else {
IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_LINESTRIP, (UINT) (count - 1), verts, sizeof (Vertex));
if (close_endpoint) {
IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, 1, &verts[count-1], sizeof (Vertex));
}
}
break; break;
}
case SDL_RENDERCMD_FILL_RECTS: /* unused */ case SDL_RENDERCMD_FILL_RECTS: /* unused */
break; break;
@ -1567,7 +1545,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->QueueSetViewport = D3D_QueueSetViewport; renderer->QueueSetViewport = D3D_QueueSetViewport;
renderer->QueueSetDrawColor = D3D_QueueSetViewport; /* SetViewport and SetDrawColor are (currently) no-ops. */ renderer->QueueSetDrawColor = D3D_QueueSetViewport; /* SetViewport and SetDrawColor are (currently) no-ops. */
renderer->QueueDrawPoints = D3D_QueueDrawPoints; renderer->QueueDrawPoints = D3D_QueueDrawPoints;
renderer->QueueDrawLines = D3D_QueueDrawPoints; /* lines and points queue vertices the same way. */
renderer->QueueGeometry = D3D_QueueGeometry; renderer->QueueGeometry = D3D_QueueGeometry;
renderer->RunCommandQueue = D3D_RunCommandQueue; renderer->RunCommandQueue = D3D_RunCommandQueue;
renderer->RenderReadPixels = D3D_RenderReadPixels; renderer->RenderReadPixels = D3D_RenderReadPixels;

View File

@ -2122,18 +2122,8 @@ D3D11_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
break; break;
} }
case SDL_RENDERCMD_DRAW_LINES: { case SDL_RENDERCMD_DRAW_LINES: /* unused */
const size_t count = cmd->data.draw.count;
const size_t first = cmd->data.draw.first;
const size_t start = first / sizeof (VertexPositionColor);
const VertexPositionColor *verts = (VertexPositionColor *) (((Uint8 *) vertices) + first);
D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL, NULL);
D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, start, count);
if (verts[0].pos.x != verts[count - 1].pos.x || verts[0].pos.y != verts[count - 1].pos.y) {
D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, start + (count-1), 1);
}
break; break;
}
case SDL_RENDERCMD_FILL_RECTS: /* unused */ case SDL_RENDERCMD_FILL_RECTS: /* unused */
break; break;
@ -2386,7 +2376,6 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->QueueSetViewport = D3D11_QueueSetViewport; renderer->QueueSetViewport = D3D11_QueueSetViewport;
renderer->QueueSetDrawColor = D3D11_QueueSetViewport; /* SetViewport and SetDrawColor are (currently) no-ops. */ renderer->QueueSetDrawColor = D3D11_QueueSetViewport; /* SetViewport and SetDrawColor are (currently) no-ops. */
renderer->QueueDrawPoints = D3D11_QueueDrawPoints; renderer->QueueDrawPoints = D3D11_QueueDrawPoints;
renderer->QueueDrawLines = D3D11_QueueDrawPoints; /* lines and points queue vertices the same way. */
renderer->QueueGeometry = D3D11_QueueGeometry; renderer->QueueGeometry = D3D11_QueueGeometry;
renderer->RunCommandQueue = D3D11_RunCommandQueue; renderer->RunCommandQueue = D3D11_RunCommandQueue;
renderer->RenderReadPixels = D3D11_RenderReadPixels; renderer->RenderReadPixels = D3D11_RenderReadPixels;