// TODO: DX10: if nesessary for NV stencil optimisation implement pass 1 void CBlender_light_occq::Compile(CBlender_Compile& C) { IBlender::Compile (C); switch (C.iElement) { case 0: // occlusion testing C.r_Pass ("dumb", "dumb",false,TRUE,FALSE,FALSE); C.r_End (); // Color write as well as culling and stencil are set up manually in code. break; case 1: // NV40 optimization :) C.r_Pass ("stub_notransform_t", "dumb",false,FALSE,FALSE,FALSE); C.r_ColorWriteEnable (false,false,false,false); C.r_CullMode (D3DCULL_NONE); C.r_Stencil (TRUE,D3DCMP_LESSEQUAL,0xff,0x00); // keep/keep/keep C.r_End (); break; case 2: // Stencil clear in case we've ran out of markers. C.r_Pass ("stub_notransform_t", "dumb",false,FALSE,FALSE,FALSE); C.r_ColorWriteEnable (false,false,false,false); C.r_CullMode (D3DCULL_NONE); if( RImplementation.o.dx10_msaa ) C.r_Stencil (TRUE,D3DCMP_ALWAYS,0x00,0x7E, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO); else { // Clear all bits except the last one C.r_Stencil (TRUE,D3DCMP_ALWAYS,0x00,0xFE, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO); } //C.r_Stencil (TRUE,D3DCMP_ALWAYS,0x00,0xFF, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO); // keep/keep/keep C.r_End (); break; } }
void CBlender_Detail_Still::Compile (CBlender_Compile& C) { IBlender::Compile (C); bool bUseATOC = (RImplementation.o.dx10_msaa_alphatest==CRender::MSAA_ATEST_DX10_0_ATOC); switch(C.iElement) { case SE_R2_NORMAL_HQ: // deffer wave if (bUseATOC) { uber_deffer (C,false,"detail_w","base_atoc",true,0,true); C.r_Stencil ( TRUE,D3DCMP_ALWAYS,0xff,0x7f,D3DSTENCILOP_KEEP,D3DSTENCILOP_REPLACE,D3DSTENCILOP_KEEP); C.r_StencilRef (0x01); C.r_ColorWriteEnable(false, false, false, false); C.r_CullMode (D3DCULL_NONE); // Alpha to coverage. C.RS.SetRS (XRDX10RS_ALPHATOCOVERAGE, TRUE); C.r_End (); } uber_deffer (C,false,"detail_w","base",true, 0, true); C.r_Stencil ( TRUE,D3DCMP_ALWAYS,0xff,0x7f,D3DSTENCILOP_KEEP,D3DSTENCILOP_REPLACE,D3DSTENCILOP_KEEP); C.r_StencilRef (0x01); C.r_CullMode (D3DCULL_NONE); if (bUseATOC) C.RS.SetRS ( D3DRS_ZFUNC, D3DCMP_EQUAL); C.r_End (); break; case SE_R2_NORMAL_LQ: // deffer still if (bUseATOC) { uber_deffer (C,false,"detail_s","base_atoc",true,0,true); C.r_Stencil ( TRUE,D3DCMP_ALWAYS,0xff,0x7f,D3DSTENCILOP_KEEP,D3DSTENCILOP_REPLACE,D3DSTENCILOP_KEEP); C.r_StencilRef (0x01); C.r_CullMode (D3DCULL_NONE); C.r_ColorWriteEnable(false, false, false, false); // Alpha to coverage. C.RS.SetRS (XRDX10RS_ALPHATOCOVERAGE, TRUE); C.r_End (); } uber_deffer (C,false,"detail_s","base",true, 0, true); C.r_Stencil ( TRUE,D3DCMP_ALWAYS,0xff,0x7f,D3DSTENCILOP_KEEP,D3DSTENCILOP_REPLACE,D3DSTENCILOP_KEEP); C.r_StencilRef (0x01); C.r_CullMode (D3DCULL_NONE); // Need this for ATOC if (bUseATOC) C.RS.SetRS ( D3DRS_ZFUNC, D3DCMP_EQUAL); C.r_End (); break; } }
void CBlender_accum_direct::Compile(CBlender_Compile& C) { IBlender::Compile (C); // BOOL b_HW_smap = RImplementation.o.HW_smap; // BOOL b_HW_PCF = RImplementation.o.HW_smap_PCF; BOOL blend = FALSE; //RImplementation.o.fp16_blend; D3DBLEND dest = blend?D3DBLEND_ONE:D3DBLEND_ZERO; if (RImplementation.o.sunfilter) { blend = FALSE; dest = D3DBLEND_ZERO; } switch (C.iElement) { case SE_SUN_NEAR: // near pass - enable Z-test to perform depth-clipping // FVF::TL2uv C.r_Pass ("stub_notransform_2uv","accum_sun_near_nomsaa_nominmax", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Texture ("s_smap_minmax", r2_RT_smap_depth_minmax); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; case SE_SUN_FAR: // far pass, only stencil clipping performed // FVF::TL2uv //C.r_Pass ("null", "accum_sun_far", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_Pass ("stub_notransform_2uv","accum_sun_far_nomsaa", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); //C.r_Sampler_rtf ("s_position", r2_RT_P ); //C.r_Sampler_rtf ("s_normal", r2_RT_N ); //C.r_Sampler_clw ("s_material", r2_material ); //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); //C.r_Sampler ("s_lmap", r2_sunmask ); //if (b_HW_smap) { // if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); // else { // C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); // } //} //else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; case SE_SUN_LUMINANCE: // luminance pass //C.r_Pass ("null", "accum_sun", false, FALSE, FALSE); C.r_Pass ("stub_notransform_aa_AA","accum_sun_nomsaa", false, FALSE, FALSE); C.r_CullMode (D3DCULL_NONE); //C.r_Sampler_rtf ("s_position", r2_RT_P ); //C.r_Sampler_rtf ("s_normal", r2_RT_N ); //C.r_Sampler_clw ("s_material", r2_material ); //C.r_Sampler_clf ("s_smap", r2_RT_generic0 ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_smap", r2_RT_generic0); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); jitter (C); C.r_End (); break; // SE_SUN_NEAR for min/max case SE_SUN_NEAR_MINMAX: // near pass - enable Z-test to perform depth-clipping // FVF::TL2uv C.r_Pass ("stub_notransform_2uv","accum_sun_near_nomsaa_minmax", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Texture ("s_smap_minmax", r2_RT_smap_depth_minmax); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; /* // SE_SUN_FAR for min/max case 5: // far pass, only stencil clipping performed // FVF::TL2uv C.r_Pass ("stub_notransform_2uv","accum_sun_far_nomsaa", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; */ } }
// TODO: DX10: implement CBlender_accum_direct::Compile void CBlender_accum_direct_msaa::Compile(CBlender_Compile& C) { IBlender::Compile (C); if( Name ) ::Render->m_MSAASample = atoi( Definition ); else ::Render->m_MSAASample = -1; // BOOL b_HW_smap = RImplementation.o.HW_smap; // BOOL b_HW_PCF = RImplementation.o.HW_smap_PCF; BOOL blend = FALSE; //RImplementation.o.fp16_blend; D3DBLEND dest = blend?D3DBLEND_ONE:D3DBLEND_ZERO; if (RImplementation.o.sunfilter) { blend = FALSE; dest = D3DBLEND_ZERO; } switch (C.iElement) { case SE_SUN_NEAR: // near pass - enable Z-test to perform depth-clipping case SE_SUN_MIDDLE: // middle pass - enable Z-test to perform depth-clipping // FVF::TL2uv //C.r_Pass ("null", "accum_sun_near", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_Pass ("accum_sun","accum_sun_near_msaa_nominmax", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer //C.r_Sampler_rtf ("s_position", r2_RT_P ); //C.r_Sampler_rtf ("s_normal", r2_RT_N ); //C.r_Sampler_clw ("s_material", r2_material ); //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); //C.r_Sampler ("s_lmap", r2_sunmask ); //if (b_HW_smap) { // if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); // else { // C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); // } //} //else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; case SE_SUN_FAR: // far pass, only stencil clipping performed // FVF::TL2uv //C.r_Pass ("null", "accum_sun_far", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_Pass ("accum_sun","accum_sun_far_msaa", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); //C.r_Sampler_rtf ("s_position", r2_RT_P ); //C.r_Sampler_rtf ("s_normal", r2_RT_N ); //C.r_Sampler_clw ("s_material", r2_material ); //C.r_Sampler_rtf ("s_accumulator", r2_RT_accum ); //C.r_Sampler ("s_lmap", r2_sunmask ); //if (b_HW_smap) { // if (b_HW_PCF) C.r_Sampler_clf ("s_smap",r2_RT_smap_depth ); // else { // C.r_Sampler_rtf ("s_smap",r2_RT_smap_depth ); // } //} //else C.r_Sampler_rtf ("s_smap",r2_RT_smap_surf ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); { u32 s = C.r_dx10Sampler("smp_smap"); C.i_dx10Address (s, D3DTADDRESS_BORDER); C.i_dx10BorderColor (s, D3DCOLOR_ARGB(255, 255, 255, 255)); } C.r_End (); break; case SE_SUN_LUMINANCE: // luminance pass //C.r_Pass ("null", "accum_sun", false, FALSE, FALSE); C.r_Pass ("stub_notransform_aa_AA","accum_sun_msaa", false, FALSE, FALSE); C.r_CullMode (D3DCULL_NONE); //C.r_Sampler_rtf ("s_position", r2_RT_P ); //C.r_Sampler_rtf ("s_normal", r2_RT_N ); //C.r_Sampler_clw ("s_material", r2_material ); //C.r_Sampler_clf ("s_smap", r2_RT_generic0 ); //jitter (C); C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_smap", r2_RT_generic0); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); jitter (C); C.r_End (); break; // SE_SUN_NEAR for minmax case SE_SUN_NEAR_MINMAX: // near pass - enable Z-test to perform depth-clipping // FVF::TL2uv C.r_Pass ("accum_sun","accum_sun_near_msaa_minmax", false, TRUE, FALSE,blend,D3DBLEND_ONE,dest); C.r_CullMode (D3DCULL_NONE); C.PassSET_ZB (TRUE,FALSE,TRUE ); // force inverted Z-Buffer C.r_dx10Texture ("s_position", r2_RT_P); C.r_dx10Texture ("s_normal", r2_RT_N); C.r_dx10Texture ("s_material", r2_material); C.r_dx10Texture ("s_accumulator", r2_RT_accum); C.r_dx10Texture ("s_lmap", r2_sunmask); C.r_dx10Texture ("s_smap", r2_RT_smap_depth); C.r_dx10Texture ("s_smap_minmax", r2_RT_smap_depth_minmax); C.r_dx10Sampler ("smp_nofilter"); C.r_dx10Sampler ("smp_material"); C.r_dx10Sampler ("smp_linear"); jitter (C); C.r_dx10Sampler ("smp_smap"); C.r_End (); break; } ::Render->m_MSAASample = -1; }