From c743e75d928f3367214d0ac87f80f3946c73e818 Mon Sep 17 00:00:00 2001 From: Rodolfo Bogado Date: Fri, 29 Mar 2013 00:41:36 -0300 Subject: [PATCH] fixes for my last commit --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 6 +++--- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 10 ++++++---- Source/Plugins/Plugin_VideoDX9/Src/main.cpp | 12 ++++++------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index dafaede7f7..26391be4dd 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -844,14 +844,14 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType WRITE(p, "\tocol0 = prev;\n"); } - // On D3D11, use dual-source color blending to perform dst alpha in a + // Use dual-source color blending to perform dst alpha in a // single pass if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND) { if(ApiType & API_D3D9) { - //Colors will be blended against the color from ocol1 in D3D 9... - //ALPHA must be 0 or the shader will not compile( direct3d9 ex resriction) + // alpha component must be 0 or the shader will not compile (Direct3D 9Ex restriction) + // Colors will be blended against the color from ocol1 in D3D 9... WRITE(p, "\tocol1 = float4(prev.a, prev.a, prev.a, 0.0f);\n"); } else diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index ffee938174..02bfe7e52c 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -661,6 +661,8 @@ void Renderer::SetBlendMode(bool forceUpdate) // Our render target always uses an alpha channel, so we need to override the blend functions to assume a destination alpha of 1 if the render target isn't supposed to have an alpha channel // Example: D3DBLEND_DESTALPHA needs to be D3DBLEND_ONE since the result without an alpha channel is assumed to always be 1. bool target_has_alpha = bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; + //bDstAlphaPass is taked in account because the ability of disabling alpha composition is + //really usefull for debuging shader and blending errors bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && target_has_alpha; bool useDualSource = useDstAlpha && g_ActiveConfig.backend_info.bSupportsDualSourceBlend; const D3DBLEND d3dSrcFactors[8] = @@ -692,10 +694,10 @@ void Renderer::SetBlendMode(bool forceUpdate) return; } - bool BlendEnable = bpmem.blendmode.subtract || bpmem.blendmode.blendenable; - D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, BlendEnable); - D3D::SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE , BlendEnable); - if (BlendEnable) + bool blend_enable = bpmem.blendmode.subtract || bpmem.blendmode.blendenable; + D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, blend_enable); + D3D::SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, blend_enable); + if (blend_enable) { D3DBLENDOP op = D3DBLENDOP_ADD; u32 srcidx = bpmem.blendmode.srcfactor; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 6a8493ea08..10fab8ea5a 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -102,19 +102,19 @@ void InitBackendInfo() g_Config.backend_info.bUseMinimalMipCount = true; g_Config.backend_info.bSupports3DVision = true; OSVERSIONINFO info; - ZeroMemory(&info, sizeof(OSVERSIONINFO)); - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (GetVersionEx(&info)) - { + ZeroMemory(&info, sizeof(OSVERSIONINFO)); + info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + if (GetVersionEx(&info)) + { // dual source blending is only supported in windows 7 o newer. sorry xp users + // we cannot test for device caps because most drivers just declare the minimun caps + // and don't expose their support for some functionalities g_Config.backend_info.bSupportsDualSourceBlend = info.dwPlatformId == VER_PLATFORM_WIN32_NT && info.dwMajorVersion > 5; } else { g_Config.backend_info.bSupportsDualSourceBlend = false; } - - g_Config.backend_info.bSupportsFormatReinterpretation = true; g_Config.backend_info.bSupportsPixelLighting = C_PLIGHTS + 40 <= maxConstants && C_PMATERIALS + 4 <= maxConstants;