You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.
Hi all,
today I was experimenting with a multisampling. I found out that the TextureView object in its Tag property has the wrong width and height. If AutoViewport is set to true, when you set the RenderTarget in the beginning it will create a viewport of size 1,1 (or whatever value is in memory).
The problem lies in the TextureView's Initialization method. On the line: Size = new Size2(Math.Max(1, Texture.Width >> mipLevel), Math.Max(1, Texture.Height >> mipLevel));
On a multisampled texture the "mipLevel" value is not 0 but some random number, thus the resulting TextureView object does not have the correct size. These wrong mipLevel values seem to come directly from the RenderTargetView object in rtv = new TextureView(this, new RenderTargetView(Device, Resource, rtvDescription)); in RenderTarget2D.GetRenderTargetView
after the creation of that DX object, those values are all wrong.
The problem does not seem to occur on a MultiSampleCount of 1,0.
The text was updated successfully, but these errors were encountered:
jwollen
added a commit
to jwollen/SharpDX
that referenced
this issue
Jun 28, 2014
This seems to be due to the resource description not being zeroed, when read back from the API.
I added a fix in pull request #423 as this is relevant there, too.
If you like, check out my branch and see if this resolves the issue.
@ArtiomCiumac@jwollen Yes it does work fine now, thanks! Though I'm wondering whether there's something wrong in the DirectX object since the number assigned to MipLevel looks like uninitialized memory.
It is uninitialized. It's part of a union of structs and the valid data depends on the type of texture, so some memory might remain unused. For texture arrays it contains FirstArraySlice and ArraySize. For textures supporting mipmapping there's also MipLevel, etc. Multisampled textures can't have mipmaps, so they don't have that field.
The code reads the MipLevel as if the texture were 1D, since that field is in the same memory location for other textures as well. Except when it's not there at all, which caused this bug :)
For more information see MSDN.
Hi all,
today I was experimenting with a multisampling. I found out that the TextureView object in its Tag property has the wrong width and height. If AutoViewport is set to true, when you set the RenderTarget in the beginning it will create a viewport of size 1,1 (or whatever value is in memory).
The problem lies in the TextureView's Initialization method. On the line:
Size = new Size2(Math.Max(1, Texture.Width >> mipLevel), Math.Max(1, Texture.Height >> mipLevel));
On a multisampled texture the "mipLevel" value is not 0 but some random number, thus the resulting TextureView object does not have the correct size. These wrong mipLevel values seem to come directly from the RenderTargetView object in
rtv = new TextureView(this, new RenderTargetView(Device, Resource, rtvDescription));
inRenderTarget2D.GetRenderTargetView
after the creation of that DX object, those values are all wrong.
The problem does not seem to occur on a MultiSampleCount of 1,0.
The text was updated successfully, but these errors were encountered: