public override void RenderCamera(RenderPipelineContext context, GraphicsContext graphicsContext) { var rsPostProcess = context.RPAssetsManager.rootSignaturePostProcess; graphicsContext.SetRootSignature(rsPostProcess); graphicsContext.SetRenderTargetScreen(context.dynamicContextRead.settings.backgroundColor, context.ScreenSizeDSVs[1], true, true); graphicsContext.SetCBVR(postProcessDataBuffer, 0); graphicsContext.SetSRVT(context.outputRTV, 1); graphicsContext.SetSRVT(context.postProcessBackground, 2); graphicsContext.SetMesh(context.ndcQuadMesh); PSODesc desc = new PSODesc { blendState = EBlendState.none, cullMode = ECullMode.back, depthBias = 0, dsvFormat = DxgiFormat.DXGI_FORMAT_UNKNOWN, inputLayout = EInputLayout.postProcess, ptt = ED3D12PrimitiveTopologyType.TRIANGLE, rtvFormat = context.swapChainFormat, renderTargetCount = 1, streamOutput = false, wireFrame = false, }; SetPipelineStateVariant(context.deviceResources, graphicsContext, rsPostProcess, ref desc, context.RPAssetsManager.PObjectPostProcess); graphicsContext.DrawIndexed(context.ndcQuadMeshIndexCount, 0, 0); }
public bool Bake(Texture2D texture, RenderWrap renderWrap, ref object tag) { renderWrap.SetRootSignature(""); renderWrap.SetRenderTarget(texture, true); var psoDesc = new PSODesc() { blendState = BlendState.None, cullMode = CullMode.None, rtvFormat = texture.GetFormat(), inputLayout = InputLayout.Default, renderTargetCount = 1, }; renderWrap.SetShader("BRDFLUT.hlsl", psoDesc); renderWrap.DrawQuad(); return(true); }
public DrawObjectPass drawGBuffer = new DrawObjectPass() { shader = "DeferredGBuffer.hlsl", renderTargets = new string[] { "gbuffer0", "gbuffer1", "gbuffer2", "gbuffer3", }, depthStencil = null, rs = "CCCssssssssss", psoDesc = new PSODesc() { blendState = BlendState.None, cullMode = CullMode.None, }, srvs = new string[] { "_Albedo", "_Metallic", "_Roughness", "_Emissive", "_Normal", "_Spa", }, CBVPerObject = new object[] { null, nameof(ViewProjection), "Metallic", "Roughness", "Emissive", "Specular", "AO", nameof(CameraLeft), nameof(CameraDown), }, AutoKeyMap = { ("UseNormalMap", "USE_NORMAL_MAP"), ("UseSpa", "USE_SPA"), },
protected void SetPipelineStateVariant(DeviceResources deviceResources, GraphicsContext graphicsContext, GraphicsSignature graphicsSignature, ref PSODesc desc, PObject pObject) { int variant = pObject.GetVariantIndex(deviceResources, graphicsSignature, desc); graphicsContext.SetPObject1(pObject, variant); }
protected PObject PObjectStatusSelect(DeviceResources deviceResources, GraphicsSignature graphicsSignature, ref PSODesc desc, PObject pObject, PObject loading, PObject unload, PObject error) { if (pObject == null) { return(unload); } if (pObject.Status == GraphicsObjectStatus.unload) { return(unload); } else if (pObject.Status == GraphicsObjectStatus.loaded) { if (pObject.GetVariantIndex(deviceResources, graphicsSignature, desc) != -1) { return(pObject); } else { return(error); } } else if (pObject.Status == GraphicsObjectStatus.loading) { return(loading); } else { return(error); } }
public DrawObjectPass drawObject = new DrawObjectPass() { shader = "ForwardRender.hlsl", renderTargets = new string[1], depthStencil = null, rs = "CCCssssssssss", psoDesc = new PSODesc() { blendState = BlendState.None, cullMode = CullMode.None, }, srvs = new string[] { "_Albedo", "_Metallic", "_Roughness", "_Emissive", "_ShadowMap", "_Environment", "_BRDFLUT", "_Normal", "_Spa", }, CBVPerObject = new object[] { null, null, "Metallic", "Roughness", "Emissive", "Specular", }, CBVPerPass = new object[] { nameof(ViewProjection), nameof(View), nameof(CameraPosition), nameof(Brightness), nameof(Far), nameof(Near), nameof(Fov), nameof(AspectRatio), nameof(ShadowMapVP), nameof(ShadowMapVP1), nameof(LightDir), 0, nameof(LightColor), 0, "SkyLightMultiple", "FogColor", "FogDensity", "FogStartDistance", "FogEndDistance", nameof(CameraLeft), nameof(CameraDown), nameof(Split), }, AutoKeyMap = { ("EnableFog", "ENABLE_FOG"), ("UseNormalMap", "USE_NORMAL_MAP"), ("UseSpa", "USE_SPA"), } };