Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Jun 2009
Offline Last Active Apr 30 2015 05:46 AM

Topics I've Started

Map SRVs of dynamic buffers with NO_OVERWRITE

27 April 2015 - 02:23 PM



according to the documentation it should be possible to map SRVs of dynamic buffers with NO_OVERWRITE in D3D11.1. Does it mean, that it is possible to map contents of the texture with NO_OVERWRITE? But when I try to map 3d texture resource, it returns error E_INVALIDARG, and this debug information:


D3D11 ERROR: ID3D11DeviceContext::Map: Map cannot be called with MAP_WRITE_NO_OVERWRITE access, because it can only be used by D3D11_USAGE_DYNAMIC Resources which were created with GPU Input BindFlags that were restricted to only D3D11_BIND_VERTEX_BUFFER and D3D11_BIND_INDEX_BUFFER.  Buffer resources created with bind flag D3D11_BIND_CONSTANT_BUFFER or D3D11_BIND_SHADER_RESOURCE also support MAP_WRITE_NO_OVERWRITE access when supported by the driver (when CheckFeatureSupport with D3D11_FEATURE_D3D11_OPTIONS returns D3D11_FEATURE_DATA_D3D11_OPTIONS.MapNoOverwriteOnDynamicConstantBuffer = TRUE or D3D11_FEATURE_DATA_D3D11_OPTIONS.MapNoOverwriteOnDynamicBufferSRV = TRUE, as appropriate). [ RESOURCE_MANIPULATION ERROR #2097210: RESOURCE_MAP_INVALIDMAPTYPE]

I was checking these flags (D3D11_FEATURE_DATA_D3D11_OPTIONS.MapNoOverwriteOnDynamicConstantBuffer and D3D11_FEATURE_DATA_D3D11_OPTIONS.MapNoOverwriteOnDynamicBufferSRV) and both returns true. Also, map doesnt accept ID3D11ShaderResourceView parameter.


Does anyone know how to map it?


Thanks, Michal.

SRGB with FBO problem

08 February 2013 - 08:42 AM



I was trying to write linear color values to FBO with glEnable(GL_FRAMEBUFFER_SRGB) enabled, but conversion from linear -> SRGB space seems not working.

My test program was doing something like this:


1. Load some test texture with GL_SRGB8 format

2. Initialize FBO with texture with GL_SRGB8_ALPHA8 format

3. Bind that FBO


5. render test texture to FBO

  -> now FBO should contain very the same color values as input test texture (conversion SRGB -> linear of test texture during sampling, and then conversion linear -> SRGB during write to FBO).


7. Unbind FBO and render FBO texture to back buffer.


I was expecting, that output color will be the same as input texture, but result is darker, that means, that conversion is not working. Strange is, that rendering that test GL_SRGB8 texture directly to the back buffer (no FBO) when GL_FRAMEBUFFER_SRGB was enabled is working (output is very the same as input texture).


I was trying to initialize FBO just as GL_RGBA8 format, but results were still dark.


So, I want to ask, shoud SRGB conversion work even for FBO buffers? (as I was reading the spec of that extension, it should work). Or is it just some driver bug? (I'm using AMD card), or did I overlook something?



depth stencil framebuffer problem

15 April 2010 - 08:57 PM

Hello, I have setup FBO depth stencil texture, and everything works fine, but problem is, when I try to bind that depth texture, and later bind that FBO again, then contents of stencil buffer is damaged (it looks, that it is rewriten by some depth values). My code looks somehow like this: Generation of FBO: glGenFramebuffersEXT(1, &m_gl_framebuffer); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_gl_framebuffer); glGenTextures(1,&depthTextureID); glBindTexture(GL_TEXTURE_2D,depthTextureID); glTexImage2D (GL_TEXTURE_2D,0,GL_DEPTH24_STENCIL8_EXT,800,600,0,GL_DEPTH_STENCIL_EXT,GL_UNSIGNED_INT_24_8_EXT, NULL); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depthTextureID, 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_TEXTURE_2D, depthTextureID, 0); test for rewrite: glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_gl_framebuffer); glClearDepth(0.500000); glClearStencil(1); glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,0); //Binding of texture - if commented, then stencil is ok! glActiveTextureARB(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D,depthTextureID); glActiveTextureARB(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D,0); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,m_gl_framebuffer); //<--- here stencil buffer is damaged! glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,0); If I dont bind that texture, then everything is OK :( Did anyone encounter this problem too? Thanks for help.

Reading bound depth stencil resource

31 March 2010 - 06:46 PM

Hello, I needed to use depth stencil resource in the shader, but at the same time I need to bound this resource as the render target. But because this is impossible to do in DX10, I had to overcome this problem somehow. First solution is to use DX9 approach - this means create another resource, and during depth fill bind that resource and store depth info into it. This has the disadvantage, that resource must be cleared with the regular depth stencil buffer. So, next I was trying to create another resource again, but when finishing depth rendering, use CopyResource to copy this depth-stencil buffer into it. So now instead of clearing the buffer there is a copy. I did some tests and it seems, that for depth buffer without stencil this copy is faster. BUT, for depth buffer with stencil I cannot find any suitable format for destination, for which this CopyResource would be possible to do. Could anyone help? Is this copy even possible? In DX10 help is mentioned, that depth-stencil resources cannot be used as a destination. But I'm using it as source, so this should be OK. Thanks.

FBO Configuration

21 December 2009 - 12:54 AM

Hello, I was trying to setup FBO configuration that would draw color normaly to the back buffer, and depth values to the texture, but didn't find out how. Is such configuration even possible? I needed it for following rendering: 1. Do scene draw with Z-pass only (this would fill that depth texture) 2. Do some calculations using that depth texture (some kind of shadow mapping) 3. Render scene to the back buffer and use that depth texture for depth tests. This configuration is possible to do in DX9, but I failed to set it up on OGL. Can anybody help? Thanks.