diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 4669a95395..e58b0d87fb 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -469,6 +469,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, { case 0: // Z4 colmat[3] = colmat[7] = colmat[11] = colmat[15] = 1; + cbufid = 20; break; case 1: // Z8 case 8: // Z8 diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp index f0779997e5..a4a8cb5956 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp @@ -123,8 +123,8 @@ const char depth_matrix_program[] = { " in float4 pos : SV_Position,\n" " in float2 uv0 : TEXCOORD0){\n" "float4 texcol = Tex0.Sample(samp0,uv0);\n" - "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,256.0f,256.0f*256.0f,256.0f*256.0f*16.0f));\n" - "texcol = round(EncodedDepth * (16777216.0f/16777215.0f) * 255.0f) / 255.0f;\n" + "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,256.0f,256.0f*256.0f,1.0f));\n" + "texcol = round(EncodedDepth * (16777216.0f/16777215.0f) * float4(255.0f,255.0f,255.0f,15.0f)) / float4(255.0f,255.0f,255.0f,15.0f);\n" "ocol0 = float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3])) + cColMatrix[4];\n" "}\n" }; @@ -143,8 +143,8 @@ const char depth_matrix_program_msaa[] = { "for(int i = 0; i < samples; ++i)\n" " texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n" "texcol /= samples;\n" - "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,256.0f,256.0f*256.0f,256.0f*256.0f*16.0f));\n" - "texcol = round(EncodedDepth * (16777216.0f/16777215.0f) * 255.0f) / 255.0f;\n" + "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,256.0f,256.0f*256.0f,16.0f));\n" + "texcol = round(EncodedDepth * (16777216.0f/16777215.0f) * float4(255.0f,255.0f,255.0f,15.0f)) / float4(255.0f,255.0f,255.0f,15.0f);\n" "ocol0 = float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3])) + cColMatrix[4];\n" "}\n" }; diff --git a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp index 4de1b07f7d..7347ebe5d0 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp @@ -43,7 +43,8 @@ namespace DX11 { -ID3D11Buffer* efbcopycbuf[20] = {}; +#define MAX_COPY_BUFFERS 21 +ID3D11Buffer* efbcopycbuf[MAX_COPY_BUFFERS] = {}; TextureCache::TCacheEntry::~TCacheEntry() { @@ -165,7 +166,7 @@ TextureCache::TextureCache() TextureCache::~TextureCache() { - for (unsigned int k = 0; k < 20; ++k) + for (unsigned int k = 0; k < MAX_COPY_BUFFERS; ++k) SAFE_RELEASE(efbcopycbuf[k]); } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp index ef18468fc2..b1da00de83 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp @@ -195,8 +195,8 @@ static LPDIRECT3DPIXELSHADER9 CreateCopyShader(int copyMatrixType, int depthConv break; case PixelShaderCache::DEPTH_CONVERSION_TYPE_16BIT: case PixelShaderCache::DEPTH_CONVERSION_TYPE_24BIT: - WRITE(p, "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,256.0f,256.0f*256.0f,256.0f*256.0f*16.0f));\n" - "texcol = round(EncodedDepth * (16777216.0f/16777215.0f) * 255.0f) / 255.0f;\n"); + WRITE(p, "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,256.0f,256.0f*256.0f,1.0f));\n" + "texcol = round(EncodedDepth * (16777216.0f/16777215.0f) * float4(255.0f,255.0f,255.0f,15.0f)) / float4(255.0f,255.0f,255.0f,15.0f);\n"); break; } //Apply Gamma Correction