Ejemplo n.º 1
0
        protected override void SetRenderTargetsImpl(DescriptorHeap descriptorHeapColor, uint[] slotsColor, DescriptorHeap descriptorHeapDepthStencil, uint slotDepthStencil)
        {
            bool continuous = true;

            for (int i = 1; i < slotsColor.Length; ++i)
            {
                if (slotsColor[i] != slotsColor[i - 1] + 1)
                {
                    continuous = false;
                    break;
                }
            }

            CpuDescriptorHandle?depthStencilCpuDescriptorHandle = ((DescriptorHeapDX)descriptorHeapDepthStencil)?.GetCPUHandle(slotDepthStencil);

            if (continuous)
            {
                CommandListD3D12.SetRenderTargets(slotsColor.Length, ((DescriptorHeapDX)descriptorHeapColor).GetCPUHandle(slotsColor[0]), true, depthStencilCpuDescriptorHandle);
            }
            else
            {
                throw new NotImplementedException("Setting color render targets with non-continuous descriptor slots are not yet supported.");
                //CommandListD3D12.SetRenderTargets(slotsColor.Length, ((Binding.DescriptorHeap)descriptorHeapColor).GetCPUHandle(slotsColor[0]), false, depthStencilCpuDescriptorHandle);
            }
        }
Ejemplo n.º 2
0
        protected override void CreateRenderTargetViewImpl(DescriptorHeap target, uint descriptorHeapSlot, Resource resource, ref RenderTargetViewDescription description)
        {
            var renderTargetViewDescription = new SharpDX.Direct3D12.RenderTargetViewDescription
            {
                Format    = Memory.Enums.ToDXGIFormat[(int)description.Format],
                Dimension = Memory.Enums.ToRTVDimension[(int)description.Dimension]
            };

            switch (description.Dimension)
            {
            case Dimension.Buffer:
                renderTargetViewDescription.Buffer.ElementCount = (int)description.Buffer.ElementCount;
                renderTargetViewDescription.Buffer.FirstElement = (int)description.Buffer.FirstElement;
                break;

            case Dimension.Texture1D:
                renderTargetViewDescription.Texture1D.MipSlice = (int)description.Texture.MipSlice;
                break;

            case Dimension.Texture1DArray:
                renderTargetViewDescription.Texture1DArray.MipSlice        = (int)description.Texture.MipSlice;
                renderTargetViewDescription.Texture1DArray.FirstArraySlice = (int)description.Texture.FirstSlice;
                renderTargetViewDescription.Texture1DArray.ArraySize       = (int)description.Texture.SliceCount;
                break;

            case Dimension.Texture2D:
                renderTargetViewDescription.Texture2D.MipSlice   = (int)description.Texture.MipSlice;
                renderTargetViewDescription.Texture2D.PlaneSlice = 0;     // Not yet supported.
                break;

            case Dimension.Texture2DArray:
                renderTargetViewDescription.Texture2DArray.MipSlice        = (int)description.Texture.MipSlice;
                renderTargetViewDescription.Texture2DArray.FirstArraySlice = (int)description.Texture.FirstSlice;
                renderTargetViewDescription.Texture2DArray.ArraySize       = (int)description.Texture.SliceCount;
                renderTargetViewDescription.Texture2DArray.PlaneSlice      = 0; // Not yet supported.
                break;

            case Dimension.Texture2DMs:
                // nothing
                break;

            case Dimension.Texture2DMsArray:
                renderTargetViewDescription.Texture2DMSArray.FirstArraySlice = (int)description.Texture.FirstSlice;
                renderTargetViewDescription.Texture2DMSArray.ArraySize       = (int)description.Texture.SliceCount;
                break;

            case Dimension.Texture3D:
                renderTargetViewDescription.Texture3D.MipSlice        = (int)description.Texture.MipSlice;
                renderTargetViewDescription.Texture3D.FirstDepthSlice = (int)description.Texture.FirstSlice;
                renderTargetViewDescription.Texture3D.DepthSliceCount = (int)description.Texture.SliceCount;
                break;

            default:
                throw new NotImplementedException("Given render target memory dimension not yet supported!");
            }

            DeviceD3D12.CreateRenderTargetView(((Memory.Resource)resource).ResourceD3D12, renderTargetViewDescription, ((Binding.DescriptorHeap)target).GetCPUHandle(descriptorHeapSlot));
        }
Ejemplo n.º 3
0
 protected override void CopyDescriptorsImpl(DescriptorHeap source, DescriptorHeap destination, Tuple <uint>[] rangeStarts, uint numDescriptors)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 4
0
        protected override void CreateRenderTargetViewImpl(DescriptorHeap target, uint descriptorHeapSlot, Resource resource, ref RenderTargetViewDescription description)
        {
            var renderTargetViewDescription = new SharpDX.Direct3D12.RenderTargetViewDescription
            {
                Format = Memory.Enums.ToDXGIFormat[(int) description.Format],
                Dimension = Memory.Enums.ToRTVDimension[(int)description.Dimension]
            };
            switch (description.Dimension)
            {
                case Dimension.Buffer:
                    renderTargetViewDescription.Buffer.ElementCount = (int) description.Buffer.ElementCount;
                    renderTargetViewDescription.Buffer.FirstElement = (int) description.Buffer.FirstElement;
                    break;
                case Dimension.Texture1D:
                    renderTargetViewDescription.Texture1D.MipSlice = (int) description.Texture.MipSlice;
                    break;
                case Dimension.Texture1DArray:
                    renderTargetViewDescription.Texture1DArray.MipSlice = (int)description.Texture.MipSlice;
                    renderTargetViewDescription.Texture1DArray.FirstArraySlice = (int) description.Texture.FirstSlice;
                    renderTargetViewDescription.Texture1DArray.ArraySize = (int) description.Texture.SliceCount;
                    break;
                case Dimension.Texture2D:
                    renderTargetViewDescription.Texture2D.MipSlice = (int)description.Texture.MipSlice;
                    renderTargetViewDescription.Texture2D.PlaneSlice = 0; // Not yet supported.
                    break;
                case Dimension.Texture2DArray:
                    renderTargetViewDescription.Texture2DArray.MipSlice = (int)description.Texture.MipSlice;
                    renderTargetViewDescription.Texture2DArray.FirstArraySlice = (int)description.Texture.FirstSlice;
                    renderTargetViewDescription.Texture2DArray.ArraySize = (int)description.Texture.SliceCount;
                    renderTargetViewDescription.Texture2DArray.PlaneSlice = 0; // Not yet supported.
                    break;
                case Dimension.Texture2DMs:
                    // nothing
                    break;
                case Dimension.Texture2DMsArray:
                    renderTargetViewDescription.Texture2DMSArray.FirstArraySlice = (int)description.Texture.FirstSlice;
                    renderTargetViewDescription.Texture2DMSArray.ArraySize = (int)description.Texture.SliceCount;
                    break;
                case Dimension.Texture3D:
                    renderTargetViewDescription.Texture3D.MipSlice = (int)description.Texture.MipSlice;
                    renderTargetViewDescription.Texture3D.FirstDepthSlice = (int)description.Texture.FirstSlice;
                    renderTargetViewDescription.Texture3D.DepthSliceCount = (int)description.Texture.SliceCount;
                    break;
                default:
                    throw new NotImplementedException("Given render target memory dimension not yet supported!");
            }

            DeviceD3D12.CreateRenderTargetView(((Memory.Resource)resource).ResourceD3D12, renderTargetViewDescription, ((Binding.DescriptorHeap)target).GetCPUHandle(descriptorHeapSlot));
        }
Ejemplo n.º 5
0
 protected override void CopyDescriptorsImpl(DescriptorHeap source, DescriptorHeap destination, Tuple<uint>[] rangeStarts, uint numDescriptors)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 internal int GetDescriptorHandleIncrementSize(DescriptorHeap.Descriptor.ResourceDescriptorType type)
 {
     return descriptorHandleIncrementSize[(int)type];
 }
Ejemplo n.º 7
0
 public override DescriptorHeap Create(ref DescriptorHeap.Descriptor desc, string label = "<unnamed descriptorHeap>")
 {
     return new Binding.DescriptorHeap(ref desc, this, label);
 }
Ejemplo n.º 8
0
        protected override void SetRenderTargetsImpl(DescriptorHeap descriptorHeapColor, uint[] slotsColor, DescriptorHeap descriptorHeapDepthStencil, uint slotDepthStencil)
        {
            bool continuous = true;
            for (int i = 1; i < slotsColor.Length; ++i)
            {
                if (slotsColor[i] != slotsColor[i - 1] + 1)
                {
                    continuous = false;
                    break;
                }
            }

            CpuDescriptorHandle? depthStencilCpuDescriptorHandle = ((DescriptorHeapDX)descriptorHeapDepthStencil)?.GetCPUHandle(slotDepthStencil);

            if (continuous)
            {
                CommandListD3D12.SetRenderTargets(slotsColor.Length, ((DescriptorHeapDX)descriptorHeapColor).GetCPUHandle(slotsColor[0]), true, depthStencilCpuDescriptorHandle);
            }
            else
            {
                throw new NotImplementedException("Setting color render targets with non-continuous descriptor slots are not yet supported.");
                //CommandListD3D12.SetRenderTargets(slotsColor.Length, ((Binding.DescriptorHeap)descriptorHeapColor).GetCPUHandle(slotsColor[0]), false, depthStencilCpuDescriptorHandle);
            }
        }