void DepthReduction::InitRenderTarget(SetupContext& context) {
	using gxapi::eFormat;

	auto formatDepthReductionResult = eFormat::R32G32_FLOAT;

	gxapi::UavTexture2DArray uavDesc;
	uavDesc.activeArraySize = 1;
	uavDesc.firstArrayElement = 0;
	uavDesc.mipLevel = 0;
	uavDesc.planeIndex = 0;

	gxapi::SrvTexture2DArray srvDesc;
	srvDesc.activeArraySize = 1;
	srvDesc.firstArrayElement = 0;
	srvDesc.numMipLevels = -1;
	srvDesc.mipLevelClamping = 0;
	srvDesc.mostDetailedMip = 0;
	srvDesc.planeIndex = 0;

	unsigned dispatchW, dispatchH;
	SetWorkgroupSize((unsigned)std::ceil(m_width * 0.5f), m_height, 16, 16, dispatchW, dispatchH);

	Texture2D tex = context.CreateTexture2D({ dispatchW, dispatchH, formatDepthReductionResult }, { true, true, false, true });
	tex.SetName("Depth reduction intermediate texture");
	m_uav = context.CreateUav(tex, formatDepthReductionResult, uavDesc);
	
	m_srv = context.CreateSrv(tex, formatDepthReductionResult, srvDesc);
	
}
void VolumetricLighting::InitRenderTarget(SetupContext& context) {
	if (!m_outputTexturesInited) {
		m_outputTexturesInited = true;

		using gxapi::eFormat;

		auto formatSDFCullData = eFormat::R32_UINT;
		auto formatDst = eFormat::R16G16B16A16_FLOAT;

		gxapi::UavTexture2DArray uavDesc;
		uavDesc.activeArraySize = 1;
		uavDesc.firstArrayElement = 0;
		uavDesc.mipLevel = 0;
		uavDesc.planeIndex = 0;

		gxapi::SrvTexture2DArray srvDesc;
		srvDesc.activeArraySize = 1;
		srvDesc.firstArrayElement = 0;
		srvDesc.numMipLevels = -1;
		srvDesc.mipLevelClamping = 0;
		srvDesc.mostDetailedMip = 0;
		srvDesc.planeIndex = 0;

		uint32_t dispatchW, dispatchH;
		SetWorkgroupSize((unsigned)m_depthTexSrv.GetResource().GetWidth(), (unsigned)m_depthTexSrv.GetResource().GetHeight(), 16, 16, dispatchW, dispatchH);

		//TODO 1D tex
		Texture2DDesc desc;
		desc.width = dispatchW * dispatchH;
		desc.height = 1024;
		desc.format = formatSDFCullData;
		TextureUsage uavusage{ true, true, false, true };

		Texture2D sdfCullDataTex = context.CreateTexture2D(desc, uavusage);
		sdfCullDataTex.SetName("SDF culling sdf cull data tex");
		m_sdfCullDataUAV = context.CreateUav(sdfCullDataTex, formatSDFCullData, uavDesc);

		m_sdfCullDataSRV = context.CreateSrv(sdfCullDataTex, formatSDFCullData, srvDesc);


		for (int c = 0; c < 2; ++c) {
			desc.width = m_depthTexSrv.GetResource().GetWidth();
			desc.height = m_depthTexSrv.GetResource().GetHeight();
			desc.format = formatDst;

			Texture2D dstTex = context.CreateTexture2D(desc, uavusage);
			sdfCullDataTex.SetName("SDF culling dst tex");
			m_volDstTexUAV[c] = context.CreateUav(dstTex, formatDst, uavDesc);
			m_volDstTexUAV[c].GetResource().SetName((std::string("SDF culling vol dst UAV") + std::to_string(c)).c_str());
		}

		desc.width = m_depthTexSrv.GetResource().GetWidth();
		desc.height = m_depthTexSrv.GetResource().GetHeight();
		desc.format = formatDst;

		Texture2D dstTex = context.CreateTexture2D(desc, uavusage);
		sdfCullDataTex.SetName("SDF culling dst tex");
		m_dstTexUAV = context.CreateUav(dstTex, formatDst, uavDesc);
	}
}
void BrightLumPass::Setup(SetupContext& context) {
	Texture2D inputTex = this->GetInput<0>().Get();

	gxapi::SrvTexture2DArray srvDesc;
	srvDesc.activeArraySize = 1;
	srvDesc.firstArrayElement = 0;
	srvDesc.mipLevelClamping = 0;
	srvDesc.mostDetailedMip = 0;
	srvDesc.numMipLevels = 1;
	srvDesc.planeIndex = 0;
	m_inputTexSrv = context.CreateSrv(inputTex, inputTex.GetFormat(), srvDesc);
	

	if (!m_binder.has_value()) {
		BindParameterDesc uniformsBindParamDesc;
		m_uniformsBindParam = BindParameter(eBindParameterType::CONSTANT, 0);
		uniformsBindParamDesc.parameter = m_uniformsBindParam;
		uniformsBindParamDesc.constantSize = sizeof(Uniforms);
		uniformsBindParamDesc.relativeAccessFrequency = 0;
		uniformsBindParamDesc.relativeChangeFrequency = 0;
		uniformsBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc sampBindParamDesc;
		sampBindParamDesc.parameter = BindParameter(eBindParameterType::SAMPLER, 0);
		sampBindParamDesc.constantSize = 0;
		sampBindParamDesc.relativeAccessFrequency = 0;
		sampBindParamDesc.relativeChangeFrequency = 0;
		sampBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc inputBindParamDesc;
		m_inputTexBindParam = BindParameter(eBindParameterType::TEXTURE, 0);
		inputBindParamDesc.parameter = m_inputTexBindParam;
		inputBindParamDesc.constantSize = 0;
		inputBindParamDesc.relativeAccessFrequency = 0;
		inputBindParamDesc.relativeChangeFrequency = 0;
		inputBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		gxapi::StaticSamplerDesc samplerDesc;
		samplerDesc.shaderRegister = 0;
		samplerDesc.filter = gxapi::eTextureFilterMode::MIN_MAG_MIP_POINT;
		samplerDesc.addressU = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.addressV = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.addressW = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.mipLevelBias = 0.f;
		samplerDesc.registerSpace = 0;
		samplerDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		m_binder = context.CreateBinder({ uniformsBindParamDesc, sampBindParamDesc, inputBindParamDesc },{ samplerDesc });
	}


	if (!m_PSO) {
		InitRenderTarget(context);

		ShaderParts shaderParts;
		shaderParts.vs = true;
		shaderParts.ps = true;

		m_shader = context.CreateShader("BrightLumPass", shaderParts, "");

		std::vector<gxapi::InputElementDesc> inputElementDesc = {
			gxapi::InputElementDesc("POSITION", 0, gxapi::eFormat::R32G32B32_FLOAT, 0, 0),
			gxapi::InputElementDesc("TEX_COORD", 0, gxapi::eFormat::R32G32_FLOAT, 0, 12)
		};

		gxapi::GraphicsPipelineStateDesc psoDesc;
		psoDesc.inputLayout.elements = inputElementDesc.data();
		psoDesc.inputLayout.numElements = (unsigned)inputElementDesc.size();
		psoDesc.rootSignature = m_binder->GetRootSignature();
		psoDesc.vs = m_shader.vs;
		psoDesc.ps = m_shader.ps;
		psoDesc.rasterization = gxapi::RasterizerState(gxapi::eFillMode::SOLID, gxapi::eCullMode::DRAW_ALL);
		psoDesc.primitiveTopologyType = gxapi::ePrimitiveTopologyType::TRIANGLE;

		psoDesc.depthStencilState.enableDepthTest = false;
		psoDesc.depthStencilState.enableDepthStencilWrite = false;
		psoDesc.depthStencilState.enableStencilTest = false;
		psoDesc.depthStencilState.cwFace = psoDesc.depthStencilState.ccwFace;

		psoDesc.numRenderTargets = 2;
		psoDesc.renderTargetFormats[0] = m_bright_pass_rtv.GetResource().GetFormat();
		psoDesc.renderTargetFormats[1] = m_luminance_rtv.GetResource().GetFormat();

		m_PSO.reset(context.CreatePSO(psoDesc));
	}

	this->GetOutput<0>().Set(m_bright_pass_rtv.GetResource());
	this->GetOutput<1>().Set(m_luminance_rtv.GetResource());
}
Example #4
0
void Blend::Setup(SetupContext& context) {
	auto& target = this->GetInput<0>().Get();
	gxapi::RtvTexture2DArray rtvDesc;
	rtvDesc.activeArraySize = 1;
	rtvDesc.firstArrayElement = 0;
	rtvDesc.firstMipLevel = 0;
	rtvDesc.planeIndex = 0;
	m_blendDest = context.CreateRtv(target, target.GetFormat(), rtvDesc);

	auto blendSrc = this->GetInput<1>().Get();
	gxapi::SrvTexture2DArray srvDesc;
	srvDesc.activeArraySize = 1;
	srvDesc.firstArrayElement = 0;
	srvDesc.mipLevelClamping = 0;
	srvDesc.mostDetailedMip = 0;
	srvDesc.numMipLevels = 1;
	srvDesc.planeIndex = 0;
	m_blendSrc = context.CreateSrv(blendSrc, blendSrc.GetFormat(), srvDesc);

	gxapi::RenderTargetBlendState currBlendMode = this->GetInput<2>().Get();

	this->GetOutput<0>().Set(target);


	if (!m_binder) {
		BindParameterDesc tex0ParamDesc;
		m_tex0Param = BindParameter(eBindParameterType::TEXTURE, 0);
		tex0ParamDesc.parameter = m_tex0Param;
		tex0ParamDesc.constantSize = 0;
		tex0ParamDesc.relativeAccessFrequency = 0;
		tex0ParamDesc.relativeChangeFrequency = 0;
		tex0ParamDesc.shaderVisibility = gxapi::eShaderVisiblity::PIXEL;

		BindParameterDesc sampBindParamDesc;
		sampBindParamDesc.parameter = BindParameter(eBindParameterType::SAMPLER, 0);
		sampBindParamDesc.constantSize = 0;
		sampBindParamDesc.relativeAccessFrequency = 0;
		sampBindParamDesc.relativeChangeFrequency = 0;
		sampBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::PIXEL;

		gxapi::StaticSamplerDesc samplerDesc;
		samplerDesc.shaderRegister = 0;
		samplerDesc.filter = gxapi::eTextureFilterMode::MIN_MAG_LINEAR_MIP_POINT;
		samplerDesc.addressU = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.addressV = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.addressW = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.mipLevelBias = 0.f;
		samplerDesc.registerSpace = 0;
		samplerDesc.shaderVisibility = gxapi::eShaderVisiblity::PIXEL;

		m_binder = context.CreateBinder({ tex0ParamDesc, sampBindParamDesc }, { samplerDesc });
	}


	if (!m_shader.vs || m_shader.ps) {
		ShaderParts shaderParts;
		shaderParts.vs = true;
		shaderParts.ps = true;

		m_shader = context.CreateShader("Blend", shaderParts, "");
	}

	if (m_renderTargetFormat != target.GetFormat() || m_blendMode != currBlendMode) {
		m_renderTargetFormat = target.GetFormat();
		m_blendMode = currBlendMode;

		std::vector<gxapi::InputElementDesc> inputElementDesc = {
			gxapi::InputElementDesc("POSITION", 0, gxapi::eFormat::R32G32_FLOAT, 0, 0)
		};

		gxapi::GraphicsPipelineStateDesc psoDesc;
		psoDesc.inputLayout.elements = inputElementDesc.data();
		psoDesc.inputLayout.numElements = (unsigned)inputElementDesc.size();
		psoDesc.rootSignature = m_binder.GetRootSignature();
		psoDesc.vs = m_shader.vs;
		psoDesc.ps = m_shader.ps;
		psoDesc.rasterization = gxapi::RasterizerState(gxapi::eFillMode::SOLID, gxapi::eCullMode::DRAW_ALL);
		psoDesc.primitiveTopologyType = gxapi::ePrimitiveTopologyType::TRIANGLE;
		psoDesc.blending.alphaToCoverage = false;
		psoDesc.blending.independentBlending = false;
		psoDesc.blending.singleTarget = m_blendMode;
		
		psoDesc.numRenderTargets = 1;
		psoDesc.renderTargetFormats[0] = m_renderTargetFormat;

		m_PSO.reset(context.CreatePSO(psoDesc));
	}
	
}
void DepthReduction::Setup(SetupContext& context) {
	auto& inputDepth = this->GetInput<0>().Get();
	gxapi::SrvTexture2DArray srvDesc;
	srvDesc.activeArraySize = 1;
	srvDesc.firstArrayElement = 0;
	srvDesc.mipLevelClamping = 0;
	srvDesc.mostDetailedMip = 0;
	srvDesc.numMipLevels = 1;
	srvDesc.planeIndex = 0;
	m_depthView = context.CreateSrv(inputDepth, FormatDepthToColor(inputDepth.GetFormat()), srvDesc);
	

	if (inputDepth.GetWidth() != m_width || inputDepth.GetHeight() != m_height) {
		m_width = inputDepth.GetWidth();
		m_height = inputDepth.GetHeight();
		InitRenderTarget(context);
	}

	this->GetOutput<0>().Set(m_srv.GetResource());

	if (!m_binder.has_value()) {
		BindParameterDesc sampBindParamDesc;
		sampBindParamDesc.parameter = BindParameter(eBindParameterType::SAMPLER, 0);
		sampBindParamDesc.constantSize = 0;
		sampBindParamDesc.relativeAccessFrequency = 0;
		sampBindParamDesc.relativeChangeFrequency = 0;
		sampBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc depthBindParamDesc;
		m_depthBindParam = BindParameter(eBindParameterType::TEXTURE, 0);
		depthBindParamDesc.parameter = m_depthBindParam;
		depthBindParamDesc.constantSize = 0;
		depthBindParamDesc.relativeAccessFrequency = 0;
		depthBindParamDesc.relativeChangeFrequency = 0;
		depthBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc outputBindParamDesc;
		m_outputBindParam = BindParameter(eBindParameterType::UNORDERED, 0);
		outputBindParamDesc.parameter = m_outputBindParam;
		outputBindParamDesc.constantSize = 0;
		outputBindParamDesc.relativeAccessFrequency = 0;
		outputBindParamDesc.relativeChangeFrequency = 0;
		outputBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		gxapi::StaticSamplerDesc samplerDesc;
		samplerDesc.shaderRegister = 0;
		samplerDesc.filter = gxapi::eTextureFilterMode::MIN_MAG_MIP_POINT;
		samplerDesc.addressU = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.addressV = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.addressW = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.mipLevelBias = 0.f;
		samplerDesc.registerSpace = 0;
		samplerDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		m_binder = context.CreateBinder({ sampBindParamDesc, depthBindParamDesc, outputBindParamDesc }, { samplerDesc });
	}

	if (m_CSO == nullptr) {
		ShaderParts shaderParts;
		shaderParts.cs = true;

		m_shader = context.CreateShader("DepthReduction", shaderParts, "");

		gxapi::ComputePipelineStateDesc csoDesc;
		csoDesc.rootSignature = m_binder->GetRootSignature();
		csoDesc.cs = m_shader.cs;

		m_CSO.reset(context.CreatePSO(csoDesc));
	}
}
void VolumetricLighting::Setup(SetupContext& context) {
	gxapi::SrvTexture2DArray srvDesc;
	srvDesc.activeArraySize = 1;
	srvDesc.firstArrayElement = 0;
	srvDesc.mipLevelClamping = 0;
	srvDesc.mostDetailedMip = 0;
	srvDesc.numMipLevels = 1;
	srvDesc.planeIndex = 0;

	Texture2D depthTex = this->GetInput<0>().Get();
	m_depthTexSrv = context.CreateSrv(depthTex, FormatDepthToColor(depthTex.GetFormat()), srvDesc);


	gxapi::UavTexture2DArray uavDesc;
	uavDesc.activeArraySize = 1;
	uavDesc.firstArrayElement = 0;
	uavDesc.mipLevel = 0;
	uavDesc.planeIndex = 0;

	Texture2D colorTex = this->GetInput<1>().Get();
	m_colorTexSRV = context.CreateSrv(colorTex, colorTex.GetFormat(), srvDesc);


	Texture2D lightCullTex = this->GetInput<2>().Get();
	m_lightCullDataSRV = context.CreateSrv(lightCullTex, lightCullTex.GetFormat(), srvDesc);


	m_camera = this->GetInput<3>().Get();

	srvDesc.activeArraySize = 4;

	Texture2D csmTex = this->GetInput<4>().Get();
	m_csmTexSRV = context.CreateSrv(csmTex, FormatDepthToColor(csmTex.GetFormat()), srvDesc);


	srvDesc.activeArraySize = 1;

	Texture2D shadowMXTex = this->GetInput<5>().Get();
	m_shadowMXTexSRV = context.CreateSrv(shadowMXTex, shadowMXTex.GetFormat(), srvDesc);


	Texture2D csmSplitsTex = this->GetInput<6>().Get();
	m_csmSplitsTexSRV = context.CreateSrv(csmSplitsTex, csmSplitsTex.GetFormat(), srvDesc);


	if (!m_binder) {
		BindParameterDesc uniformsBindParamDesc;
		m_uniformsBindParam = BindParameter(eBindParameterType::CONSTANT, 0);
		uniformsBindParamDesc.parameter = m_uniformsBindParam;
		uniformsBindParamDesc.constantSize = sizeof(Uniforms);
		uniformsBindParamDesc.relativeAccessFrequency = 0;
		uniformsBindParamDesc.relativeChangeFrequency = 0;
		uniformsBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc sampBindParamDesc;
		sampBindParamDesc.parameter = BindParameter(eBindParameterType::SAMPLER, 0);
		sampBindParamDesc.constantSize = 0;
		sampBindParamDesc.relativeAccessFrequency = 0;
		sampBindParamDesc.relativeChangeFrequency = 0;
		sampBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc depthTexBindParamDesc;
		m_depthBindParam = BindParameter(eBindParameterType::TEXTURE, 0);
		depthTexBindParamDesc.parameter = m_depthBindParam;
		depthTexBindParamDesc.constantSize = 0;
		depthTexBindParamDesc.relativeAccessFrequency = 0;
		depthTexBindParamDesc.relativeChangeFrequency = 0;
		depthTexBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc colorBindParamDesc;
		m_inputColorBindParam = BindParameter(eBindParameterType::TEXTURE, 1);
		colorBindParamDesc.parameter = m_inputColorBindParam;
		colorBindParamDesc.constantSize = 0;
		colorBindParamDesc.relativeAccessFrequency = 0;
		colorBindParamDesc.relativeChangeFrequency = 0;
		colorBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc cullRoBindParamDesc;
		m_cullRoBindParam = BindParameter(eBindParameterType::TEXTURE, 2);
		cullRoBindParamDesc.parameter = m_cullRoBindParam;
		cullRoBindParamDesc.constantSize = 0;
		cullRoBindParamDesc.relativeAccessFrequency = 0;
		cullRoBindParamDesc.relativeChangeFrequency = 0;
		cullRoBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc lightCullBindParamDesc;
		m_lightCullBindParam = BindParameter(eBindParameterType::TEXTURE, 3);
		lightCullBindParamDesc.parameter = m_lightCullBindParam;
		lightCullBindParamDesc.constantSize = 0;
		lightCullBindParamDesc.relativeAccessFrequency = 0;
		lightCullBindParamDesc.relativeChangeFrequency = 0;
		lightCullBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc csmTexBindParamDesc;
		m_csmTexBindParam = BindParameter(eBindParameterType::TEXTURE, 500);
		csmTexBindParamDesc.parameter = m_csmTexBindParam;
		csmTexBindParamDesc.constantSize = 0;
		csmTexBindParamDesc.relativeAccessFrequency = 0;
		csmTexBindParamDesc.relativeChangeFrequency = 0;
		csmTexBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc shadowMXTexBindParamDesc;
		m_shadowMxTexBindParam = BindParameter(eBindParameterType::TEXTURE, 501);
		shadowMXTexBindParamDesc.parameter = m_shadowMxTexBindParam;
		shadowMXTexBindParamDesc.constantSize = 0;
		shadowMXTexBindParamDesc.relativeAccessFrequency = 0;
		shadowMXTexBindParamDesc.relativeChangeFrequency = 0;
		shadowMXTexBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc csmSplitsTexBindParamDesc;
		m_csmSplitsTexBindParam = BindParameter(eBindParameterType::TEXTURE, 502);
		csmSplitsTexBindParamDesc.parameter = m_csmSplitsTexBindParam;
		csmSplitsTexBindParamDesc.constantSize = 0;
		csmSplitsTexBindParamDesc.relativeAccessFrequency = 0;
		csmSplitsTexBindParamDesc.relativeChangeFrequency = 0;
		csmSplitsTexBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc lightMvpTexBindParamDesc;
		m_lightMvpTexBindParam = BindParameter(eBindParameterType::TEXTURE, 503);
		lightMvpTexBindParamDesc.parameter = m_lightMvpTexBindParam;
		lightMvpTexBindParamDesc.constantSize = 0;
		lightMvpTexBindParamDesc.relativeAccessFrequency = 0;
		lightMvpTexBindParamDesc.relativeChangeFrequency = 0;
		lightMvpTexBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc shadowSampBindParamDesc;
		shadowSampBindParamDesc.parameter = BindParameter(eBindParameterType::SAMPLER, 500);
		shadowSampBindParamDesc.constantSize = 0;
		shadowSampBindParamDesc.relativeAccessFrequency = 0;
		shadowSampBindParamDesc.relativeChangeFrequency = 0;
		shadowSampBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		gxapi::StaticSamplerDesc theSamplerParam;
		theSamplerParam.shaderRegister = 500;
		theSamplerParam.filter = gxapi::eTextureFilterMode::MIN_MAG_MIP_POINT;
		theSamplerParam.addressU = gxapi::eTextureAddressMode::CLAMP;
		theSamplerParam.addressV = gxapi::eTextureAddressMode::CLAMP;
		theSamplerParam.addressW = gxapi::eTextureAddressMode::CLAMP;
		theSamplerParam.mipLevelBias = 0.f;
		theSamplerParam.registerSpace = 0;
		theSamplerParam.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc volDst0BindParamDesc;
		m_volDst0BindParam = BindParameter(eBindParameterType::UNORDERED, 0);
		volDst0BindParamDesc.parameter = m_volDst0BindParam;
		volDst0BindParamDesc.constantSize = 0;
		volDst0BindParamDesc.relativeAccessFrequency = 0;
		volDst0BindParamDesc.relativeChangeFrequency = 0;
		volDst0BindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc volDst1BindParamDesc;
		m_volDst1BindParam = BindParameter(eBindParameterType::UNORDERED, 1);
		volDst1BindParamDesc.parameter = m_volDst1BindParam;
		volDst1BindParamDesc.constantSize = 0;
		volDst1BindParamDesc.relativeAccessFrequency = 0;
		volDst1BindParamDesc.relativeChangeFrequency = 0;
		volDst1BindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc dstBindParamDesc;
		m_dstBindParam = BindParameter(eBindParameterType::UNORDERED, 2);
		dstBindParamDesc.parameter = m_dstBindParam;
		dstBindParamDesc.constantSize = 0;
		dstBindParamDesc.relativeAccessFrequency = 0;
		dstBindParamDesc.relativeChangeFrequency = 0;
		dstBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		BindParameterDesc cullBindParamDesc;
		m_cullBindParam = BindParameter(eBindParameterType::UNORDERED, 3);
		cullBindParamDesc.parameter = m_cullBindParam;
		cullBindParamDesc.constantSize = 0;
		cullBindParamDesc.relativeAccessFrequency = 0;
		cullBindParamDesc.relativeChangeFrequency = 0;
		cullBindParamDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		gxapi::StaticSamplerDesc samplerDesc;
		samplerDesc.shaderRegister = 0;
		samplerDesc.filter = gxapi::eTextureFilterMode::MIN_MAG_MIP_POINT;
		samplerDesc.addressU = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.addressV = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.addressW = gxapi::eTextureAddressMode::CLAMP;
		samplerDesc.mipLevelBias = 0.f;
		samplerDesc.registerSpace = 0;
		samplerDesc.shaderVisibility = gxapi::eShaderVisiblity::ALL;

		m_binder = context.CreateBinder({ uniformsBindParamDesc, sampBindParamDesc, depthTexBindParamDesc, colorBindParamDesc, cullBindParamDesc, volDst0BindParamDesc, dstBindParamDesc, volDst1BindParamDesc, cullRoBindParamDesc, lightCullBindParamDesc, csmTexBindParamDesc, shadowMXTexBindParamDesc, csmSplitsTexBindParamDesc, lightMvpTexBindParamDesc, shadowSampBindParamDesc }, { samplerDesc, theSamplerParam });
	}

	if (!m_sdfCullingCSO) {
		InitRenderTarget(context);

		ShaderParts shaderParts;
		shaderParts.cs = true;

		{
			m_sdfCullingShader = context.CreateShader("SDFCulling", shaderParts, "");

			gxapi::ComputePipelineStateDesc csoDesc;
			csoDesc.rootSignature = m_binder.GetRootSignature();
			csoDesc.cs = m_sdfCullingShader.cs;

			m_sdfCullingCSO.reset(context.CreatePSO(csoDesc));
		}

		{
			m_volumetricLightingShader = context.CreateShader("VolumetricLighting", shaderParts, "");

			gxapi::ComputePipelineStateDesc csoDesc;
			csoDesc.rootSignature = m_binder.GetRootSignature();
			csoDesc.cs = m_volumetricLightingShader.cs;

			m_volumetricLightingCSO.reset(context.CreatePSO(csoDesc));
		}
	}

	this->GetOutput<0>().Set(m_dstTexUAV.GetResource());
}