Skip to content

Commit

Permalink
Fix original COP crash with HDAO
Browse files Browse the repository at this point in the history
When HDAO is not ultra and SSAO Blur is enabled you will got a crash
  • Loading branch information
Xottab-DUTY committed May 1, 2018
1 parent 1097892 commit 1cc859b
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/Layers/xrRenderPC_R4/r4_rendertarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,34 +662,34 @@ CRenderTarget::CRenderTarget()
s_ssao.create(b_ssao, "r2\\ssao");
}

// HDAO
const bool ssao_blur_on = RImplementation.o.ssao_blur_on;
const bool ssao_hdao_ultra = RImplementation.o.ssao_hdao && RImplementation.o.ssao_ultra;
if (ssao_blur_on || ssao_hdao_ultra)
{
const auto w = Device.dwWidth, h = Device.dwHeight;
rt_ssao_temp.create(r2_RT_ssao_temp, w, h, D3DFMT_G16R16F, SampleCount, true);

// XXX: Xottab_DUTY: find out why it's available on R3, but commented here
// if (RImplementation.o.ssao_blur_on)
//{
// u32 w = Device.dwWidth, h = Device.dwHeight;
// rt_ssao_temp.create (r2_RT_ssao_temp, w, h, D3DFMT_G16R16F, SampleCount);
// s_ssao.create (b_ssao, "r2\\ssao");
if (ssao_hdao_ultra)
{
//rt_ssao_temp.create(r2_RT_ssao_temp, w, h, D3DFMT_R16F, 1, true); // original line; changed and moved upper
s_hdao_cs.create(b_hdao_cs, "r2\\ssao");
if (RImplementation.o.dx10_msaa)
s_hdao_cs_msaa.create(b_hdao_msaa_cs, "r2\\ssao");
}

// if( RImplementation.o.dx10_msaa )
// {
// int bound = RImplementation.o.dx10_msaa_opt ? 1 : RImplementation.o.dx10_msaa_samples;
else if (ssao_blur_on)
{
//rt_ssao_temp.create(r2_RT_ssao_temp, w, h, D3DFMT_G16R16F, SampleCount); // moved upper
s_ssao.create(b_ssao, "r2\\ssao");

// for( int i = 0; i < bound; ++i )
// {
// s_ssao_msaa[i].create( b_ssao_msaa[i], "null");
// }
// }
//}
if (RImplementation.o.dx10_msaa)
{
const int bound = RImplementation.o.dx10_msaa_opt ? 1 : RImplementation.o.dx10_msaa_samples;

// HDAO
if (RImplementation.o.ssao_hdao && RImplementation.o.ssao_ultra)
{
u32 w = Device.dwWidth, h = Device.dwHeight;
rt_ssao_temp.create(r2_RT_ssao_temp, w, h, D3DFMT_R16F, 1, true);
s_hdao_cs.create(b_hdao_cs, "r2\\ssao");
if (RImplementation.o.dx10_msaa)
{
s_hdao_cs_msaa.create(b_hdao_msaa_cs, "r2\\ssao");
for (int i = 0; i < bound; ++i)
s_ssao_msaa[i].create(b_ssao_msaa[i], "null");
}
}
}

Expand Down

0 comments on commit 1cc859b

Please sign in to comment.