PixelShaderCache: Support stereoscopic EFB format changes.

This commit is contained in:
Jules Blok 2014-12-21 15:37:05 +01:00
parent ba242d27c8
commit 737bc0e7ad
5 changed files with 20 additions and 20 deletions

View File

@ -697,7 +697,7 @@ void drawClearQuad(u32 Color, float z)
} }
stateman->SetVertexShader(VertexShaderCache::GetClearVertexShader()); stateman->SetVertexShader(VertexShaderCache::GetClearVertexShader());
stateman->SetGeometryShader(g_ActiveConfig.iStereoMode > 0 ? GeometryShaderCache::GetClearGeometryShader() : nullptr); stateman->SetGeometryShader(GeometryShaderCache::GetClearGeometryShader());
stateman->SetPixelShader(PixelShaderCache::GetClearProgram()); stateman->SetPixelShader(PixelShaderCache::GetClearProgram());
stateman->SetInputLayout(VertexShaderCache::GetClearInputLayout()); stateman->SetInputLayout(VertexShaderCache::GetClearInputLayout());

View File

@ -12,6 +12,7 @@
#include "VideoBackends/D3D/D3DBase.h" #include "VideoBackends/D3D/D3DBase.h"
#include "VideoBackends/D3D/D3DShader.h" #include "VideoBackends/D3D/D3DShader.h"
#include "VideoBackends/D3D/FramebufferManager.h"
#include "VideoBackends/D3D/GeometryShaderCache.h" #include "VideoBackends/D3D/GeometryShaderCache.h"
#include "VideoBackends/D3D/Globals.h" #include "VideoBackends/D3D/Globals.h"
@ -35,8 +36,8 @@ ID3D11GeometryShader* CopyGeometryShader = nullptr;
LinearDiskCache<GeometryShaderUid, u8> g_gs_disk_cache; LinearDiskCache<GeometryShaderUid, u8> g_gs_disk_cache;
ID3D11GeometryShader* GeometryShaderCache::GetClearGeometryShader() { return ClearGeometryShader; } ID3D11GeometryShader* GeometryShaderCache::GetClearGeometryShader() { return (FramebufferManager::GetEFBLayers() > 1) ? ClearGeometryShader: nullptr; }
ID3D11GeometryShader* GeometryShaderCache::GetCopyGeometryShader() { return CopyGeometryShader; } ID3D11GeometryShader* GeometryShaderCache::GetCopyGeometryShader() { return (FramebufferManager::GetEFBLayers() > 1) ? CopyGeometryShader : nullptr; }
ID3D11Buffer* gscbuf = nullptr; ID3D11Buffer* gscbuf = nullptr;

View File

@ -201,11 +201,11 @@ const char depth_matrix_program_msaa[] = {
const char reint_rgba6_to_rgb8[] = { const char reint_rgba6_to_rgb8[] = {
"sampler samp0 : register(s0);\n" "sampler samp0 : register(s0);\n"
"Texture2D Tex0 : register(t0);\n" "Texture2DArray Tex0 : register(t0);\n"
"void main(\n" "void main(\n"
" out float4 ocol0 : SV_Target,\n" " out float4 ocol0 : SV_Target,\n"
" in float4 pos : SV_Position,\n" " in float4 pos : SV_Position,\n"
" in float2 uv0 : TEXCOORD0)\n" " in float3 uv0 : TEXCOORD0)\n"
"{\n" "{\n"
" int4 src6 = round(Tex0.Sample(samp0,uv0) * 63.f);\n" " int4 src6 = round(Tex0.Sample(samp0,uv0) * 63.f);\n"
" int4 dst8;\n" " int4 dst8;\n"
@ -219,17 +219,17 @@ const char reint_rgba6_to_rgb8[] = {
const char reint_rgba6_to_rgb8_msaa[] = { const char reint_rgba6_to_rgb8_msaa[] = {
"sampler samp0 : register(s0);\n" "sampler samp0 : register(s0);\n"
"Texture2DMS<float4, %d> Tex0 : register(t0);\n" "Texture2DMSArray<float4, %d> Tex0 : register(t0);\n"
"void main(\n" "void main(\n"
" out float4 ocol0 : SV_Target,\n" " out float4 ocol0 : SV_Target,\n"
" in float4 pos : SV_Position,\n" " in float4 pos : SV_Position,\n"
" in float2 uv0 : TEXCOORD0)\n" " in float3 uv0 : TEXCOORD0)\n"
"{\n" "{\n"
" int width, height, samples;\n" " int width, height, slices, samples;\n"
" Tex0.GetDimensions(width, height, samples);\n" " Tex0.GetDimensions(width, height, slices, samples);\n"
" float4 texcol = 0;\n" " float4 texcol = 0;\n"
" for (int i = 0; i < samples; ++i)\n" " for (int i = 0; i < samples; ++i)\n"
" texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n" " texcol += Tex0.Load(int3(uv0.x*(width), uv0.y*(height), uv0.z), i);\n"
" texcol /= samples;\n" " texcol /= samples;\n"
" int4 src6 = round(texcol * 63.f);\n" " int4 src6 = round(texcol * 63.f);\n"
" int4 dst8;\n" " int4 dst8;\n"
@ -243,11 +243,11 @@ const char reint_rgba6_to_rgb8_msaa[] = {
const char reint_rgb8_to_rgba6[] = { const char reint_rgb8_to_rgba6[] = {
"sampler samp0 : register(s0);\n" "sampler samp0 : register(s0);\n"
"Texture2D Tex0 : register(t0);\n" "Texture2DArray Tex0 : register(t0);\n"
"void main(\n" "void main(\n"
" out float4 ocol0 : SV_Target,\n" " out float4 ocol0 : SV_Target,\n"
" in float4 pos : SV_Position,\n" " in float4 pos : SV_Position,\n"
" in float2 uv0 : TEXCOORD0)\n" " in float3 uv0 : TEXCOORD0)\n"
"{\n" "{\n"
" int4 src8 = round(Tex0.Sample(samp0,uv0) * 255.f);\n" " int4 src8 = round(Tex0.Sample(samp0,uv0) * 255.f);\n"
" int4 dst6;\n" " int4 dst6;\n"
@ -261,17 +261,17 @@ const char reint_rgb8_to_rgba6[] = {
const char reint_rgb8_to_rgba6_msaa[] = { const char reint_rgb8_to_rgba6_msaa[] = {
"sampler samp0 : register(s0);\n" "sampler samp0 : register(s0);\n"
"Texture2DMS<float4, %d> Tex0 : register(t0);\n" "Texture2DMSArray<float4, %d> Tex0 : register(t0);\n"
"void main(\n" "void main(\n"
" out float4 ocol0 : SV_Target,\n" " out float4 ocol0 : SV_Target,\n"
" in float4 pos : SV_Position,\n" " in float4 pos : SV_Position,\n"
" in float2 uv0 : TEXCOORD0)\n" " in float3 uv0 : TEXCOORD0)\n"
"{\n" "{\n"
" int width, height, samples;\n" " int width, height, slices, samples;\n"
" Tex0.GetDimensions(width, height, samples);\n" " Tex0.GetDimensions(width, height, slices, samples);\n"
" float4 texcol = 0;\n" " float4 texcol = 0;\n"
" for (int i = 0; i < samples; ++i)\n" " for (int i = 0; i < samples; ++i)\n"
" texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n" " texcol += Tex0.Load(int3(uv0.x*(width), uv0.y*(height), uv0.z), i);\n"
" texcol /= samples;\n" " texcol /= samples;\n"
" int4 src8 = round(texcol * 255.f);\n" " int4 src8 = round(texcol * 255.f);\n"
" int4 dst6;\n" " int4 dst6;\n"

View File

@ -577,7 +577,7 @@ void Renderer::ReinterpretPixelData(unsigned int convtype)
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTempTexture()->GetRTV(), nullptr); D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTempTexture()->GetRTV(), nullptr);
D3D::SetPointCopySampler(); D3D::SetPointCopySampler();
D3D::drawShadedTexQuad(FramebufferManager::GetEFBColorTexture()->GetSRV(), &source, g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight(), pixel_shader, VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout()); D3D::drawShadedTexQuad(FramebufferManager::GetEFBColorTexture()->GetSRV(), &source, g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight(), pixel_shader, VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout(), GeometryShaderCache::GetCopyGeometryShader());
g_renderer->RestoreAPIState(); g_renderer->RestoreAPIState();

View File

@ -168,8 +168,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
(srcFormat == PEControl::Z24) ? FramebufferManager::GetEFBDepthTexture()->GetSRV() : FramebufferManager::GetEFBColorTexture()->GetSRV(), (srcFormat == PEControl::Z24) ? FramebufferManager::GetEFBDepthTexture()->GetSRV() : FramebufferManager::GetEFBColorTexture()->GetSRV(),
&sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(), &sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
(srcFormat == PEControl::Z24) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true), (srcFormat == PEControl::Z24) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true),
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout(), VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout(), GeometryShaderCache::GetCopyGeometryShader());
(g_Config.iStereoMode > 0) ? GeometryShaderCache::GetCopyGeometryShader() : nullptr);
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV()); D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());