Render to Texture2DArray slices in DirectX11?(转自GAMEDEV)
来源:互联网 发布:手机淘宝首页尺寸大小 编辑:程序博客网 时间:2024/05/18 02:12
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 theSV_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?
You can create separate render target views for every slice and then set it using ID3D11DeviceContext::OMSetRenderTargets.
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
- Render to Texture2DArray slices in DirectX11?(转自GAMEDEV)
- Vertex Buffer Sharing between DirectX11 and Directx9(转自GAMEDEV)
- (摘自GAMEDEV)Loading a Texture2D Array in DirectX11
- A Practical Guide to Building a Complete Game AI: Volume I (转自Gamedev)
- stl in gamedev
- union[c++] in gamedev
- unit testing in gamedev
- smart pointer in gamedev
- chap8_1 Render to texture in OGRE
- GPU深度发掘(四)::Render to Vertexbuffer in OpenGL
- GPU深度发掘(四)::Render to Vertexbuffer in OpenGL(ZZ)
- How to render "asp:Label" as "label" in HTML markup.
- GPU深度发掘(四)::Render to Vertexbuffer in OpenGL
- How to Render Image Buffer in Android NDK Native Code
- How to Render Image Buffer in Android NDK Native Code
- 如何写一篇好的技术博客 转自:http://www.cocoachina.com/gamedev/misc/2014/0504/8299.html
- DirectX11笔记(十一)--Direct3D渲染7--RENDER STATES
- JSLink to custom list to render people column in detail with picture
- 关于shader language中的matmxn和vecn
- UVA10887--Trie--哈希
- C#访问URL方法
- BZOJ 1208
- 【小细节】让sublime2可以在终端中打开
- Render to Texture2DArray slices in DirectX11?(转自GAMEDEV)
- 【marks】web前端资源
- C语言动态链表 取MP3歌词文件内容 带VC6.0完整工程
- PAT (Advanced) 1041. Be Unique (20)
- 视频软件的频道列表的英文名称
- 说说MD5加密解密这玩意儿
- android4.2源码编译调试出错
- Has the sum exceeded hdu 2116 很不错的数学题目
- Cocos2d设置精灵触摸范围