Skip to content

Commit 1cc859b

Browse files
committed
Fix original COP crash with HDAO
When HDAO is not ultra and SSAO Blur is enabled you will got a crash
1 parent 1097892 commit 1cc859b

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/Layers/xrRenderPC_R4/r4_rendertarget.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -662,34 +662,34 @@ CRenderTarget::CRenderTarget()
662662
s_ssao.create(b_ssao, "r2\\ssao");
663663
}
664664

665+
// HDAO
666+
const bool ssao_blur_on = RImplementation.o.ssao_blur_on;
667+
const bool ssao_hdao_ultra = RImplementation.o.ssao_hdao && RImplementation.o.ssao_ultra;
668+
if (ssao_blur_on || ssao_hdao_ultra)
669+
{
670+
const auto w = Device.dwWidth, h = Device.dwHeight;
671+
rt_ssao_temp.create(r2_RT_ssao_temp, w, h, D3DFMT_G16R16F, SampleCount, true);
665672

666-
// XXX: Xottab_DUTY: find out why it's available on R3, but commented here
667-
// if (RImplementation.o.ssao_blur_on)
668-
//{
669-
// u32 w = Device.dwWidth, h = Device.dwHeight;
670-
// rt_ssao_temp.create (r2_RT_ssao_temp, w, h, D3DFMT_G16R16F, SampleCount);
671-
// s_ssao.create (b_ssao, "r2\\ssao");
673+
if (ssao_hdao_ultra)
674+
{
675+
//rt_ssao_temp.create(r2_RT_ssao_temp, w, h, D3DFMT_R16F, 1, true); // original line; changed and moved upper
676+
s_hdao_cs.create(b_hdao_cs, "r2\\ssao");
677+
if (RImplementation.o.dx10_msaa)
678+
s_hdao_cs_msaa.create(b_hdao_msaa_cs, "r2\\ssao");
679+
}
672680

673-
// if( RImplementation.o.dx10_msaa )
674-
// {
675-
// int bound = RImplementation.o.dx10_msaa_opt ? 1 : RImplementation.o.dx10_msaa_samples;
681+
else if (ssao_blur_on)
682+
{
683+
//rt_ssao_temp.create(r2_RT_ssao_temp, w, h, D3DFMT_G16R16F, SampleCount); // moved upper
684+
s_ssao.create(b_ssao, "r2\\ssao");
676685

677-
// for( int i = 0; i < bound; ++i )
678-
// {
679-
// s_ssao_msaa[i].create( b_ssao_msaa[i], "null");
680-
// }
681-
// }
682-
//}
686+
if (RImplementation.o.dx10_msaa)
687+
{
688+
const int bound = RImplementation.o.dx10_msaa_opt ? 1 : RImplementation.o.dx10_msaa_samples;
683689

684-
// HDAO
685-
if (RImplementation.o.ssao_hdao && RImplementation.o.ssao_ultra)
686-
{
687-
u32 w = Device.dwWidth, h = Device.dwHeight;
688-
rt_ssao_temp.create(r2_RT_ssao_temp, w, h, D3DFMT_R16F, 1, true);
689-
s_hdao_cs.create(b_hdao_cs, "r2\\ssao");
690-
if (RImplementation.o.dx10_msaa)
691-
{
692-
s_hdao_cs_msaa.create(b_hdao_msaa_cs, "r2\\ssao");
690+
for (int i = 0; i < bound; ++i)
691+
s_ssao_msaa[i].create(b_ssao_msaa[i], "null");
692+
}
693693
}
694694
}
695695

0 commit comments

Comments
 (0)