Пример #1
0
        internal unsafe void RecordCommands(MyRenderableProxy proxy, VertexBufferId stream, int voxelMatId)
        {
            MyObjectData objectData = proxy.ObjectData;

            var foliageType = MyVoxelMaterials1.Table[voxelMatId].FoliageType;

            MyMapping mapping;

            mapping = MyMapping.MapDiscard(RC.Context, proxy.ObjectBuffer);
            void *ptr = &objectData;

            mapping.stream.Write(new IntPtr(ptr), 0, sizeof(MyObjectData));
            mapping.Unmap();

            RC.SetCB(MyCommon.OBJECT_SLOT, proxy.ObjectBuffer);

            RC.SetGS(m_GS[foliageType]);
            RC.SetPS(m_PS[foliageType]);

            if (MyVoxelMaterials1.Table[voxelMatId].FoliageColorTextureArray != null)
            {
                RC.BindRawSRV(0, MyVoxelMaterials1.Table[voxelMatId].FoliageColorTextureArray.ShaderView);
                RC.BindRawSRV(1, MyVoxelMaterials1.Table[voxelMatId].FoliageNormalTextureArray.ShaderView);
            }
            else
            {
                RC.BindRawSRV(0, MyTextures.GetView(MyTextures.GetTexture(MyVoxelMaterials1.Table[voxelMatId].FoliageArray_Texture, MyTextureEnum.COLOR_METAL, true)));
                RC.BindRawSRV(1, MyTextures.GetView(MyTextures.GetTexture(MyVoxelMaterials1.Table[voxelMatId].FoliageArray_NormalTexture, MyTextureEnum.NORMALMAP_GLOSS, true)));
            }

            RC.SetVB(0, stream.Buffer, stream.Stride);
            Context.DrawAuto();
            RC.Stats.DrawAuto++;
        }
Пример #2
0
        internal static unsafe void MoveToGPU()
        {
            var mapping = MyMapping.MapDiscard(m_buffer);

            mapping.WriteAndPosition(TransferData, sizeof(MyPerMaterialData) * TransferHashIndex.Count);
            mapping.Unmap();
        }
Пример #3
0
        internal static void DrawQuad(float x, float y, float w, float h)
        {
            //RC.Context.PixelShader.Set(m_blitTextureShader);

            RC.DeviceContext.VertexShader.Set(m_screenVertexShader);
            RC.DeviceContext.InputAssembler.InputLayout = m_inputLayout;

            var mapping   = MyMapping.MapDiscard(m_quadBuffer.Buffer);
            var tmpFormat = new MyVertexFormatPosition2Texcoord(new Vector2(x, y), new Vector2(0, 0));

            mapping.WriteAndPosition(ref tmpFormat);

            tmpFormat = new MyVertexFormatPosition2Texcoord(new Vector2(x + w, y + h), new Vector2(1, 1));
            mapping.WriteAndPosition(ref tmpFormat);

            tmpFormat = new MyVertexFormatPosition2Texcoord(new Vector2(x, y + h), new Vector2(0, 1));
            mapping.WriteAndPosition(ref tmpFormat);

            tmpFormat = new MyVertexFormatPosition2Texcoord(new Vector2(x, y), new Vector2(0, 0));
            mapping.WriteAndPosition(ref tmpFormat);

            tmpFormat = new MyVertexFormatPosition2Texcoord(new Vector2(x + w, y), new Vector2(1, 0));
            mapping.WriteAndPosition(ref tmpFormat);

            tmpFormat = new MyVertexFormatPosition2Texcoord(new Vector2(x + w, y + h), new Vector2(1, 1));
            mapping.WriteAndPosition(ref tmpFormat);

            mapping.Unmap();

            RC.DeviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;

            RC.DeviceContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(m_quadBuffer.Buffer, m_quadBuffer.Stride, 0));
            RC.DeviceContext.Draw(6, 0);
        }
        internal unsafe void RecordCommands(MyRenderableProxy proxy, VertexBufferId stream, int voxelMatId)
        {
            if (stream == VertexBufferId.NULL)
            {
                return;
            }

            var foliageType = MyVoxelMaterials1.Table[voxelMatId].FoliageType;

            MyMapping mapping = MyMapping.MapDiscard(RC.DeviceContext, proxy.ObjectBuffer);

            mapping.WriteAndPosition(ref proxy.NonVoxelObjectData);
            mapping.WriteAndPosition(ref proxy.CommonObjectData);
            mapping.Unmap();

            RC.SetCB(MyCommon.OBJECT_SLOT, proxy.ObjectBuffer);

            RC.SetGS(m_GS[foliageType]);
            RC.SetPS(m_PS[foliageType]);

            if (MyVoxelMaterials1.Table[voxelMatId].FoliageColorTextureArray != null)
            {
                RC.BindRawSRV(0, MyVoxelMaterials1.Table[voxelMatId].FoliageColorTextureArray.ShaderView);
                RC.BindRawSRV(1, MyVoxelMaterials1.Table[voxelMatId].FoliageNormalTextureArray.ShaderView);
            }
            else
            {
                RC.BindRawSRV(0, MyTextures.GetView(MyTextures.GetTexture(MyVoxelMaterials1.Table[voxelMatId].FoliageArray_Texture, MyTextureEnum.COLOR_METAL, true)));
                RC.BindRawSRV(1, MyTextures.GetView(MyTextures.GetTexture(MyVoxelMaterials1.Table[voxelMatId].FoliageArray_NormalTexture, MyTextureEnum.NORMALMAP_GLOSS, true)));
            }

            RC.SetVB(0, stream.Buffer, stream.Stride);
            Context.DrawAuto();
            RC.Stats.DrawAuto++;
        }
        internal unsafe void RecordCommands(MyRenderableProxy proxy, IVertexBuffer stream, int voxelMatId)
        {
            if (stream == null)
            {
                return;
            }

            var foliageType = MyVoxelMaterials1.Table[voxelMatId].FoliageType;

            MyMapping mapping = MyMapping.MapDiscard(RC, proxy.ObjectBuffer);

            mapping.WriteAndPosition(ref proxy.NonVoxelObjectData);
            mapping.WriteAndPosition(ref proxy.CommonObjectData);
            mapping.Unmap();

            RC.AllShaderStages.SetConstantBuffer(MyCommon.OBJECT_SLOT, proxy.ObjectBuffer);

            RC.GeometryShader.Set(m_GS[foliageType]);
            RC.PixelShader.Set(m_PS[foliageType]);

            if (MyVoxelMaterials1.Table[voxelMatId].FoliageColorTextureArray != null)
            {
                RC.AllShaderStages.SetSrv(0, MyVoxelMaterials1.Table[voxelMatId].FoliageColorTextureArray);
                RC.AllShaderStages.SetSrv(1, MyVoxelMaterials1.Table[voxelMatId].FoliageNormalTextureArray);
            }
            else
            {
                MyFileTextureManager texManager = MyManagers.FileTextures;
                RC.AllShaderStages.SetSrv(0, texManager.GetTexture(MyVoxelMaterials1.Table[voxelMatId].FoliageArray_Texture, MyFileTextureEnum.COLOR_METAL, true));
                RC.AllShaderStages.SetSrv(1, texManager.GetTexture(MyVoxelMaterials1.Table[voxelMatId].FoliageArray_NormalTexture, MyFileTextureEnum.NORMALMAP_GLOSS, true));
            }

            RC.SetVertexBuffer(0, stream);
            RC.DrawAuto();
        }
Пример #6
0
        internal override void Draw()
        {
            var RC = MyImmediateRC.RC;


            RC.Context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;

            var mapping = MyMapping.MapDiscard(RC.Context, MyCommon.ProjectionConstants.Buffer);

            mapping.stream.Write(Matrix.Transpose(MyEnvironment.ViewProjection));
            mapping.Unmap();

            RC.Context.Rasterizer.SetViewport(0, 0, MyRender.ViewportResolution.X, MyRender.ViewportResolution.Y);

            RC.Context.PixelShader.SetSamplers(0, MyRender.StandardSamplers);

            RC.SetCB(MyCommon.FRAME_SLOT, MyCommon.FrameConstants.Buffer);
            RC.SetCB(MyCommon.PROJECTION_SLOT, MyCommon.ProjectionConstants.Buffer);

            RC.SetVS(m_vs);
            RC.SetPS(m_ps);

            RC.BindRawSRV(0, m_indirectionBuffer.m_SRV, m_instanceBuffer.m_SRV, m_indicesBuffer.m_SRV, m_vertexPositionBuffer.m_SRV, m_vertexNormalBuffer.m_SRV);

            RC.BindGBufferForWrite(MyGBuffer.Main);

            RC.Context.Draw(m_pageSize * m_pageTable.Count, 0);
        }
Пример #7
0
        /// <returns>True if the section was found</returns>
        private static bool RecordMeshSectionCommands(MeshId model, LodMeshId lodModelId,
                                                      MyRenderableComponent rendercomp, MyRenderLod renderLod,
                                                      MyOutlineDesc desc, ref OutlineConstantsLayout constants, ref float maxThickness)
        {
            MeshSectionId sectionId;
            bool          found = MyMeshes.TryGetMeshSection(model, rendercomp.CurrentLod, desc.SectionIndex, out sectionId);

            if (!found)
            {
                return(false);
            }

            MyMeshSectionInfo1 section = sectionId.Info;

            MyMeshSectionPartInfo1[] meshes = section.Meshes;
            for (int idx = 0; idx < meshes.Length; idx++)
            {
                maxThickness    = Math.Max(desc.Thickness, maxThickness);
                constants.Color = desc.Color.ToVector4();

                var mapping = MyMapping.MapDiscard(MyCommon.OutlineConstants);
                mapping.WriteAndPosition(ref constants);
                mapping.Unmap();

                RC.BindShaders(renderLod.HighlightShaders[meshes[idx].PartIndex]);

                MyRenderableProxy proxy = renderLod.RenderableProxies[meshes[idx].PartIndex];
                MyOutlinePass.Instance.RecordCommands(proxy, meshes[idx].PartSubmeshIndex);
            }

            return(true);
        }
Пример #8
0
        private static unsafe void Precompute1(MyAtmosphere atmosphere, ref AtmosphereLuts luts)
        {
            var RC = MyImmediateRC.RC;

            var cb = MyCommon.GetObjectCB(sizeof(AtmosphereConstants));

            RC.ComputeShader.SetConstantBuffer(1, cb);

            var worldMatrix = atmosphere.WorldMatrix;

            worldMatrix.Translation -= MyRender11.Environment.Matrices.CameraPosition;

            var constants = FillAtmosphereConstants(MyRender11.Environment.Matrices.CameraPosition, atmosphere);

            var mapping = MyMapping.MapDiscard(cb);

            mapping.WriteAndPosition(ref constants);
            mapping.Unmap();

            // transmittance
            RC.ComputeShader.SetUav(0, luts.TransmittanceLut);

            RC.ComputeShader.Set(m_precomputeDensity);
            RC.Dispatch(512 / 8, 128 / 8, 1);

            RC.ComputeShader.SetUav(0, null);
        }
Пример #9
0
        internal static void SSGrass(MyBindableResource destination,
                                     MyBindableResource depth, MyBindableResource source, MyBindableResource gbuffer2)
        {
            var context = MyRender.Context;

            var cbuffer = MyCommon.GetObjectBuffer(16);
            var mapping = MyMapping.MapDiscard(cbuffer.Buffer);

            mapping.stream.Write(MyRender.Settings.GrassPostprocessCloseDistance);
            mapping.Unmap();

            context.PixelShader.SetConstantBuffer(1, cbuffer.Buffer);

            context.OutputMerger.BlendState = null;
            context.Rasterizer.SetViewport(0, 0, MyRender.ViewportResolution.X, MyRender.ViewportResolution.Y);

            context.VertexShader.Set(FullscreenShader.VertexShader);
            context.PixelShader.Set(SSGrassShader.PixelShader);

            //var array = new ShaderResourceView[] { depth, resource, MyRender.MainGbuffer.Gbuffers[2].ShaderView };
            //context.OutputMerger.SetTargets(null as DepthStencilView, target);
            //context.PixelShader.SetShaderResources(0, array);

            RC.BindDepthRT(null, DepthStencilAccess.ReadWrite, destination);
            RC.BindSRV(0, depth, source, gbuffer2);

            context.Draw(3, 0);
        }
Пример #10
0
        internal static void Run(MyBindableResource dst, MyBindableResource src, MyBindableResource avgLum, MyBindableResource bloom, bool enableTonemapping = true)
        {
            //Debug.Assert(src.GetSize() == dst.GetSize());

            var mapping = MyMapping.MapDiscard(MyCommon.GetObjectCB(16));

            mapping.stream.Write(MyRender11.Settings.MiddleGrey);
            mapping.stream.Write(MyRender11.Settings.LuminanceExposure);
            mapping.stream.Write(MyRender11.Settings.BloomExposure);
            mapping.stream.Write(MyRender11.Settings.BloomMult);
            mapping.Unmap();

            RC.CSSetCB(0, MyCommon.FrameConstants);
            RC.CSSetCB(1, MyCommon.GetObjectCB(16));

            RC.BindUAV(0, dst);
            RC.BindSRV(0, src, avgLum, bloom);

            RC.Context.ComputeShader.SetSampler(0, MyRender11.m_defaultSamplerState);

            if (enableTonemapping)
            {
                RC.SetCS(m_cs);
            }
            else
            {
                RC.SetCS(m_csSkip);
            }

            var size = dst.GetSize();

            RC.Context.Dispatch((size.X + m_numthreads - 1) / m_numthreads, (size.Y + m_numthreads - 1) / m_numthreads, 1);
            RC.SetCS(null);
        }
Пример #11
0
        internal unsafe static void UpdateAlphamaskViewsConstants()
        {
            System.Diagnostics.Debug.Assert(s_viewVectorData.Length == 181, "Only supported scheme of views for now");

            Matrix *viewVectors = stackalloc Matrix[s_viewVectorData.Length];

            for (int i = 0; i < s_viewVectorData.Length; i++)
            {
                Matrix   mm = Matrix.Identity;
                string[] sp = s_viewVectorData[i].Split(',');
                mm.M11         = Convert.ToSingle(sp[0], CultureInfo.InvariantCulture);
                mm.M12         = Convert.ToSingle(sp[1], CultureInfo.InvariantCulture);
                mm.M13         = Convert.ToSingle(sp[2], CultureInfo.InvariantCulture);
                mm.M21         = Convert.ToSingle(sp[3], CultureInfo.InvariantCulture);
                mm.M22         = Convert.ToSingle(sp[4], CultureInfo.InvariantCulture);
                mm.M23         = Convert.ToSingle(sp[5], CultureInfo.InvariantCulture);
                mm.M31         = Convert.ToSingle(sp[6], CultureInfo.InvariantCulture);
                mm.M32         = Convert.ToSingle(sp[7], CultureInfo.InvariantCulture);
                mm.M33         = Convert.ToSingle(sp[8], CultureInfo.InvariantCulture);
                mm             = Matrix.Normalize(mm);
                mm             = mm * Matrix.CreateRotationX(MathHelper.PiOver2);
                mm.Up          = -mm.Up;
                viewVectors[i] = mm;
            }

            var mapping = MyMapping.MapDiscard(MyCommon.AlphamaskViewsConstants);

            for (int vectorIndex = 0; vectorIndex < s_viewVectorData.Length; ++vectorIndex)
            {
                mapping.WriteAndPosition(ref viewVectors[vectorIndex]);
            }
            mapping.Unmap();
        }
Пример #12
0
        internal static void Run(IRtvBindable dst, MyGBuffer gbuffer, ISrvBindable resolvedDepth)
        {
            RC.ClearRtv(dst, new SharpDX.Color4(1, 1, 1, 1));

            var paramsCB = MyCommon.GetObjectCB(16 * (2 + NUM_SAMPLES * 2));

            var mapping = MyMapping.MapDiscard(paramsCB);

            mapping.WriteAndPosition(ref Params.Data);
            FillRandomVectors(mapping);
            mapping.Unmap();

            if (!MyStereoRender.Enable)
            {
                RC.AllShaderStages.SetConstantBuffer(MyCommon.FRAME_SLOT, MyCommon.FrameConstants);
            }
            else
            {
                MyStereoRender.BindRawCB_FrameConstants(RC);
            }
            RC.AllShaderStages.SetConstantBuffer(1, paramsCB);

            RC.PixelShader.Set(m_ps);
            RC.SetRtv(dst);

            RC.PixelShader.SetSrvs(0, gbuffer);
            RC.PixelShader.SetSamplers(0, MySamplerStateManager.StandardSamplers);
            RC.PixelShader.SetSrv(5, resolvedDepth);
            RC.SetDepthStencilState(MyDepthStencilStateManager.IgnoreDepthStencil);

            DrawFullscreenQuad();
            RC.ResetTargets();
        }
Пример #13
0
        static unsafe IConstantBuffer GetObjectCB(MyRenderContext RC, MyInstanceComponent instance, float stateData)
        {
            Vector4 col0, col1, col2;

            instance.GetMatrixCols(0, out col0, out col1, out col2);
            Matrix matrix = Matrix.Identity;

            matrix.SetRow(0, col0);
            matrix.SetRow(1, col1);
            matrix.SetRow(2, col2);
            matrix = Matrix.Transpose(matrix);

            int cbSize = sizeof(MyObjectDataCommon);

            cbSize += sizeof(MyObjectDataNonVoxel);

            IConstantBuffer      cb           = MyCommon.GetObjectCB(cbSize);
            var                  mapping      = MyMapping.MapDiscard(RC, cb);
            MyObjectDataNonVoxel nonVoxelData = new MyObjectDataNonVoxel();

            mapping.WriteAndPosition(ref nonVoxelData);
            MyObjectDataCommon commonData = new MyObjectDataCommon();

            commonData.LocalMatrix = matrix;
            commonData.ColorMul    = Vector3.One;
            commonData.KeyColor    = new Vector3(0, -1f, 0f);
            commonData.CustomAlpha = stateData;

            mapping.WriteAndPosition(ref commonData);
            mapping.Unmap();
            return(cb);
        }
Пример #14
0
        internal static void DrawAtmosphereInscatter(uint ID)
        {
            var texR = MyAtmosphereRenderer.AtmosphereLUT[ID].InscatterLut;


            RC.Context.PixelShader.Set(m_blitTexture3DShader);
            RC.Context.PixelShader.SetShaderResource(0, texR.ShaderView);

            var cb = MyCommon.GetMaterialCB(sizeof(uint));

            RC.Context.PixelShader.SetConstantBuffer(5, cb);

            for (int i = 0; i < 16; ++i)
            {
                var mapping = MyMapping.MapDiscard(cb);
                mapping.stream.Write(((float)2 * i + 0.5f / 32.0f) / (float)32);
                mapping.Unmap();

                DrawQuad(0, 32 * i, 128, 32);

                mapping = MyMapping.MapDiscard(cb);
                mapping.stream.Write(((float)2 * i + 1 + 0.5f / 32.0f) / (float)32);
                mapping.Unmap();

                DrawQuad(128, 32 * i, 128, 32);
            }

            RC.Context.PixelShader.SetShaderResource(0, null);
        }
Пример #15
0
        internal static IConstantBuffer GetCB_blur(MyStereoRegion region, Vector2I uavSize)
        {
            int offX = 0;
            int maxX = uavSize.X - 1;

            if (region == MyStereoRegion.LEFT)
            {
                maxX = uavSize.X / 2 - 1;
            }
            else if (region == MyStereoRegion.RIGHT)
            {
                offX = uavSize.X / 2;
                maxX = uavSize.X / 2 - 1;
            }

            var buffer  = MyCommon.GetObjectCB(16);
            var mapping = MyMapping.MapDiscard(buffer);

            mapping.WriteAndPosition(ref offX);
            mapping.WriteAndPosition(ref maxX);
            var size = new Vector2(uavSize.X, uavSize.Y);

            mapping.WriteAndPosition(ref size);
            mapping.Unmap();
            return(buffer);
        }
Пример #16
0
        internal static void Run(MyBindableResource dst, MyGBuffer gbuffer, MyBindableResource resolvedDepth)
        {
            RC.DeviceContext.ClearRenderTargetView((dst as IRenderTargetBindable).RTV, new SharpDX.Color4(1, 1, 1, 1));

            var paramsCB = MyCommon.GetObjectCB(16 * (2 + NUM_SAMPLES * 2));

            var mapping = MyMapping.MapDiscard(paramsCB);

            mapping.WriteAndPosition(ref Params);
            FillRandomVectors(mapping);
            mapping.Unmap();

            if (!MyStereoRender.Enable)
            {
                RC.SetCB(0, MyCommon.FrameConstants);
            }
            else
            {
                MyStereoRender.BindRawCB_FrameConstants(RC);
            }
            RC.SetCB(1, paramsCB);

            RC.SetPS(m_ps);
            RC.BindDepthRT(null, DepthStencilAccess.DepthReadOnly, dst);

            RC.BindGBufferForRead(0, gbuffer);
            RC.BindSRV(5, resolvedDepth);

            DrawFullscreenQuad();
        }
Пример #17
0
        internal static unsafe void FillBuffers(MyRenderableProxy proxy, MyRenderContext rc)
        {
            MyMapping mapping;

            mapping = MyMapping.MapDiscard(rc, proxy.ObjectBuffer);
            if (proxy.NonVoxelObjectData.IsValid)
            {
                mapping.WriteAndPosition(ref proxy.NonVoxelObjectData);
            }
            else if (proxy.VoxelCommonObjectData.IsValid)
            {
                mapping.WriteAndPosition(ref proxy.VoxelCommonObjectData);
            }
            mapping.WriteAndPosition(ref proxy.CommonObjectData);

            if (proxy.SkinningMatrices != null)
            {
                if (proxy.DrawSubmesh.BonesMapping == null)
                {
                    mapping.WriteAndPosition(proxy.SkinningMatrices, Math.Min(MyRender11Constants.SHADER_MAX_BONES, proxy.SkinningMatrices.Length));
                }
                else
                {
                    for (int j = 0; j < proxy.DrawSubmesh.BonesMapping.Length; j++)
                    {
                        mapping.WriteAndPosition(ref proxy.SkinningMatrices[proxy.DrawSubmesh.BonesMapping[j]]);
                    }
                }
            }
            mapping.Unmap();
        }
Пример #18
0
        internal unsafe void RecordCommands(MyRenderableProxy proxy, VertexBufferId stream, int voxelMatId)
        {
            //var worldMat = proxy.WorldMatrix;
            //worldMat.Translation -= MyEnvironment.CameraPosition;
            //proxy.ObjectData.LocalMatrix = worldMat;

            //var worldMatrix = Matrix.CreateTranslation(-MyEnvironment.CameraPosition);
            MyObjectData objectData = proxy.ObjectData;
            //objectData.LocalMatrix = worldMat;

            MyMapping mapping;

            mapping = MyMapping.MapDiscard(RC.Context, proxy.objectBuffer);
            void *ptr = &objectData;

            mapping.stream.Write(new IntPtr(ptr), 0, sizeof(MyObjectData));
            mapping.Unmap();

            RC.SetCB(MyCommon.OBJECT_SLOT, proxy.objectBuffer);

            RC.BindRawSRV(0, MyTextures.GetView(MyTextures.GetTexture(MyVoxelMaterials1.Table[voxelMatId].FoliageArray_Texture, MyTextureEnum.COLOR_METAL, true)));

            RC.SetVB(0, stream.Buffer, stream.Stride);
            Context.DrawAuto();
            RC.Stats.DrawAuto++;
        }
Пример #19
0
        internal unsafe static void RebuildMaterialFoliageTable()
        {
            var array = stackalloc MaterialFoliageConstantsElem[256];
            int N     = Table.Length;

            for (int i = 0; i < N; i++)
            {
                uint arraySize = 0;

                if (Table[i].FoliageColorTextureArray != null)
                {
                    arraySize = (uint)Table[i].FoliageColorTextureArray.ArrayLen;
                }
                else
                {
                    var arrayTexId = MyTextures.GetTexture(Table[i].FoliageArray_Texture, MyTextureEnum.COLOR_METAL, true);
                    arraySize = (uint)((Texture2D)MyTextures.Textures.Data[arrayTexId.Index].Resource).Description.ArraySize;
                }

                array[i] = new MaterialFoliageConstantsElem {
                    Scale       = Table[i].FoliageScale,
                    ScaleVar    = Table[i].FoliageScaleVariation,
                    TexturesNum = arraySize
                };
            }
            var mapping = MyMapping.MapDiscard(MyCommon.MaterialFoliageTableConstants);

            for (int arrayIndex = 0; arrayIndex < N; ++arrayIndex)
            {
                mapping.WriteAndPosition(ref array[arrayIndex]);
            }
            mapping.Unmap();
        }
Пример #20
0
        internal static void DrawQuad(float x, float y, float w, float h, int i)
        {
            RC.Context.VertexShader.Set(m_screenVertexShader);
            RC.Context.PixelShader.Set(m_blitTextureShader);
            RC.Context.InputAssembler.InputLayout = m_inputLayout;

            var mapping = MyMapping.MapDiscard(m_quadBuffer.Buffer);

            mapping.stream.Write(new MyVertexFormatPosition2Texcoord(new Vector2(x, y), new Vector2(0, 0)));
            mapping.stream.Write(new MyVertexFormatPosition2Texcoord(new Vector2(x + w, y + h), new Vector2(1, 1)));
            mapping.stream.Write(new MyVertexFormatPosition2Texcoord(new Vector2(x, y + h), new Vector2(0, 1)));

            mapping.stream.Write(new MyVertexFormatPosition2Texcoord(new Vector2(x, y), new Vector2(0, 0)));
            mapping.stream.Write(new MyVertexFormatPosition2Texcoord(new Vector2(x + w, y), new Vector2(1, 0)));
            mapping.stream.Write(new MyVertexFormatPosition2Texcoord(new Vector2(x + w, y + h), new Vector2(1, 1)));

            mapping.Unmap();


            RC.Context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
            RC.Context.PixelShader.SetShaderResource(0, MyGeometryRenderer.m_envProbe.cubemapPrefiltered.SubresourceSrv(i, 1));

            RC.Context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(m_quadBuffer.Buffer, m_quadBuffer.Stride, 0));
            RC.Context.Draw(6, 0);
        }
Пример #21
0
        internal static void Run(MyBindableResource dst, MyGBuffer gbuffer, MyBindableResource resolvedDepth)
        {
            RC.Context.ClearRenderTargetView((dst as IRenderTargetBindable).RTV, new SharpDX.Color4(1, 1, 1, 1));

            var paramsCB = MyCommon.GetObjectCB(16 * (2 + NUM_SAMPLES * 2));

            var mapping = MyMapping.MapDiscard(paramsCB);

            mapping.stream.Write(Params.MinRadius);
            mapping.stream.Write(Params.MaxRadius);
            mapping.stream.Write(Params.RadiusGrow);
            mapping.stream.Write(Params.Falloff);
            mapping.stream.Write(Params.RadiusBias);
            mapping.stream.Write(Params.Contrast);
            mapping.stream.Write(Params.Normalization);
            mapping.stream.Write(0);
            FillRandomVectors(mapping.stream);
            mapping.Unmap();

            RC.SetCB(0, MyCommon.FrameConstants);
            RC.SetCB(1, paramsCB);

            RC.SetPS(m_ps);
            RC.BindDepthRT(null, DepthStencilAccess.DepthReadOnly, dst);

            RC.BindGBufferForRead(0, gbuffer);
            RC.BindSRV(5, resolvedDepth);

            DrawFullscreenQuad();
        }
Пример #22
0
        private static void RecordMeshPartCommands(MeshId model, LodMeshId lodModelId,
                                                   MyRenderableComponent rendercomp, MyRenderLod renderLod,
                                                   MyOutlineDesc desc, ref float maxThickness)
        {
            OutlineConstantsLayout constants = new OutlineConstantsLayout();
            var submeshCount = lodModelId.Info.PartsNum;

            for (int submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex)
            {
                var part = MyMeshes.GetMeshPart(model, rendercomp.CurrentLod, submeshIndex);

                maxThickness    = Math.Max(desc.Thickness, maxThickness);
                constants.Color = desc.Color.ToVector4();
                if (desc.PulseTimeInFrames > 0)
                {
                    constants.Color.W *= (float)Math.Pow((float)Math.Cos(2.0 * Math.PI * (float)MyRender11.Settings.GameplayFrame / (float)desc.PulseTimeInFrames), 2.0);
                }

                var mapping = MyMapping.MapDiscard(MyCommon.OutlineConstants);
                mapping.WriteAndPosition(ref constants);
                mapping.Unmap();

                RC.BindShaders(renderLod.HighlightShaders[submeshIndex]);
                MyOutlinePass.Instance.RecordCommands(renderLod.RenderableProxies[submeshIndex]);
            }
        }
Пример #23
0
        static void TransferDataCustomProjections()
        {
            var mapping = MyMapping.MapDiscard(RC, m_cbCustomProjections);

            for (int i = 0; i < MyRenderProxy.BillboardsViewProjectionRead.Count; i++)
            {
                MyBillboardViewProjection viewprojection = MyRenderProxy.BillboardsViewProjectionRead[i];

                var scaleX  = viewprojection.Viewport.Width / (float)MyRender11.ViewportResolution.X;
                var scaleY  = viewprojection.Viewport.Height / (float)MyRender11.ViewportResolution.Y;
                var offsetX = viewprojection.Viewport.OffsetX / (float)MyRender11.ViewportResolution.X;
                var offsetY = (MyRender11.ViewportResolution.Y - viewprojection.Viewport.OffsetY - viewprojection.Viewport.Height)
                              / (float)MyRender11.ViewportResolution.Y;

                var viewportTransformation = new Matrix(
                    scaleX, 0, 0, 0,
                    0, scaleY, 0, 0,
                    0, 0, 1, 0,
                    offsetX, offsetY, 0, 1
                    );

                var transpose = Matrix.Transpose(viewprojection.ViewAtZero * viewprojection.Projection * viewportTransformation);
                mapping.WriteAndPosition(ref transpose);
            }

            for (int i = MyRenderProxy.BillboardsViewProjectionRead.Count; i < MAX_CUSTOM_PROJECTIONS_SIZE; i++)
            {
                mapping.WriteAndPosition(ref Matrix.Identity);
            }

            mapping.Unmap();
        }
Пример #24
0
        internal static unsafe void UpdateVertexBuffer(InstancingId id)
        {
            var info = id.Info;

            if (info.VisibleCapacity == 0)
                return;

            fixed(byte *ptr = info.Data)
            {
                IVertexBuffer buffer = Data[id.Index].VB;

                if (buffer == null)
                {
                    Data[id.Index].VB = MyManagers.Buffers.CreateVertexBuffer(
                        info.DebugName, info.VisibleCapacity, info.Stride,
                        new IntPtr(ptr), SharpDX.Direct3D11.ResourceUsage.Dynamic);
                }
                else if (buffer.ElementCount < info.VisibleCapacity ||
                         buffer.Description.StructureByteStride != info.Stride)
                {
                    MyManagers.Buffers.Resize(Data[id.Index].VB, info.VisibleCapacity, info.Stride, new IntPtr(ptr));
                }
                else
                {
                    var mapping = MyMapping.MapDiscard(MyImmediateRC.RC, buffer);
                    mapping.WriteAndPosition(info.Data, info.VisibleCapacity * info.Stride);
                    mapping.Unmap();
                }
            }
        }
Пример #25
0
        internal static void PreparePointLights()
        {
            var activePointlights = 0;

            MyLights.Update();
            MyLights.PointlightsBvh.OverlapAllFrustum(ref MyEnvironment.ViewFrustumClippedD, VisiblePointlights);

            bool visiblePointlights = VisiblePointlights.Count != 0;

            if (!visiblePointlights && !m_lastFrameVisiblePointlights)
            {
                return;
            }

            m_lastFrameVisiblePointlights = visiblePointlights;

            if (VisiblePointlights.Count > MyRender11Constants.MAX_POINT_LIGHTS)
            {
                VisiblePointlights.Sort((x, y) => x.ViewerDistanceSquared.CompareTo(y.ViewerDistanceSquared));

                while (VisiblePointlights.Count > MyRender11Constants.MAX_POINT_LIGHTS)
                {
                    VisiblePointlights.RemoveAtFast(VisiblePointlights.Count - 1);
                }
            }

            foreach (var light in VisiblePointlights)
            {
                MyLights.WritePointlightConstants(light, ref m_pointlightsCullBuffer[activePointlights]);

                activePointlights++;
                Debug.Assert(activePointlights <= MyRender11Constants.MAX_POINT_LIGHTS);
            }
            for (int lightIndex = activePointlights; lightIndex < MyRender11Constants.MAX_POINT_LIGHTS; ++lightIndex)
            {
                MyLights.WritePointlightConstants(LightId.NULL, ref m_pointlightsCullBuffer[lightIndex]);
            }

            var mapping = MyMapping.MapDiscard(MyCommon.GetObjectCB(16));

            mapping.WriteAndPosition(ref activePointlights);
            mapping.Unmap();

            mapping = MyMapping.MapDiscard(m_pointlightCullHwBuffer.Buffer);
            mapping.WriteAndPosition(m_pointlightsCullBuffer, 0, MyRender11Constants.MAX_POINT_LIGHTS);
            mapping.Unmap();

            RC.CSSetCB(0, MyCommon.FrameConstants);
            RC.CSSetCB(1, MyCommon.GetObjectCB(16));

            //RC.BindUAV(0, MyScreenDependants.m_test);
            RC.BindUAV(0, MyScreenDependants.m_tileIndices);
            RC.BindGBufferForRead(0, MyGBuffer.Main);
            RC.CSBindRawSRV(MyCommon.POINTLIGHT_SLOT, m_pointlightCullHwBuffer.Srv);
            RC.SetCS(m_preparePointLights);

            RC.DeviceContext.Dispatch(MyScreenDependants.TilesX, MyScreenDependants.TilesY, 1);
            RC.SetCS(null);
        }
Пример #26
0
        internal unsafe static void RenderSpotlights()
        {
            var coneMesh = MyMeshes.GetMeshId(X.TEXT("Models/Debug/Cone.mwm"));
            var buffers  = MyMeshes.GetLodMesh(coneMesh, 0).Buffers;

            RC.SetVB(0, buffers.VB0.Buffer, buffers.VB0.Stride);
            RC.SetIB(buffers.IB.Buffer, buffers.IB.Format);

            RC.SetVS(SpotlightProxyVs);
            RC.SetIL(SpotlightProxyIL);

            RC.SetRS(MyRender11.m_nocullRasterizerState);

            var cb = MyCommon.GetObjectCB(sizeof(SpotlightConstants));

            RC.SetCB(1, cb);
            RC.Context.PixelShader.SetSampler(MyCommon.SHADOW_SAMPLER_SLOT, MyRender11.m_shadowmapSamplerState);

            int index       = 0;
            int casterIndex = 0;

            foreach (var id in VisibleSpotlights)
            {
                var mapping = MyMapping.MapDiscard(cb);
                mapping.stream.Write(MyLightRendering.Spotlights[index]);
                mapping.Unmap();

                RC.Context.PixelShader.SetShaderResource(13, MyTextures.GetView(MyLights.Spotlights[id.Index].ReflectorTexture));

                if (id.CastsShadows)
                {
                    RC.Context.PixelShader.SetShaderResource(14, MyShadows.ShadowmapsPool[casterIndex].ShaderView);
                    casterIndex++;
                }

                RC.SetPS(SpotlightPs_Pixel);
                if (MyRender11.MultisamplingEnabled)
                {
                    RC.SetDS(MyDepthStencilState.TestEdgeStencil, 0);
                }
                RC.Context.DrawIndexed(MyMeshes.GetLodMesh(coneMesh, 0).Info.IndicesNum, 0, 0);

                if (MyRender11.MultisamplingEnabled)
                {
                    RC.SetPS(SpotlightPs_Sample);
                    RC.SetDS(MyDepthStencilState.TestEdgeStencil, 0x80);
                    RC.Context.DrawIndexed(MyMeshes.GetLodMesh(coneMesh, 0).Info.IndicesNum, 0, 0);
                }

                index++;
            }

            if (MyRender11.MultisamplingEnabled)
            {
                RC.SetDS(MyDepthStencilState.DefaultDepthState);
            }

            RC.SetRS(null);
        }
Пример #27
0
        internal static void PreparePointLights()
        {
            var activePointlights = 0;

            MyLights.Update();
            MyLights.PointlightsBvh.OverlapAllFrustum(ref MyEnvironment.ViewFrustumClippedD, VisiblePointlights);

            if (VisiblePointlights.Count > MyRender11Constants.MAX_POINT_LIGHTS)
            {
                VisiblePointlights.Sort((x, y) => x.ViewerDistanceSquared.CompareTo(y.ViewerDistanceSquared));

                while (VisiblePointlights.Count > MyRender11Constants.MAX_POINT_LIGHTS)
                {
                    VisiblePointlights.RemoveAtFast(VisiblePointlights.Count - 1);
                }
            }

            foreach (var light in VisiblePointlights)
            {
                MyLights.WritePointlightConstants(light, ref m_pointlightsCullBuffer[activePointlights]);

                activePointlights++;
                Debug.Assert(activePointlights <= MyRender11Constants.MAX_POINT_LIGHTS);
            }

            var mapping = MyMapping.MapDiscard(MyCommon.GetObjectCB(16));

            mapping.stream.Write(activePointlights);
            mapping.stream.Write(0f);
            mapping.stream.Write(0f);
            mapping.stream.Write(0f);
            mapping.Unmap();

            mapping = MyMapping.MapDiscard(m_pointlightCullHwBuffer.Buffer);
            for (int i = 0; i < activePointlights; i++)
            {
                mapping.stream.Write(m_pointlightsCullBuffer[i]);
            }
            for (int i = activePointlights; i < MyRender11Constants.MAX_POINT_LIGHTS; i++)
            {
                mapping.stream.Write(new MyPointlightConstants());
            }
            mapping.Unmap();

            RC.CSSetCB(0, MyCommon.FrameConstants);
            RC.CSSetCB(1, MyCommon.GetObjectCB(16));

            //RC.BindUAV(0, MyScreenDependants.m_test);
            RC.BindUAV(0, MyScreenDependants.m_tileIndexes);
            RC.BindGBufferForRead(0, MyGBuffer.Main);
            RC.CSBindRawSRV(MyCommon.POINTLIGHT_SLOT, m_pointlightCullHwBuffer.Srv);
            RC.SetCS(m_preparePointLights);

            var size = MyRender11.ViewportResolution;

            RC.Context.Dispatch((size.X + TILE_SIZE - 1) / TILE_SIZE, (size.Y + TILE_SIZE - 1) / TILE_SIZE, 1);
            RC.SetCS(null);
        }
        internal unsafe void RecordCommands(MyRenderableProxy proxy, MyFoliageStream stream, int voxelMatId,
                                            VertexShader vertexShader, InputLayout inputLayout,
                                            int materialIndex, int indexCount, int startIndex, int baseVertex)
        {
            if (stream.m_stream == null)
            {
                return;
            }

            //var worldMatrix = proxy.WorldMatrix;
            //worldMatrix.Translation = Vector3D.Zero;
            //MyObjectData objectData = proxy.ObjectData;
            //objectData.LocalMatrix = Matrix.Identity;

            var worldMat = proxy.WorldMatrix;
            //worldMat.Translation -= MyRender11.Environment.CameraPosition;

            MyObjectDataCommon objectData = proxy.CommonObjectData;

            objectData.LocalMatrix = worldMat;

            MyMapping mapping = MyMapping.MapDiscard(RC, proxy.ObjectBuffer);

            mapping.WriteAndPosition(ref proxy.VoxelCommonObjectData);
            mapping.WriteAndPosition(ref objectData);
            mapping.Unmap();

            RC.AllShaderStages.SetConstantBuffer(MyCommon.OBJECT_SLOT, proxy.ObjectBuffer);

            BindProxyGeometry(proxy, RC);

            RC.VertexShader.Set(vertexShader);
            RC.SetInputLayout(inputLayout);

            int offset = -1;

            if (!stream.Append)
            {
                offset        = 0;
                stream.Append = true;
            }

            RC.SetTarget(stream.m_stream, offset);
            RC.AllShaderStages.SetConstantBuffer(MyCommon.FOLIAGE_SLOT, MyCommon.FoliageConstants);

            float densityFactor = MyVoxelMaterials1.Table[voxelMatId].FoliageDensity * MyRender11.Settings.GrassDensityFactor;

            float zero = 0;

            mapping = MyMapping.MapDiscard(RC, MyCommon.FoliageConstants);
            mapping.WriteAndPosition(ref densityFactor);
            mapping.WriteAndPosition(ref materialIndex);
            mapping.WriteAndPosition(ref voxelMatId);
            mapping.WriteAndPosition(ref zero);
            mapping.Unmap();

            RC.DrawIndexed(indexCount, startIndex, baseVertex);
        }
Пример #29
0
        internal static void Init()
        {
            m_VSCopy = MyShaders.CreateVs("Postprocess/PostprocessCopy.hlsl");

            {
                m_VBFullscreen = MyManagers.Buffers.CreateVertexBuffer(
                    "MyScreenPass.VBFullscreen", 4, VRageRender.Vertex.MyVertexFormatPositionTextureH.STRIDE,
                    usage: ResourceUsage.Dynamic);
                m_vbData[0] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(-1, -1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(0, 1f));
                m_vbData[1] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(-1, 1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(0, 0));
                m_vbData[2] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(1, -1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(1, 1f));
                m_vbData[3] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(1, 1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(1, 0f));
                MyMapping mapping = MyMapping.MapDiscard(RC, m_VBFullscreen);
                mapping.WriteAndPosition(m_vbData, 4);
                mapping.Unmap();
            }

            {
                m_VBLeftPart = MyManagers.Buffers.CreateVertexBuffer(
                    "MyVRScreenPass.VBLeftPart", 4, VRageRender.Vertex.MyVertexFormatPositionTextureH.STRIDE,
                    usage: ResourceUsage.Dynamic);
                m_vbData[0] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(-1, -1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(0, 1));
                m_vbData[1] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(-1, 1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(0, 0));
                m_vbData[2] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(0, -1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(0.5f, 1));
                m_vbData[3] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(0, 1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(0.5f, 0f));
                MyMapping mapping = MyMapping.MapDiscard(RC, m_VBLeftPart);
                mapping.WriteAndPosition(m_vbData, 4);
                mapping.Unmap();
            }

            {
                m_VBRightPart = MyManagers.Buffers.CreateVertexBuffer(
                    "MyVRScreenPass.VBRightPart", 4, VRageRender.Vertex.MyVertexFormatPositionTextureH.STRIDE,
                    usage: ResourceUsage.Dynamic);
                m_vbData[0] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(0, -1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(0.5f, 1));
                m_vbData[1] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(0, 1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(0.5f, 0));
                m_vbData[2] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(1, -1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(1, 1));
                m_vbData[3] = new VRageRender.Vertex.MyVertexFormatPositionTextureH(new Vector3(1, 1, 0),
                                                                                    new VRageMath.PackedVector.HalfVector2(1, 0));
                MyMapping mapping = MyMapping.MapDiscard(RC, m_VBRightPart);
                mapping.WriteAndPosition(m_vbData, 4);
                mapping.Unmap();
            }

            // just some shader bytecode is selected
            m_IL = MyShaders.CreateIL(m_VSCopy.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.TEXCOORD0_H));
        }
Пример #30
0
        internal static unsafe void MarkCascadesInStencil()
        {
            //RC.SetRS(MyRasterizerState.CullCW);

            RC.Context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
            RC.SetVB(0, m_cascadesBoundingsVertices.Buffer, m_cascadesBoundingsVertices.Stride);
            RC.SetIB(m_cubeIB.Buffer, m_cubeIB.Format);
            RC.SetIL(m_inputLayout);
            RC.Context.Rasterizer.SetViewport(0, 0, MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y);
            RC.SetCB(MyCommon.FRAME_SLOT, MyCommon.FrameConstants);
            RC.BindDepthRT(MyGBuffer.Main.DepthStencil, DepthStencilAccess.DepthReadOnly);
            RC.SetVS(m_markVS);
            RC.SetPS(m_markPS);

            var verticesCS = new Vector3D[8] {
                new Vector3D(-1, -1, 0),
                new Vector3D(-1, 1, 0),
                new Vector3D(1, 1, 0),
                new Vector3D(1, -1, 0),

                new Vector3D(-1, -1, 1),
                new Vector3D(-1, 1, 1),
                new Vector3D(1, 1, 1),
                new Vector3D(1, -1, 1)
            };
            var verticesLS = new Vector3D[8];

            var mapping = MyMapping.MapDiscard(m_cascadesBoundingsVertices.Buffer);

            for (int c = 0; c < m_initializedShadowCascadesCount; c++)
            {
                var inverseViewProj = MatrixD.Invert(m_cascadeInfo[c].CurrentLocalToProjection);
                Vector3D.Transform(verticesCS, ref inverseViewProj, verticesLS);
                Vector3[] verticesF = new Vector3[8];
                for (int i = 0; i < 8; i++)
                {
                    verticesF[i] = verticesLS[i];
                }

                fixed(Vector3 *V = verticesF)
                {
                    mapping.stream.Write(new IntPtr(V), 0, 8 * sizeof(Vector3));
                }
            }
            mapping.Unmap();

            for (int i = 0; i < m_initializedShadowCascadesCount; i++)
            {
                RC.SetDS(MyDepthStencilState.MarkIfInsideCascade[i], 1 << i);
                // mark ith bit on depth near
                RC.Context.DrawIndexed(36, 0, 8 * i);
            }
            RC.BindDepthRT(null, DepthStencilAccess.DepthReadOnly);

            RC.SetDS(null);
            RC.SetRS(null);
        }
Пример #31
0
        static void FillRandomVectors(MyMapping myMapping)
        {
            float maxTapMag = -1;
            for (uint i = 0; i < NUM_SAMPLES; i++)
            {
                float curr = m_filterKernel[i].Length();
                maxTapMag = (float)System.Math.Max(maxTapMag, curr);
            }


            float maxTapMagInv = 1.0f / maxTapMag;
            float rsum = 0.0f;
            for (uint i = 0; i < NUM_SAMPLES; i++)
            {
                Vector2 tapOffs = new Vector2(m_filterKernel[i].X * maxTapMagInv, m_filterKernel[i].Y * maxTapMagInv);

                m_tmpOccluderPoints[i].X = tapOffs.X;
                m_tmpOccluderPoints[i].Y = tapOffs.Y;
                m_tmpOccluderPoints[i].Z = 0;
                m_tmpOccluderPoints[i].W = (float)System.Math.Sqrt(1 - tapOffs.X * tapOffs.X - tapOffs.Y * tapOffs.Y);

                rsum += m_tmpOccluderPointsFlipped[i].W;

                m_tmpOccluderPointsFlipped[i].X = tapOffs.X;
                m_tmpOccluderPointsFlipped[i].Y = -tapOffs.Y;
            }

            var colorScale = 1.0f / (2 * rsum);
            colorScale *= Params.Data.ColorScale;

            for (int occluderIndex = 0; occluderIndex < NUM_SAMPLES; ++occluderIndex)
                myMapping.WriteAndPosition(ref m_tmpOccluderPoints[occluderIndex]);

            for (int occluderIndex = 0; occluderIndex < NUM_SAMPLES; ++occluderIndex)
                myMapping.WriteAndPosition(ref m_tmpOccluderPointsFlipped[occluderIndex]);
        }