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. selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

    http://www.seleniumhq.org/download   1. selenium 3.x开始,webdriver/firefox/webdriver.py的__init__中,exec ...

  2. request threaded-only IRQs with IRQF_ONESHOT【转】

    转自:http://blog.csdn.net/bdc995/article/details/8697374 Gitweb:     http://git.kernel.org/linus/;a=co ...

  3. bp神经网络模型推导与c语言实现(转载)

    转载出处:http://www.cnblogs.com/jzhlin/archive/2012/07/28/bp.html BP 神经网络中的 BP 为 Back  Propagation 的简写,最 ...

  4. POI导入导出小案例

    一.HSSF 97-2003 需要jar:poi-3.9.jar 简单示例:生成EXCEL //93---2003 String [] titlie={"id","nam ...

  5. 对象存储 - Swift 原理 及 Swift+keystone+dashboard 架构搭建

    1. 原理介绍 Swift 架构.原理及功能: http://www.cnblogs.com/sammyliu/p/4955241.html 总结的很详细也很全面,受益匪浅,感谢分享. 2. keys ...

  6. Selenium2+python自动化70-unittest之跳过用例(skip)【转载】

    前言 当测试用例写完后,有些模块有改动时候,会影响到部分用例的执行,这个时候我们希望暂时跳过这些用例. 或者前面某个功能运行失败了,后面的几个用例是依赖于这个功能的用例,如果第一步就失败了,后面的用例 ...

  7. 学习apache commons lang3的源代码 (2):RandomStringUtils

    本文,主要是分析类;RandomStringUtils. 下面这个方法的:count:表示要生成的数量(比如4个字符组成的字符串等) start,end,表示限定的范围,比如生成ascii码的随机等. ...

  8. Liquibase 快速开始

    Step 1 :创建Changelog文件,所有的数据库变动都会保存在Changelog文件中 <?xml version="1.0" encoding="UTF- ...

  9. iPhone手机关闭ios10自动更新

    在手机上打开safari,地址栏输入:https://oldcat.me/web/NOOTA9.mobileconfig然后回车按照要求安装此provision文件即可,然后重启.桌面出现一个反馈感叹 ...

  10. python 机器学习框架scikit-learn安装

    1.windows环境whl包下载地址 http://www.lfd.uci.edu/~gohlke/pythonlibs/ 2.安装numpy.scipy.scikit-learn.matplotl ...