Render to Texture2DArray slices in DirectX11?(转自GAMEDEV)
2014-03-06 18:19
190 查看
5 down vote favorite | I would like to set a slice of a Texture2DArray as a render target in D3D/DirectX11. It's not clear how to do this. What I'm looking for is the DirectX equivalent of glFramebufferTextureLayer(), which sets a slice of a GL_TEXTURE_2D_ARRAY_EXT as a texture resource of a Framebuffer Object. In D3D11, you set a render target using ID3D11DeviceContext::OMSetRenderTargets, and you can set a Texture2DArray resource view as a render target. However, the only way I see to select which slice of the texture is painted is to use the SV_RenderTargetArrayIndex semantic in an HLSL geometry shader. (The semantic is only available in a geometry shader). My pipline doesn't have a geometry shader, and I don't know at compile time which primitive type I will be rendering - I'm reading models out of input files. It seems like, to add a passthrough geometry shader I would need one shader program for every possible primitive type (terrible). The desired output slice will not change between rendering passes. Is there no way to set a slice of a Texture2DArray as a render target without using a geometry shader? |
2 down vote accepted | You can create separate render target views for every slice and then set it using ID3D11DeviceContext::OMSetRenderTargets.[code]D3D11_RENDER_TARGET_VIEW_DESC desc; desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; desc.Texture2D.MipSlice = D3D11CalcSubresource(0, arraySlice, mipLevels); Information about subresources http://msdn.microsoft.com/en-us/library/ff476901%28v=vs.85%29.aspx
| ||||
|
相关文章推荐
- 【小细节】让sublime2可以在终端中打开
- 在Activity之间如何传递数据,请尽可能说出你所知道的传递数据的方法,并详细描述其实现过程。
- PowerDesigner反向生成Mysql数据原型
- VS2013编译Qt5.2.1 32位静态库debug-and-release版及结果分享
- UVA10887--Trie--哈希
- 国产免费的visio替代品edraw mind map,用来话流程图够用了
- UI组件: 向皮肤注入Callback函数是否有必要?是否有更合理的结构?----取消本文章
- ParentViewController中添加SubViewController(IOS学习)
- std::bind(二)
- bat
- 国产免费的visio替代品edraw mind map,用来话流程图够用了
- 国产免费的visio替代品edraw mind map,用来话流程图够用了
- 国产免费的visio替代品edraw mind map,用来话流程图够用了
- iOS 分类思想(2)
- 【原】HTML5 新增的结构元素——能用并不代表对了
- 各种initcall的执行先后顺序(module_init、postcore_initcall、arch_initcall、subsys_initcall、 fs_initcall)
- cpio文件系统的解压和制作方法
- 累一点没什么
- C#访问URL方法
- Method Swizzling