D3D: delete unnecessary code.

This commit is contained in:
magumagu 2015-01-26 10:58:32 -08:00
parent 7df55d220f
commit 897b678d24
3 changed files with 2 additions and 81 deletions

View File

@ -570,72 +570,6 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture,
D3D::stateman->SetGeometryShader(nullptr);
}
void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture,
const MathUtil::Rectangle<int>* rSource,
int SourceWidth,
int SourceHeight,
const MathUtil::Rectangle<float>* rDest,
ID3D11PixelShader* PShader,
ID3D11VertexShader* VShader,
ID3D11InputLayout* layout,
ID3D11GeometryShader* GShader,
float Gamma,
u32 slice)
{
float sw = 1.0f /(float) SourceWidth;
float sh = 1.0f /(float) SourceHeight;
float u1 = (rSource->left ) * sw;
float u2 = (rSource->right ) * sw;
float v1 = (rSource->top ) * sh;
float v2 = (rSource->bottom) * sh;
float S = (float)slice;
float G = 1.0f / Gamma;
STSQVertex coords[4] = {
{ rDest->left , rDest->bottom, 0.0f, u1, v2, S, G},
{ rDest->right, rDest->bottom, 0.0f, u2, v2, S, G},
{ rDest->left , rDest->top , 0.0f, u1, v1, S, G},
{ rDest->right, rDest->top , 0.0f, u2, v1, S, G},
};
// only upload the data to VRAM if it changed
if (stsq_observer ||
memcmp(rDest, &tex_sub_quad_data.rdest, sizeof(*rDest)) != 0 ||
tex_sub_quad_data.u1 != u1 || tex_sub_quad_data.v1 != v1 ||
tex_sub_quad_data.u2 != u2 || tex_sub_quad_data.v2 != v2 ||
tex_sub_quad_data.S != S || tex_sub_quad_data.G != G)
{
stsq_offset = util_vbuf->AppendData(coords, sizeof(coords), sizeof(STSQVertex));
stsq_observer = false;
tex_sub_quad_data.u1 = u1;
tex_sub_quad_data.v1 = v1;
tex_sub_quad_data.u2 = u2;
tex_sub_quad_data.v2 = v2;
tex_sub_quad_data.S = S;
tex_sub_quad_data.G = G;
memcpy(&tex_sub_quad_data.rdest, &rDest, sizeof(rDest));
}
UINT stride = sizeof(STSQVertex);
UINT offset = 0;
stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
stateman->SetVertexBuffer(util_vbuf->GetBuffer(), stride, offset);
stateman->SetInputLayout(layout);
stateman->SetTexture(0, texture);
stateman->SetPixelShader(PShader);
stateman->SetVertexShader(VShader);
stateman->SetGeometryShader(GShader);
stateman->Apply();
context->Draw(4, stsq_offset);
stateman->SetTexture(0, nullptr); // immediately unbind the texture
stateman->Apply();
stateman->SetGeometryShader(nullptr);
}
// Fills a certain area of the current render target with the specified color
// destination coordinates normalized to (-1;1)
void drawColorQuad(u32 Color, float x1, float y1, float x2, float y2)

View File

@ -65,17 +65,6 @@ namespace D3D
ID3D11GeometryShader* GShader = nullptr,
float Gamma = 1.0f,
u32 slice = 0);
void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture,
const MathUtil::Rectangle<int>* rSource,
int SourceWidth,
int SourceHeight,
const MathUtil::Rectangle<float>* rDest,
ID3D11PixelShader* PShader,
ID3D11VertexShader* VShader,
ID3D11InputLayout* layout,
ID3D11GeometryShader* GShader = nullptr,
float Gamma = 1.0f,
u32 slice = 0);
void drawClearQuad(u32 Color, float z);
void drawColorQuad(u32 Color, float x1, float y1, float x2, float y2);
}

View File

@ -148,15 +148,13 @@ void Television::Render()
// line down. We could even consider implementing a deinterlacing
// algorithm.
MathUtil::Rectangle<int> sourceRc(0, 0, int(m_curWidth), int(m_curHeight));
MathUtil::Rectangle<float> destRc(-1.f, 1.f, 1.f, -1.f);
D3D11_RECT sourceRc = CD3D11_RECT(0, 0, int(m_curWidth), int(m_curHeight));
D3D::stateman->SetSampler(0, m_samplerState);
D3D::drawShadedTexSubQuad(
D3D::drawShadedTexQuad(
m_yuyvTextureSRV, &sourceRc,
MAX_XFB_WIDTH, MAX_XFB_HEIGHT,
&destRc,
m_pShader,
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout());