Skip to content

Commit

Permalink
xrRenderGL: added blender FXAA and enabled it
Browse files Browse the repository at this point in the history
Layers/xrRenderPC_GL/gl_rendertarget_phase_combine.cpp: fixed codepage
(Win1251 -> UTF-8)
  • Loading branch information
Xottab-DUTY committed Nov 12, 2018
1 parent aaacdfa commit c23e6ac
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
11 changes: 5 additions & 6 deletions src/Layers/xrRenderPC_GL/gl_rendertarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "blender_bloom_build.h"
#include "blender_luminance.h"
#include "blender_ssao.h"
//#include "blender_fxaa.h"
#include "blender_fxaa.h"
#include "Layers/xrRenderDX10/dx10MinMaxSMBlender.h"
#include "Layers/xrRenderDX10/MSAA/dx10MSAABlender.h"
#include "Layers/xrRenderDX10/DX10 Rain/dx10RainBlender.h"
Expand Down Expand Up @@ -296,9 +296,8 @@ CRenderTarget::CRenderTarget()
b_combine = new CBlender_combine();
b_ssao = new CBlender_SSAO_noMSAA();

// xxx: Add fxaa blender to project
//FXAA
//b_fxaa = new CBlender_FXAA();
b_fxaa = new CBlender_FXAA();

if (RImplementation.o.dx10_msaa)
{
Expand Down Expand Up @@ -608,8 +607,8 @@ CRenderTarget::CRenderTarget()
}

//FXAA
//s_fxaa.create(b_fxaa, "gl" DELIMITER "fxaa");
//g_fxaa.create(FVF::F_V, RCache.Vertex.Buffer(), RCache.QuadIB);
s_fxaa.create(b_fxaa, "gl" DELIMITER "fxaa");
g_fxaa.create(FVF::F_V, RCache.Vertex.Buffer(), RCache.QuadIB);

// HBAO
if (RImplementation.o.ssao_opt_data)
Expand Down Expand Up @@ -968,7 +967,7 @@ CRenderTarget::~CRenderTarget()
xr_delete(b_accum_point);
xr_delete(b_accum_direct);
xr_delete(b_ssao);
//xr_delete(b_fxaa); //FXAA
xr_delete(b_fxaa); //FXAA

if (RImplementation.o.dx10_msaa)
{
Expand Down
17 changes: 8 additions & 9 deletions src/Layers/xrRenderPC_GL/gl_rendertarget_phase_combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,18 @@ void CRenderTarget::phase_combine()

//*** exposure-pipeline
u32 gpu_id = Device.dwFrame % HW.Caps.iGPUNum;
// TODO: Uncomment this and test in the game
/*

if (Device.m_SecondViewport.IsSVPActive()) //--#SM+#-- +SecondVP+
{
// clang-format off
gpu_id = (Device.dwFrame - 1) % HW.Caps.iGPUNum; // Ôèêñ "ìåðöàíèÿ" tonemapping (HDR) ïîñëå âûêëþ÷åíèÿ äâîéíîãî ðåíäåðà.
// Ïîáî÷íûé ýôôåêò - ïðè ðàáîòå äâîéíîãî ðåíäåðà ñêîðîñòü èçìåíåíèÿ tonemapping (HDR) ïàäàåò â äâà ðàçà
// Ìåðöàíèå ñâÿçàíî ñ òåì, ÷òî HDR äëÿ ñâîåé ðàáîòû õðàíèò óìåíüøåííèå êîïèè "ïðîøëûõ êàäðîâ"
// Ýòè êàäðû îòíîñèòåëüíî ïîõîæè äðóã íà äðóãà, îäíàêî ïðè âêëþ÷åííîì äâîéíîì ðåíäåðå
// â ïîëîâèíå êàäðîâ îêàçûâàåòñÿ êàðòèíêà èç âòîðîãî ðåíäåðà, è ïîñêîëüêó îíà ÷àñòî ìîæåò îòëè÷àòñÿ ïî öâåòó\ÿðêîñòè
// òî ïðè ïîïûòêå ñîçäàíèÿ "ïëàâíîãî" ïåðåõîäà ìåæäó íèìè ïîëó÷àåòñÿ ýôôåêò ìåðöàíèÿ
gpu_id = (Device.dwFrame - 1) % HW.Caps.iGPUNum; // Фикс "мерцания" tonemapping (HDR) после выключения двойного рендера.
// Побочный эффект - при работе двойного рендера скорость изменения tonemapping (HDR) падает в два раза
// Мерцание связано с тем, что HDR для своей работы хранит уменьшенние копии "прошлых кадров"
// Эти кадры относительно похожи друг на друга, однако при включенном двойном рендере
// в половине кадров оказывается картинка из второго рендера, и поскольку она часто может отличатся по цвету\яркости
// то при попытке создания "плавного" перехода между ними получается эффект мерцания
// clang-format on
}*/
}

{
t_LUM_src->surface_set(GL_TEXTURE_2D, rt_LUM_pool[gpu_id * 2 + 0]->pRT);
Expand Down
2 changes: 2 additions & 0 deletions src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
<ClCompile Include="blender_deffer_aref.cpp" />
<ClCompile Include="blender_deffer_flat.cpp" />
<ClCompile Include="blender_deffer_model.cpp" />
<ClCompile Include="blender_fxaa.cpp" />
<ClCompile Include="blender_light_direct.cpp" />
<ClCompile Include="blender_light_mask.cpp" />
<ClCompile Include="blender_light_occq.cpp" />
Expand Down Expand Up @@ -385,6 +386,7 @@
<ClInclude Include="blender_deffer_aref.h" />
<ClInclude Include="blender_deffer_flat.h" />
<ClInclude Include="blender_deffer_model.h" />
<ClInclude Include="blender_fxaa.h" />
<ClInclude Include="blender_light_direct.h" />
<ClInclude Include="blender_light_mask.h" />
<ClInclude Include="blender_light_occq.h" />
Expand Down
6 changes: 6 additions & 0 deletions src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@
<ClCompile Include="rgl_shaders.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="blender_fxaa.cpp">
<Filter>Shading templates</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
Expand Down Expand Up @@ -1112,6 +1115,9 @@
<ClInclude Include="..\xrRenderGL\MSAA\glMSAABlender.h">
<Filter>Interface implementations\MSAARender</Filter>
</ClInclude>
<ClInclude Include="blender_fxaa.h">
<Filter>Shading templates</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Natvis Include="..\..\TypeHelper.natvis" />
Expand Down

0 comments on commit c23e6ac

Please sign in to comment.