예제 #1
0
        internal static ResourceFlags GetBindFlagsFromTextureFlags(TextureFlags flags)
        {
            ResourceFlags result = ResourceFlags.None;

            if (flags.HasFlag(TextureFlags.RenderTarget))
            {
                result |= ResourceFlags.AllowRenderTarget;
            }

            if (flags.HasFlag(TextureFlags.UnorderedAccess))
            {
                result |= ResourceFlags.AllowUnorderedAccess;
            }

            if (flags.HasFlag(TextureFlags.DepthStencil))
            {
                result |= ResourceFlags.AllowDepthStencil;

                if (!flags.HasFlag(TextureFlags.ShaderResource))
                {
                    result |= ResourceFlags.DenyShaderResource;
                }
            }

            return(result);
        }
예제 #2
0
        public void SetUsedTexture(
            Instruction inst,
            SamplerType type,
            TextureFormat format,
            TextureFlags flags,
            int cbufSlot,
            int handle)
        {
            inst &= Instruction.Mask;
            bool isImage      = inst == Instruction.ImageLoad || inst == Instruction.ImageStore || inst == Instruction.ImageAtomic;
            bool isWrite      = inst == Instruction.ImageStore || inst == Instruction.ImageAtomic;
            bool accurateType = inst != Instruction.Lod && inst != Instruction.TextureSize;
            bool coherent     = flags.HasFlag(TextureFlags.Coherent);

            if (isImage)
            {
                SetUsedTextureOrImage(_usedImages, cbufSlot, handle, type, format, true, isWrite, false, coherent);
            }
            else
            {
                bool intCoords = flags.HasFlag(TextureFlags.IntCoords) || inst == Instruction.TextureSize;
                SetUsedTextureOrImage(_usedTextures, cbufSlot, handle, type, TextureFormat.Unknown, intCoords, false, accurateType, coherent);
            }

            GpuAccessor.RegisterTexture(handle, cbufSlot);
        }
예제 #3
0
        public void SetUsedTexture(
            Instruction inst,
            SamplerType type,
            TextureFormat format,
            TextureFlags flags,
            int cbufSlot,
            int handle)
        {
            inst &= Instruction.Mask;
            bool isImage      = inst == Instruction.ImageLoad || inst == Instruction.ImageStore;
            bool isWrite      = inst == Instruction.ImageStore;
            bool accurateType = inst != Instruction.TextureSize && inst != Instruction.Lod;

            if (isImage)
            {
                SetUsedTextureOrImage(_usedImages, cbufSlot, handle, type, format, true, isWrite, false);
            }
            else
            {
                SetUsedTextureOrImage(_usedTextures, cbufSlot, handle, type, TextureFormat.Unknown, flags.HasFlag(TextureFlags.IntCoords), false, accurateType);
            }
        }