a little cleanup of dx9 depth conversion code that r6751 made unnecessary, and a question about D3DFMT_D24X8 checks, and (most importantly) spelled Stretch right in video config
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6757 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
95b6d3f445
commit
4f45b422a2
|
@ -3153,7 +3153,7 @@ msgid "Stop"
|
|||
msgstr ""
|
||||
|
||||
#: Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp:163
|
||||
msgid "Strech to Window"
|
||||
msgid "Stretch to Window"
|
||||
msgstr ""
|
||||
|
||||
#: Source/Core/InputUICommon/Src/WXInputBase.cpp:75
|
||||
|
|
|
@ -160,7 +160,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||
// aspect-ratio
|
||||
{
|
||||
const wxString ar_choices[] = { _("Auto [recommended]"),
|
||||
_("Force 16:9"), _("Force 4:3"), _("Strech to Window") };
|
||||
_("Force 16:9"), _("Force 4:3"), _("Stretch to Window") };
|
||||
|
||||
szr_basic->Add(new wxStaticText(page_general, -1, _("Aspect ratio:")), 1, wxALIGN_CENTER_VERTICAL, 0);
|
||||
wxChoice* const choice_aspect = new SettingChoice(page_general,
|
||||
|
|
|
@ -80,6 +80,7 @@ FramebufferManager::FramebufferManager()
|
|||
|
||||
// Render buffer for AccessEFB (depth data)
|
||||
D3DFORMAT DepthTexFormats[2];
|
||||
// TODO: why is D3DFMT_D24X8 singled out here? why not D3DFMT_D24X4S4/D24S8/D24FS8/D32/D16/D15S1 too, or none of them?
|
||||
if (s_efb.depth_surface_Format == FOURCC_RAWZ || s_efb.depth_surface_Format == D3DFMT_D24X8)
|
||||
DepthTexFormats[0] = D3DFMT_A8R8G8B8;
|
||||
else
|
||||
|
|
|
@ -50,8 +50,14 @@ enum
|
|||
COPY_TYPE_MATRIXCOLOR,
|
||||
NUM_COPY_TYPES
|
||||
};
|
||||
enum
|
||||
{
|
||||
DEPTH_CONVERSION_TYPE_NONE,
|
||||
DEPTH_CONVERSION_TYPE_ON,
|
||||
NUM_DEPTH_CONVERSION_TYPES
|
||||
};
|
||||
|
||||
static LPDIRECT3DPIXELSHADER9 s_CopyProgram[NUM_COPY_TYPES][PixelShaderCache::NUM_DEPTH_CONVERSION_TYPES][MAX_SSAA_SHADERS];
|
||||
static LPDIRECT3DPIXELSHADER9 s_CopyProgram[NUM_COPY_TYPES][NUM_DEPTH_CONVERSION_TYPES][MAX_SSAA_SHADERS];
|
||||
static LPDIRECT3DPIXELSHADER9 s_ClearProgram = NULL;
|
||||
static LPDIRECT3DPIXELSHADER9 s_rgba6_to_rgb8 = NULL;
|
||||
static LPDIRECT3DPIXELSHADER9 s_rgb8_to_rgba6 = NULL;
|
||||
|
@ -61,9 +67,9 @@ LPDIRECT3DPIXELSHADER9 PixelShaderCache::GetColorMatrixProgram(int SSAAMode)
|
|||
return s_CopyProgram[COPY_TYPE_MATRIXCOLOR][DEPTH_CONVERSION_TYPE_NONE][SSAAMode % MAX_SSAA_SHADERS];
|
||||
}
|
||||
|
||||
LPDIRECT3DPIXELSHADER9 PixelShaderCache::GetDepthMatrixProgram(int SSAAMode, int depthConversionType)
|
||||
LPDIRECT3DPIXELSHADER9 PixelShaderCache::GetDepthMatrixProgram(int SSAAMode, bool depthConversion)
|
||||
{
|
||||
return s_CopyProgram[COPY_TYPE_MATRIXCOLOR][depthConversionType % NUM_DEPTH_CONVERSION_TYPES][SSAAMode % MAX_SSAA_SHADERS];
|
||||
return s_CopyProgram[COPY_TYPE_MATRIXCOLOR][depthConversion ? DEPTH_CONVERSION_TYPE_ON : DEPTH_CONVERSION_TYPE_NONE][SSAAMode % MAX_SSAA_SHADERS];
|
||||
}
|
||||
|
||||
LPDIRECT3DPIXELSHADER9 PixelShaderCache::GetColorCopyProgram(int SSAAMode)
|
||||
|
@ -189,25 +195,19 @@ static LPDIRECT3DPIXELSHADER9 CreateCopyShader(int copyMatrixType, int depthConv
|
|||
break;
|
||||
}
|
||||
|
||||
switch(depthConversionType % PixelShaderCache::NUM_DEPTH_CONVERSION_TYPES)
|
||||
if(depthConversionType != DEPTH_CONVERSION_TYPE_NONE)
|
||||
{
|
||||
case PixelShaderCache::DEPTH_CONVERSION_TYPE_NONE:
|
||||
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,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
|
||||
if((depthConversionType % PixelShaderCache::NUM_DEPTH_CONVERSION_TYPES) == PixelShaderCache::DEPTH_CONVERSION_TYPE_NONE)
|
||||
else
|
||||
{
|
||||
//Apply Gamma Correction
|
||||
WRITE(p, "texcol = pow(texcol,uv1.xxxx);\n");
|
||||
}
|
||||
|
||||
if(copyMatrixType == COPY_TYPE_MATRIXCOLOR)
|
||||
{
|
||||
|
||||
WRITE(p, "ocol0 = float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3])) + cColMatrix[4];\n");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -62,14 +62,7 @@ public:
|
|||
static bool InsertByteCode(const PIXELSHADERUID &uid, const u8 *bytecode, int bytecodelen, bool activate);
|
||||
static LPDIRECT3DPIXELSHADER9 GetColorMatrixProgram(int SSAAMode);
|
||||
static LPDIRECT3DPIXELSHADER9 GetColorCopyProgram(int SSAAMode);
|
||||
enum
|
||||
{
|
||||
DEPTH_CONVERSION_TYPE_NONE,
|
||||
DEPTH_CONVERSION_TYPE_16BIT,
|
||||
DEPTH_CONVERSION_TYPE_24BIT,
|
||||
NUM_DEPTH_CONVERSION_TYPES
|
||||
};
|
||||
static LPDIRECT3DPIXELSHADER9 GetDepthMatrixProgram(int SSAAMode, int depthConversionType);
|
||||
static LPDIRECT3DPIXELSHADER9 GetDepthMatrixProgram(int SSAAMode, bool depthConversion);
|
||||
static LPDIRECT3DPIXELSHADER9 GetClearProgram();
|
||||
static LPDIRECT3DPIXELSHADER9 ReinterpRGBA6ToRGB8();
|
||||
static LPDIRECT3DPIXELSHADER9 ReinterpRGB8ToRGBA6();
|
||||
|
|
|
@ -559,6 +559,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
|||
RectToLock.top = targetPixelRc.top;
|
||||
if (type == PEEK_Z)
|
||||
{
|
||||
// TODO: why is D3DFMT_D24X8 singled out here? why not D3DFMT_D24X4S4/D24S8/D24FS8/D32/D16/D15S1 too, or none of them?
|
||||
if (FramebufferManager::GetEFBDepthRTSurfaceFormat() == D3DFMT_D24X8)
|
||||
return 0;
|
||||
|
||||
|
@ -599,13 +600,6 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
|||
D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
|
||||
|
||||
D3DFORMAT bformat = FramebufferManager::GetEFBDepthRTSurfaceFormat();
|
||||
int depthConversionType;
|
||||
if(bformat == FOURCC_RAWZ)
|
||||
depthConversionType = PixelShaderCache::DEPTH_CONVERSION_TYPE_NONE;
|
||||
else if(bformat == FOURCC_DF16)
|
||||
depthConversionType = PixelShaderCache::DEPTH_CONVERSION_TYPE_16BIT;
|
||||
else
|
||||
depthConversionType = PixelShaderCache::DEPTH_CONVERSION_TYPE_24BIT;
|
||||
|
||||
D3D::drawShadedTexQuad(
|
||||
read_texture,
|
||||
|
@ -613,7 +607,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
|||
Renderer::GetFullTargetWidth(),
|
||||
Renderer::GetFullTargetHeight(),
|
||||
4, 4,
|
||||
PixelShaderCache::GetDepthMatrixProgram(0, depthConversionType),
|
||||
PixelShaderCache::GetDepthMatrixProgram(0, bformat != FOURCC_RAWZ),
|
||||
VertexShaderCache::GetSimpleVertexShader(0));
|
||||
|
||||
D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER);
|
||||
|
|
|
@ -131,18 +131,11 @@ void TextureCache::TCacheEntry::FromRenderTarget(bool bFromZBuffer, bool bScaleB
|
|||
D3DFORMAT bformat = FramebufferManager::GetEFBDepthRTSurfaceFormat();
|
||||
int SSAAMode = g_ActiveConfig.iMultisampleMode;
|
||||
|
||||
int depthConversionType;
|
||||
if(bformat == FOURCC_RAWZ || bformat == D3DFMT_D24X8 || !bFromZBuffer)
|
||||
depthConversionType = PixelShaderCache::DEPTH_CONVERSION_TYPE_NONE;
|
||||
else if(bformat == FOURCC_DF16)
|
||||
depthConversionType = PixelShaderCache::DEPTH_CONVERSION_TYPE_16BIT;
|
||||
else
|
||||
depthConversionType = PixelShaderCache::DEPTH_CONVERSION_TYPE_24BIT;
|
||||
|
||||
D3D::drawShadedTexQuad(read_texture, &sourcerect,
|
||||
Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(),
|
||||
virtualW, virtualH,
|
||||
PixelShaderCache::GetDepthMatrixProgram(SSAAMode, depthConversionType),
|
||||
// TODO: why is D3DFMT_D24X8 singled out here? why not D3DFMT_D24X4S4/D24S8/D24FS8/D32/D16/D15S1 too, or none of them?
|
||||
PixelShaderCache::GetDepthMatrixProgram(SSAAMode, bFromZBuffer && bformat != FOURCC_RAWZ && bformat != D3DFMT_D24X8),
|
||||
VertexShaderCache::GetSimpleVertexShader(SSAAMode));
|
||||
|
||||
Rendersurf->Release();
|
||||
|
|
Loading…
Reference in New Issue