From 897b678d24c9c173c5cbafa70c6575d9508e325c Mon Sep 17 00:00:00 2001 From: magumagu Date: Mon, 26 Jan 2015 10:58:32 -0800 Subject: [PATCH] D3D: delete unnecessary code. --- Source/Core/VideoBackends/D3D/D3DUtil.cpp | 66 -------------------- Source/Core/VideoBackends/D3D/D3DUtil.h | 11 ---- Source/Core/VideoBackends/D3D/Television.cpp | 6 +- 3 files changed, 2 insertions(+), 81 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/D3DUtil.cpp b/Source/Core/VideoBackends/D3D/D3DUtil.cpp index 020045d687..dd54756be1 100644 --- a/Source/Core/VideoBackends/D3D/D3DUtil.cpp +++ b/Source/Core/VideoBackends/D3D/D3DUtil.cpp @@ -570,72 +570,6 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture, D3D::stateman->SetGeometryShader(nullptr); } -void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture, - const MathUtil::Rectangle* rSource, - int SourceWidth, - int SourceHeight, - const MathUtil::Rectangle* 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) diff --git a/Source/Core/VideoBackends/D3D/D3DUtil.h b/Source/Core/VideoBackends/D3D/D3DUtil.h index 883f232b28..be5a52430c 100644 --- a/Source/Core/VideoBackends/D3D/D3DUtil.h +++ b/Source/Core/VideoBackends/D3D/D3DUtil.h @@ -65,17 +65,6 @@ namespace D3D ID3D11GeometryShader* GShader = nullptr, float Gamma = 1.0f, u32 slice = 0); - void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture, - const MathUtil::Rectangle* rSource, - int SourceWidth, - int SourceHeight, - const MathUtil::Rectangle* 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); } diff --git a/Source/Core/VideoBackends/D3D/Television.cpp b/Source/Core/VideoBackends/D3D/Television.cpp index ed54016ffd..1c7fa55a56 100644 --- a/Source/Core/VideoBackends/D3D/Television.cpp +++ b/Source/Core/VideoBackends/D3D/Television.cpp @@ -148,15 +148,13 @@ void Television::Render() // line down. We could even consider implementing a deinterlacing // algorithm. - MathUtil::Rectangle sourceRc(0, 0, int(m_curWidth), int(m_curHeight)); - MathUtil::Rectangle 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());