simplified the new D3D11 partial clear code to not needlessly change primitive topology

This commit is contained in:
myT 2020-07-07 04:44:31 +02:00
parent a5c820644a
commit 49028a3f36
2 changed files with 3 additions and 23 deletions

View file

@ -28,8 +28,8 @@ struct VOut
VOut vs_main(uint id : SV_VertexID)
{
VOut output;
output.position.x = -1.0 + 2.0 * (float)(id / 2);
output.position.y = -1.0 + 2.0 * (float)(id % 2);
output.position.x = (float)(id / 2) * 4.0 - 1.0;
output.position.y = (float)(id % 2) * 4.0 - 1.0;
output.position.z = 1.0;
output.position.w = 1.0;

View file

@ -357,8 +357,6 @@ struct Direct3D
ID3D11RasterizerState* rasterStates[12];
int rasterStateIndex;
D3D11_PRIMITIVE_TOPOLOGY topology;
Pipeline pipelines[PID_COUNT];
PipelineId pipelineIndex;
@ -798,17 +796,6 @@ static void ApplySamplerState(UINT slot, textureWrap_t textureWrap, TextureMode
d3d.samplerStateIndices[slot] = index;
}
static void ApplyPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY topology)
{
if(topology == d3d.topology)
{
return;
}
d3ds.context->IASetPrimitiveTopology(topology);
d3d.topology = topology;
}
static void DrawIndexed(int indexCount)
{
if(d3d.splitBufferOffsets)
@ -842,12 +829,6 @@ static void ApplyPipeline(PipelineId index)
index = PID_POST_PROCESS;
}
const D3D11_PRIMITIVE_TOPOLOGY topology =
index == PID_CLEAR ?
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP :
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
ApplyPrimitiveTopology(topology);
Pipeline* const pipeline = &d3d.pipelines[index];
if(pipeline->inputLayout)
{
@ -1438,7 +1419,6 @@ static qbool GAL_Init()
D3D11_CreateInputLayout(genericInputLayoutDesc, ARRAY_LEN(genericInputLayoutDesc), g_generic_vs, ARRAY_LEN(g_generic_vs), &d3d.pipelines[PID_GENERIC].inputLayout, "generic input layout");
d3ds.context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
d3d.topology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
const int maxVertexCount = SHADER_MAX_VERTEXES;
const int maxIndexCount = SHADER_MAX_INDEXES;
@ -2638,7 +2618,7 @@ static void ClearViews(qbool shouldClearColor, const FLOAT* clearColor)
d3d.clearPSData.color[2] = clearColor[2];
d3d.clearPSData.color[3] = shouldClearColor ? 1.0f : 0.0f;
UploadPendingShaderData();
d3ds.context->Draw(4, 0);
d3ds.context->Draw(3, 0);
ApplyPipeline(PID_GENERIC);
}
}