mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-24 15:36:33 +00:00
Make sure reported texture sample count is always at least 1. Refs #387
* Particularly, GL texture buffers were incorrectly setting it to 0 which was invalid and caused a crash later.
This commit is contained in:
@@ -172,7 +172,7 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id)
|
||||
tex.arraysize = desc.ArraySize;
|
||||
|
||||
tex.msQual = desc.SampleDesc.Quality;
|
||||
tex.msSamp = desc.SampleDesc.Count;
|
||||
tex.msSamp = RDCMAX(1U, desc.SampleDesc.Count);
|
||||
|
||||
tex.resType = tex.arraysize > 1 ? eResType_Texture2DArray : eResType_Texture2D;
|
||||
if(tex.cubemap)
|
||||
@@ -1672,7 +1672,7 @@ ResourceId D3D11Replay::CreateProxyTexture(const FetchTexture &templateTex)
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.Width = templateTex.width;
|
||||
desc.Height = templateTex.height;
|
||||
desc.SampleDesc.Count = templateTex.msSamp;
|
||||
desc.SampleDesc.Count = RDCMAX(1U, templateTex.msSamp);
|
||||
desc.SampleDesc.Quality = templateTex.msQual;
|
||||
|
||||
if(templateTex.creationFlags & eTextureCreate_DSV || IsDepthFormat(desc.Format))
|
||||
|
||||
@@ -154,7 +154,7 @@ FetchTexture D3D12Replay::GetTexture(ResourceId id)
|
||||
ret.numSubresources = GetNumSubresources(&desc);
|
||||
ret.mips = desc.MipLevels;
|
||||
ret.msQual = desc.SampleDesc.Quality;
|
||||
ret.msSamp = desc.SampleDesc.Count;
|
||||
ret.msSamp = RDCMAX(1U, desc.SampleDesc.Count);
|
||||
ret.byteSize = 0;
|
||||
for(uint32_t i = 0; i < ret.mips; i++)
|
||||
ret.byteSize += GetByteSize(ret.width, ret.height, ret.depth, desc.Format, i);
|
||||
|
||||
@@ -481,7 +481,7 @@ void GLReplay::CacheTexture(ResourceId id)
|
||||
tex.numSubresources = 1;
|
||||
tex.creationFlags = eTextureCreate_RTV;
|
||||
tex.msQual = 0;
|
||||
tex.msSamp = res.samples;
|
||||
tex.msSamp = RDCMAX(1, res.samples);
|
||||
|
||||
tex.format = MakeResourceFormat(gl, eGL_TEXTURE_2D, res.internalFormat);
|
||||
|
||||
@@ -606,7 +606,7 @@ void GLReplay::CacheTexture(ResourceId id)
|
||||
tex.depth = 1;
|
||||
tex.arraysize = (target == eGL_TEXTURE_CUBE_MAP ? 6 : 1);
|
||||
tex.cubemap = (target == eGL_TEXTURE_CUBE_MAP);
|
||||
tex.msSamp = (target == eGL_TEXTURE_2D_MULTISAMPLE ? samples : 1);
|
||||
tex.msSamp = RDCMAX(1, target == eGL_TEXTURE_2D_MULTISAMPLE ? samples : 1);
|
||||
break;
|
||||
case eGL_TEXTURE_2D_ARRAY:
|
||||
case eGL_TEXTURE_2D_MULTISAMPLE_ARRAY:
|
||||
@@ -617,7 +617,7 @@ void GLReplay::CacheTexture(ResourceId id)
|
||||
tex.depth = 1;
|
||||
tex.arraysize = depth;
|
||||
tex.cubemap = (target == eGL_TEXTURE_CUBE_MAP_ARRAY);
|
||||
tex.msSamp = (target == eGL_TEXTURE_2D_MULTISAMPLE_ARRAY ? samples : 1);
|
||||
tex.msSamp = RDCMAX(1, target == eGL_TEXTURE_2D_MULTISAMPLE_ARRAY ? samples : 1);
|
||||
break;
|
||||
case eGL_TEXTURE_3D:
|
||||
tex.dimension = 3;
|
||||
@@ -691,7 +691,8 @@ void GLReplay::CacheTexture(ResourceId id)
|
||||
tex.arraysize = 1;
|
||||
tex.numSubresources = 1;
|
||||
tex.creationFlags = eTextureCreate_SRV;
|
||||
tex.msQual = tex.msSamp = 0;
|
||||
tex.msQual = 0;
|
||||
tex.msSamp = 1;
|
||||
tex.byteSize = 0;
|
||||
|
||||
gl.glGetTextureLevelParameterivEXT(res.resource.name, levelQueryType, 0,
|
||||
|
||||
@@ -809,7 +809,7 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id)
|
||||
ret.byteSize *= ret.arraysize;
|
||||
|
||||
ret.msQual = 0;
|
||||
ret.msSamp = iminfo.samples;
|
||||
ret.msSamp = RDCMAX(1U, (uint32_t)iminfo.samples);
|
||||
|
||||
ret.format = MakeResourceFormat(iminfo.format);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user