{"action":"closed","issue":{"url":"https://api.github.com/repos/baldurk/renderdoc/issues/386","repository_url":"https://api.github.com/repos/baldurk/renderdoc","labels_url":"https://api.github.com/repos/baldurk/renderdoc/issues/386/labels{/name}","comments_url":"https://api.github.com/repos/baldurk/renderdoc/issues/386/comments","events_url":"https://api.github.com/repos/baldurk/renderdoc/issues/386/events","html_url":"https://github.com/baldurk/renderdoc/issues/386","id":181363410,"number":386,"title":"Crash when exporting texture with custom shader","user":{"login":"karyon","id":1891915,"avatar_url":"https://avatars.githubusercontent.com/u/1891915?v=3","gravatar_id":"","url":"https://api.github.com/users/karyon","html_url":"https://github.com/karyon","followers_url":"https://api.github.com/users/karyon/followers","following_url":"https://api.github.com/users/karyon/following{/other_user}","gists_url":"https://api.github.com/users/karyon/gists{/gist_id}","starred_url":"https://api.github.com/users/karyon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karyon/subscriptions","organizations_url":"https://api.github.com/users/karyon/orgs","repos_url":"https://api.github.com/users/karyon/repos","events_url":"https://api.github.com/users/karyon/events{/privacy}","received_events_url":"https://api.github.com/users/karyon/received_events","type":"User","site_admin":false},"labels":[{"id":132872096,"url":"https://api.github.com/repos/baldurk/renderdoc/labels/status:%20to%20be%20verified","name":"status: to be verified","color":"bfe5bf","default":false},{"id":83085853,"url":"https://api.github.com/repos/baldurk/renderdoc/labels/type:%20bug","name":"type: bug","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-06T09:19:35Z","updated_at":"2016-10-28T10:13:43Z","closed_at":"2016-10-28T10:13:43Z","body":"Steps to reproduce:\r\n1. opened a log\r\n2. selected a texture (in the log, it's the \"ISM softrender\" texture, used e.g. in the \"ISM CS\" event section)\r\n3. selected a custom shader (pasted below)\r\n4. deselected all channels except R\r\n5. tried to export as png. when clicking save, it crashes.\r\n\r\nthe texture is a 2048x2048x2 R32UI texture, but is also crashes with a 2048x2048 R16 texture.\r\n\r\nlog: https://owncloud.hpi.de/index.php/s/TyUzlhe2vxT0wyE\r\n\r\nBtw the first time this happened, the error reporter didn't come up, but windows told me that renderdoc stopped working.\r\n\r\n\r\nhere's the custom shader (not cleaned up, sorry)\r\n\r\n```\r\n#version 420 core\r\nuniform uint RENDERDOC_SelectedMip; // selected mip in UI\r\n\r\nuniform uvec4 RENDERDOC_TexDim; // xyz == width, height, depth. w == # mips\r\n\r\nuniform uint RENDERDOC_TextureType; // 1 = 1D, 2 = 2D, 3 = 3D, 4 = Cube, 5 = 1DArray, 6 = 2DArray, 7 = CubeArray, 8 = Rect, 9 = Buffer, 10 = 2DMS\r\n\r\nuniform uint RENDERDOC_SelectedSliceFace;\r\n\r\nlayout (location = 0) in vec2 uv;\r\n\r\n// Textures\r\n// Unsigned int samplers\r\nlayout (binding = 1) uniform usampler1D texUInt1D;\r\nlayout (binding = 2) uniform usampler2D texUInt2D;\r\nlayout (binding = 3) uniform usampler3D texUInt3D;\r\n// cube = 4\r\nlayout (binding = 5) uniform usampler1DArray texUInt1DArray;\r\nlayout (binding = 6) uniform usampler2DArray texUInt2DArray;\r\n// cube array = 7\r\nlayout (binding = 8) uniform usampler2DRect texUInt2DRect;\r\nlayout (binding = 9) uniform usamplerBuffer texUIntBuffer;\r\nlayout (binding = 10) uniform usampler2DMS texUInt2DMS;\r\n\r\n// Int samplers\r\nlayout (binding = 1) uniform isampler1D texSInt1D;\r\nlayout (binding = 2) uniform isampler2D texSInt2D;\r\nlayout (binding = 3) uniform isampler3D texSInt3D;\r\n// cube = 4\r\nlayout (binding = 5) uniform isampler1DArray texSInt1DArray;\r\nlayout (binding = 6) uniform isampler2DArray texSInt2DArray;\r\n// cube array = 7\r\nlayout (binding = 8) uniform isampler2DRect texSInt2DRect;\r\nlayout (binding = 9) uniform isamplerBuffer texSIntBuffer;\r\nlayout (binding = 10) uniform isampler2DMS texSInt2DMS;\r\n\r\n// Floating point samplers\r\nlayout (binding = 1) uniform sampler1D tex1D;\r\nlayout (binding = 2) uniform sampler2D tex2D;\r\nlayout (binding = 3) uniform sampler3D tex3D;\r\nlayout (binding = 4) uniform samplerCube texCube;\r\nlayout (binding = 5) uniform sampler1DArray tex1DArray;\r\nlayout (binding = 6) uniform sampler2DArray tex2DArray;\r\nlayout (binding = 7) uniform samplerCubeArray texCubeArray;\r\nlayout (binding = 8) uniform sampler2DRect tex2DRect;\r\nlayout (binding = 9) uniform samplerBuffer texBuffer;\r\nlayout (binding = 10) uniform sampler2DMS tex2DMS;\r\n\r\nlayout (location = 0) out vec4 color_out;\r\n\r\n\r\n\r\nuint pack4UNToUint(vec4 channel)\r\n{\r\n    return packUnorm4x8(channel);\r\n}\r\n\r\nfloat pack4UNToFloat(vec4 channel)\r\n{\r\n    return uintBitsToFloat(pack4UNToUint(channel));\r\n}\r\n\r\nvec4 unpack4UNFromUint(uint input)\r\n{\r\n    return unpackUnorm4x8(input);\r\n}\r\n\r\nvec4 unpack4UNFromFloat(float input)\r\n{\r\n    return unpack4UNFromUint(floatBitsToUint(input));\r\n}\r\n\r\n// based on http://diaryofagraphicsprogrammer.blogspot.de/2009/10/bitmasks-packing-data-into-fp-render.html\r\nfloat pack3SNToFloat(vec3 channel)\r\n{\r\n vec3 channel2 = channel * 0.5 + 0.5;\r\n uint uValue;\r\n\r\n uValue = (uint(channel2.x * 1023.0 + 0.5));\r\n\r\n uValue |= (uint(channel2.y * 1023.0 + 0.5)) << 10;\r\n\r\n // to prevent an exponent that is 0 we add 1.0\r\n uValue |= (uint(channel2.z * 1021.0 + 1.5)) << 20;\r\n\r\n return uintBitsToFloat(uValue);\r\n}\r\n\r\nvec3 unpack3SNFromFloat(float fFloatFromFP32)\r\n{\r\n float a, b, c;\r\n uint uValue;\r\n\r\n uint uInputFloat = floatBitsToUint(fFloatFromFP32);\r\n\r\n a = float((uInputFloat) & 0x3FFu) / 1023.0;\r\n\r\n b = float((uInputFloat >> 10) & 0x3FFu) / 1023.0;\r\n\r\n c = (float((uInputFloat >> 20) & 0x3FFu) - 1.5) / 1021.0;\r\n\r\n return vec3(a, b, c) * 2.0 - 1.0;\r\n}\r\n\r\nfloat pack2FloatsToFloat(vec2 channel)\r\n{\r\n  return uintBitsToFloat(packHalf2x16(channel));\r\n}\r\n\r\nvec2 unpack2FloatsFromFloat(float fFloatFromFP32)\r\n{\r\n  return unpackHalf2x16(floatBitsToUint(fFloatFromFP32));\r\n}\r\n\r\n\r\nvoid main()\r\n{\r\n    float d = float(texelFetch(texUInt3D, ivec3(gl_FragCoord.xy, 0), int(RENDERDOC_SelectedMip)).r) / 500000.0;\r\n\tcolor_out = vec4(d, 0.0, 0.0, 0.0);\r\n\tcolor_out.r = d;\r\n}\r\n```"}}
{"actor":{"display_login":"baldurk"}}