https://msdn.microsoft.com/en-us/library/windows/desktop/dn508285(v=vs.85).aspx

Map with D3D11_MAP_WRITE_DISCARD, the runtime returns a pointer to a new region of memory instead of the old buffer data.

This allows the GPU to continue using the old data while the app places data in the new buffer.

No additional memory management is required in the app; the old buffer is reused or destroyed automatically when the GPU is finished with it.

好神奇

Note  When you map a buffer with D3D11_MAP_WRITE_DISCARD, the runtime always discards the entire buffer.

You can't preserve info in unmapped areas of the buffer by specifying a nonzero offset or limited size field.

When you call Map on a static vertex buffer while the GPU is using the buffer, you get a significant performance penalty. In this situation,

Map must wait until the GPU is finished reading vertex or index data from the buffer before Map can return to the calling app, which causes a significant delay.

Calling Map and then rendering from a static buffer several times per frame also prevents the GPU from buffering rendering commands

because it must finish commands before returning the map pointer.

Without buffered commands, the GPU remains idle until after the app is finished filling the vertex buffer or index buffer and issues a rendering command.

D3D11_USAGE_IMMUTABLE is well-suited to data such as textures because such data is typically read into memory from some file format.

Therefore, when you create a texture with D3D11_USAGE_IMMUTABLE, the GPU directly reads that texture into memory.

=============

shit原先那个页面被更新了。。。

https://docs.microsoft.com/zh-cn/windows/desktop/api/d3d11/ne-d3d11-d3d11_usage

https://docs.microsoft.com/en-us/windows/desktop/api/d3d11/ne-d3d11-d3d11_map

====================

兜兜转转 又回来继续弄这个

先捋一下dx11

map是为了可以拿到这块memory的地址 来操作里面的内容

如果memory类型用static 就需要gpu等cpu用完再用 hang在那里 很慢 所以memory类型要选dynamic

这样显卡会自己处理这些事情不会hang在那里等gpu用完再用 处理的方式取决于map type

D3D11_MAP_WRITE_DISCARD --如果是write discard,这时 如果gpu在用cpu就直接开一块新的往里写,所以里面的内容是未定义的。旧内容discard了

D3D11_USAGE_DEFAULT         GPU读写--默认的GPU资源

D3D11_USAGE_IMMUTABLE GPU读   CPU不能操作---不变

D3D11_USAGE_DYNAMIC         CPU写 GPU读  map出来

D3D11_USAGE_STAGING         GPUcopy to CPU --save GPU和CPU读写

================================

https://docs.microsoft.com/en-us/windows/desktop/direct3d12/memory-management-strategies

下面写dx12了

有三种

committed

placed

reserved

如果cpu要写资源 不会像dx11 的write discard那样driver管理资源,就等于只有NO_OVERWRITE flag需要自己管理资源

保证GPU要用的资源没有被cpu写坏 比如加fence 用uploading resorces

就是每份gpu要用的数据cpu copy一份出来操作 等于手动 write discard

我现在用的fence就让他hang在那里了,dynamic的map unmap肯定不能这样,这样太慢了 但应该是可以用的

https://docs.microsoft.com/en-us/windows/desktop/direct3d12/uploading-resources

dx12 memory management的更多相关文章

  1. Memory Management in Open Cascade

    Open Cascade中的内存管理 Memory Management in Open Cascade eryar@163.com 一.C++中的内存管理 Memory Management in ...

  2. Java (JVM) Memory Model – Memory Management in Java

    原文地址:http://www.journaldev.com/2856/java-jvm-memory-model-memory-management-in-java Understanding JV ...

  3. Objective-C Memory Management

    Objective-C Memory Management Using Reference Counting 每一个从NSObject派生的对象都继承了对应的内存管理的行为.这些类的内部存在一个称为r ...

  4. Operating System Memory Management、Page Fault Exception、Cache Replacement Strategy Learning、LRU Algorithm

    目录 . 引言 . 页表 . 结构化内存管理 . 物理内存的管理 . SLAB分配器 . 处理器高速缓存和TLB控制 . 内存管理的概念 . 内存覆盖与内存交换 . 内存连续分配管理方式 . 内存非连 ...

  5. Android内存管理(2)HUNTING YOUR LEAKS: MEMORY MANAGEMENT IN ANDROID PART 2

    from: http://www.raizlabs.com/dev/2014/04/hunting-your-leaks-memory-management-in-android-part-2-of- ...

  6. Android内存管理(1)WRANGLING DALVIK: MEMORY MANAGEMENT IN ANDROID PART 1

    from : http://www.raizlabs.com/dev/2014/03/wrangling-dalvik-memory-management-in-android-part-1-of-2 ...

  7. Understanding Memory Management(2)

    Understanding Memory Management Memory management is the process of allocating new objects and remov ...

  8. Java Memory Management(1)

    Java Memory Management, with its built-in garbage collection, is one of the language’s finest achiev ...

  9. ural1037 Memory Management

    Memory Management Time limit: 2.0 secondMemory limit: 64 MB Background Don't you know that at school ...

随机推荐

  1. Linux内核官方文档atomic_ops.txt【摘自Linux 内核文档】

    摘自Linux内核文档 Documentation/atomic_ops.txt,不是本人原创 Semantics and Behavior of Atomic and Bitmask Operati ...

  2. [ Python -1 ] 简易购物车程序

    练习: 1. 要求用户输入总资产,例如:2000 2. 显示商品列表,让用户根据序号选择商品,加入购物车 3. 购买,如果商品总额大于总资产,提示账户余额不足,否则,购买成功. goods = [{' ...

  3. 使用bottle进行web开发(6):Response 对象

    Response的元数据(比如http的status code,headers,cookies等,都被i封装到一个叫Response的对象中,并传给浏览器. status code:status co ...

  4. gcc 学习

    gcc -lrt 参数说明:  说明在连接生成可执行文件的时候,将连接库librt.so or librt.a -l 参数说明 连接库 编译 使用 clock_gettime函数的,gcc需要添加上 ...

  5. 【转】C#获取当前程序运行路径的方法集合

    //获取当前进程的完整路径,包含文件名(进程名).string str = this.GetType().Assembly.Location;result: X:\xxx\xxx\xxx.exe (. ...

  6. AC日记——Keywords Search hdu 2222

    2222 思路: ac自动机模板题: 代码: #include <cstdio> #include <cstring> #include <iostream> #i ...

  7. 使用 gulp 压缩 CSS

    请务必理解如下章节后阅读此章节: 安装 Node 和 gulp 使用 gulp 压缩 JS 压缩 css 代码可降低 css 文件大小,提高页面打开速度. 我们接着将规律转换为 gulp 代码 规律 ...

  8. (九)MySQL用户和权限管理

    (1)用户管理 1)登录和退出mysql 例: mysql -h192.168.111.150 -P3306 -uroot -predhat mysql -e 'select user,host,au ...

  9. (十)while和until循环

    (1)while循环 语法:当条件测试成立(真),执行循环体 while 条件测试 do 循环体 done 1)while批量创建用户1 从user.txt读取到的行数据赋予给变量user值 #!/b ...

  10. mvc路由问题

    概述 使用MVC Routing可以不必将URL映射到网站中特定文件.通过添加Routing规则,使URL能够安装指定的规则发送HTTP请求,这种方式能够简洁.方便.有效.快速的实现对指定页面的访问或 ...