Esempio n. 1
0
        public async Task ReloadDefalutResources(ProcessingList processingList, MiscProcessContext miscProcessContext)
        {
            for (int i = 0; i < CameraDataBuffers.Length; i++)
            {
                CameraDataBuffers[i].Reload(deviceResources, c_presentDataSize);
            }
            for (int i = 0; i < LightCameraDataBuffers.Length; i++)
            {
                LightCameraDataBuffers[i].Reload(deviceResources, c_presentDataSize);
            }
            HighResolutionShadowNow = true;
            ChangeShadowMapsQuality(processingList, false);

            Uploader upTexLoading = new Uploader();
            Uploader upTexError   = new Uploader();

            upTexLoading.Texture2DPure(1, 1, new Vector4(0, 1, 1, 1));
            upTexError.Texture2DPure(1, 1, new Vector4(1, 0, 1, 1));;
            processingList.AddObject(new Texture2DUploadPack(TextureLoading, upTexLoading));
            processingList.AddObject(new Texture2DUploadPack(TextureError, upTexError));
            Uploader upTexPostprocessBackground = new Uploader();

            upTexPostprocessBackground.Texture2DPure(64, 64, new Vector4(1, 1, 1, 0));
            processingList.AddObject(new Texture2DUploadPack(postProcessBackground, upTexPostprocessBackground));

            Uploader upTexEnvCube = new Uploader();

            upTexEnvCube.TextureCubePure(32, 32, new Vector4[] { new Vector4(0.2f, 0.16f, 0.16f, 1), new Vector4(0.16f, 0.2f, 0.16f, 1), new Vector4(0.2f, 0.2f, 0.2f, 1), new Vector4(0.16f, 0.2f, 0.2f, 1), new Vector4(0.2f, 0.2f, 0.16f, 1), new Vector4(0.16f, 0.16f, 0.2f, 1) });

            IrradianceMap.ReloadAsRTVUAV(32, 32, 1, DxgiFormat.DXGI_FORMAT_R32G32B32A32_FLOAT);
            EnvironmentMap.ReloadAsRTVUAV(1024, 1024, 7, DxgiFormat.DXGI_FORMAT_R16G16B16A16_FLOAT);
            miscProcessContext.Add(new P_Env_Data()
            {
                source = SkyBox, IrradianceMap = IrradianceMap, EnvMap = EnvironmentMap, Level = 16
            });
            processingList.AddObject(new TextureCubeUploadPack(SkyBox, upTexEnvCube));
            processingList.AddObject(IrradianceMap);
            processingList.AddObject(EnvironmentMap);

            ndcQuadMesh.ReloadNDCQuad();
            ndcQuadMeshIndexCount = ndcQuadMesh.m_indexCount;
            processingList.AddObject(ndcQuadMesh);

            cubeMesh.ReloadCube();
            cubeMeshIndexCount = cubeMesh.m_indexCount;
            processingList.AddObject(cubeMesh);

            cubeWireMesh.ReloadCubeWire();
            cubeWireMeshIndexCount = cubeWireMesh.m_indexCount;
            processingList.AddObject(cubeWireMesh);

            await ReloadTexture2DNoMip(BRDFLut, processingList, "ms-appx:///Assets/Textures/brdflut.png");
            await ReloadTexture2DNoMip(UI1Texture, processingList, "ms-appx:///Assets/Textures/UI_1.png");

            Initilized = true;
        }
Esempio n. 2
0
 public void Process(RenderPipelineContext rp, MiscProcessContext context)
 {
     if (context.miscProcessPairs.Count == 0)
     {
         return;
     }
     if (!Ready)
     {
         return;
     }
     ref byte[]      bigBuffer       = ref rp.bigBuffer;
Esempio n. 3
0
        public void Process(GraphicsContext graphicsContext, MiscProcessContext context)
        {
            if (!Ready)
            {
                return;
            }
            if (context.miscProcessPairs.Count == 0)
            {
                return;
            }
            graphicsContext.BeginCommand();
            graphicsContext.SetDescriptorHeapDefault();
            for (int i = 0; i < context.miscProcessPairs.Count; i++)
            {
                var    texture0 = context.miscProcessPairs[i].source;
                var    texture1 = context.miscProcessPairs[i].IrradianceMap;
                var    texture2 = context.miscProcessPairs[i].EnvMap;
                IntPtr ptr1     = Marshal.UnsafeAddrOfPinnedArrayElement(cpuBuffer1, 0);
                _XyzData.x1      = (int)texture1.m_width;
                _XyzData.y1      = (int)texture1.m_height;
                _XyzData.x2      = (int)texture2.m_width;
                _XyzData.y2      = (int)texture2.m_height;
                _XyzData.Quality = context.miscProcessPairs[i].Level;
                int itCount = context.miscProcessPairs[i].Level;

                for (int j = 0; j < itCount; j++)
                {
                    _XyzData.Batch = j;

                    Marshal.StructureToPtr(_XyzData, ptr1 + j * c_splitSize, true);
                }
                graphicsContext.UpdateResource(constantBuffers, cpuBuffer1, c_bufferSize, 0);

                graphicsContext.SetRootSignatureCompute(rootSignature);
                graphicsContext.SetComputeCBVR(constantBuffers, 0);
                graphicsContext.SetComputeSRVT(texture0, 2);
                graphicsContext.SetPObject(ClearIrradianceMap);

                int pow2a = 1;
                for (int j = 0; j < texture1.m_mipLevels; j++)
                {
                    graphicsContext.SetComputeUAVT(texture1, j, 3);
                    graphicsContext.Dispatch((int)(texture1.m_width + 7) / 8 / pow2a, (int)(texture1.m_height + 7) / 8 / pow2a, 6);
                    pow2a *= 2;
                }
                pow2a = 1;
                for (int j = 0; j < texture2.m_mipLevels; j++)
                {
                    graphicsContext.SetComputeUAVT(texture2, j, 3);
                    graphicsContext.Dispatch((int)(texture2.m_width + 7) / 8 / pow2a, (int)(texture2.m_height + 7) / 8 / pow2a, 6);
                    pow2a *= 2;
                }
                //graphicsContext.ClearTextureRTV(texture1);
                //graphicsContext.ClearTextureRTV(texture2);
                graphicsContext.SetPObject(IrradianceMap0);

                pow2a = 1;
                for (int j = 0; j < texture1.m_mipLevels; j++)
                {
                    for (int k = 0; k < itCount; k++)
                    {
                        graphicsContext.SetComputeUAVT(texture1, j, 3);
                        graphicsContext.SetComputeCBVR(constantBuffers, k, 1, 0);
                        graphicsContext.Dispatch((int)(texture1.m_width + 7) / 8 / pow2a, (int)(texture1.m_height + 7) / 8 / pow2a, 6);
                    }
                    pow2a *= 2;
                }

                graphicsContext.SetComputeSRVT(texture0, 2);
                graphicsContext.SetPObject(EnvironmentMap0);
                pow2a = 1;
                for (int j = 0; j < texture2.m_mipLevels; j++)
                {
                    for (int k = 0; k < itCount; k++)
                    {
                        graphicsContext.SetComputeUAVT(texture2, j, 3);
                        graphicsContext.SetComputeCBVR(constantBuffers, k, 1, 0);
                        graphicsContext.SetComputeCBVR(constantBuffers, j, 1, 1);
                        graphicsContext.Dispatch((int)(texture2.m_width + 7) / 8 / pow2a, (int)(texture2.m_height + 7) / 8 / pow2a, 6);
                    }
                    pow2a *= 2;
                }
            }
            graphicsContext.EndCommand();
            graphicsContext.Execute();
            context.Clear();
        }
Esempio n. 4
0
 public void MoveToAnother(MiscProcessContext context)
 {
     miscProcessPairs.MoveTo_CC(context.miscProcessPairs);
 }