Ejemplo n.º 1
0
        private uint PushIndexEntries(uint offset)
        {
            const GLDeviceMemoryTypeFlagBits SELECTED_TYPE_INDEX
                = GLDeviceMemoryTypeFlagBits.INDEX
                  | GLDeviceMemoryTypeFlagBits.TRANSFER_DST;

            const MgMemoryPropertyFlagBits ALL_ON =
                MgMemoryPropertyFlagBits.DEVICE_LOCAL_BIT
                | MgMemoryPropertyFlagBits.HOST_VISIBLE_BIT
                | MgMemoryPropertyFlagBits.HOST_COHERENT_BIT
                | MgMemoryPropertyFlagBits.HOST_CACHED_BIT
                | MgMemoryPropertyFlagBits.LAZILY_ALLOCATED_BIT;

            var info_stream = new GLDeviceMemoryTypeInfo
            {
                MemoryTypeIndex = (uint)SELECTED_TYPE_INDEX,
                Index           = offset,
                IsHosted        = false,

                MemoryPropertyFlags
                    = MgMemoryPropertyFlagBits.DEVICE_LOCAL_BIT
                      | MgMemoryPropertyFlagBits.LAZILY_ALLOCATED_BIT,

                Hint = STREAM_DRAW,
            };

            mMemoryTypes[info_stream.Index] = info_stream;

            offset += 1;

            var info_static = new GLDeviceMemoryTypeInfo
            {
                MemoryTypeIndex = (uint)SELECTED_TYPE_INDEX,
                Index           = offset,
                IsHosted        = false,

                MemoryPropertyFlags
                    = MgMemoryPropertyFlagBits.HOST_CACHED_BIT
                      | MgMemoryPropertyFlagBits.LAZILY_ALLOCATED_BIT,

                Hint = STATIC_DRAW,
            };

            mMemoryTypes[info_static.Index] = info_static;

            offset += 1;

            var info_dynamic = new GLDeviceMemoryTypeInfo
            {
                MemoryTypeIndex     = (uint)SELECTED_TYPE_INDEX,
                Index               = offset,
                IsHosted            = false,
                MemoryPropertyFlags = ALL_ON,
                Hint = DYNAMIC_DRAW,
            };

            this.mMemoryTypes[info_dynamic.Index] = info_dynamic;

            return(offset + 1);
        }
Ejemplo n.º 2
0
        private uint PushImageEntries(uint offset)
        {
            const MgMemoryPropertyFlagBits ALL_ON = MgMemoryPropertyFlagBits.DEVICE_LOCAL_BIT
                                                    | MgMemoryPropertyFlagBits.HOST_VISIBLE_BIT
                                                    | MgMemoryPropertyFlagBits.HOST_COHERENT_BIT
                                                    | MgMemoryPropertyFlagBits.HOST_CACHED_BIT
                                                    | MgMemoryPropertyFlagBits.LAZILY_ALLOCATED_BIT;

            var info = new GLDeviceMemoryTypeInfo()
            {
                Index               = offset,
                IsHosted            = true,
                MemoryTypeIndex     = (uint)GLDeviceMemoryTypeFlagBits.IMAGE,
                MemoryPropertyFlags = ALL_ON,
                Hint = 0,
            };

            this.mMemoryTypes[info.Index] = info;

            return(offset + 1);
        }