Bug 92860

Summary: [radeonsi][bisected] st/mesa: implement ARB_copy_image - Corruption in ARK Survival Evolved
Product: Mesa Reporter: Shawn Starr <shawn.starr>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Corruption seen in game (Screenshot #1)
Corruption seen in game (Screenshot #1)

Description Shawn Starr 2015-11-08 04:26:42 UTC
Created attachment 119470 [details]
Corruption seen in game (Screenshot #1)

I noticed certain textures were corrupted in color or for water, corrupted in reflection from light.

Reverting this extension resolves corruption, the Game is OpenGL 3.3 and it seems this extension broke for OpenGL 3.3 backwards compat?

Attached is a screenshot of the corruption seen
Comment 1 Shawn Starr 2015-11-08 04:27:48 UTC
Created attachment 119471 [details]
Corruption seen in game (Screenshot #1)
Comment 2 Shawn Starr 2015-11-08 07:05:14 UTC
From a corrupted apitrace it spits out this:

521960: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
521960: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
521961: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
521961: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
521998: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
521998: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
521999: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
521999: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957720: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957720: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957721: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957721: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957750: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957750: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957751: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957751: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957780: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957780: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957781: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957781: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957810: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957810: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957811: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957811: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957840: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957840: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957841: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957841: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957870: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957870: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957871: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957871: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957900: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957900: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957901: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957901: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957930: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957930: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957931: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957931: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957960: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957960: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957961: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957961: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957990: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)
957990: warning: glGetError(glCopyImageSubData) = GL_INVALID_VALUE
957991: message: major api error 2: GL_INVALID_VALUE in glCopyImageSubData(unaligned src rectangle)

The APItrace can be found here: https://drive.google.com/open?id=0Bze7CJKD12nObEZmVkxlclZwbjA

Video of game rendering frames OK with ARB_copy_image reverted: https://www.youtube.com/watch?v=_sNCykCtcns

Video of game rendering frames BAD with ARB_copy_image implemented: https://www.youtube.com/watch?v=GNMR6NoiCBg
Comment 3 Ilia Mirkin 2015-11-08 09:09:59 UTC
The problem is that it creates a mip-mapped compressed texture (DXT1) and copies in each level. However DXT1 has a block size of 4x4, so mesa refuses to copy in the last 2 levels. I need to go back and look at the spec, but I believe that's bogus behaviour... we should be allowing this.

521945 glBindTexture(target = GL_TEXTURE_2D, texture = 2714)
521946 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_S, param = GL_REPEAT)
521947 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_T, param = GL_REPEAT)
521948 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_R, param = GL_REPEAT)
521949 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAG_FILTER, param = GL_NEAREST)
521950 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MIN_FILTER, param = GL_NEAREST)
521951 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAX_ANISOTROPY_EXT, param = 1)
521952 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_BASE_LEVEL, param = 0)
521953 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAX_LEVEL, param = 11)
521954 glTexStorage2D(target = GL_TEXTURE_2D, levels = 12, internalformat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, width = 2048, height = 2048)
521955 glCopyImageSubData(srcName = 2672, srcTarget = GL_TEXTURE_2D, srcLevel = 0, srcX = 0, srcY = 0, srcZ = 0, dstName = 2714, dstTarget = GL_TEXT
URE_2D, dstLevel = 5, dstX = 0, dstY = 0, dstZ = 0, srcWidth = 64, srcHeight = 64, srcDepth = 1)
521956 glCopyImageSubData(srcName = 2672, srcTarget = GL_TEXTURE_2D, srcLevel = 1, srcX = 0, srcY = 0, srcZ = 0, dstName = 2714, dstTarget = GL_TEXT
URE_2D, dstLevel = 6, dstX = 0, dstY = 0, dstZ = 0, srcWidth = 32, srcHeight = 32, srcDepth = 1)
521957 glCopyImageSubData(srcName = 2672, srcTarget = GL_TEXTURE_2D, srcLevel = 2, srcX = 0, srcY = 0, srcZ = 0, dstName = 2714, dstTarget = GL_TEXT
URE_2D, dstLevel = 7, dstX = 0, dstY = 0, dstZ = 0, srcWidth = 16, srcHeight = 16, srcDepth = 1)
521958 glCopyImageSubData(srcName = 2672, srcTarget = GL_TEXTURE_2D, srcLevel = 3, srcX = 0, srcY = 0, srcZ = 0, dstName = 2714, dstTarget = GL_TEXT
URE_2D, dstLevel = 8, dstX = 0, dstY = 0, dstZ = 0, srcWidth = 8, srcHeight = 8, srcDepth = 1)
521959 glCopyImageSubData(srcName = 2672, srcTarget = GL_TEXTURE_2D, srcLevel = 4, srcX = 0, srcY = 0, srcZ = 0, dstName = 2714, dstTarget = GL_TEXT
URE_2D, dstLevel = 9, dstX = 0, dstY = 0, dstZ = 0, srcWidth = 4, srcHeight = 4, srcDepth = 1)
521960 glCopyImageSubData(srcName = 2672, srcTarget = GL_TEXTURE_2D, srcLevel = 5, srcX = 0, srcY = 0, srcZ = 0, dstName = 2714, dstTarget = GL_TEXTURE_2D, dstLevel = 10, dstX = 0, dstY = 0, dstZ = 0, srcWidth = 2, srcHeight = 2, srcDepth = 1)
521961 glCopyImageSubData(srcName = 2672, srcTarget = GL_TEXTURE_2D, srcLevel = 6, srcX = 0, srcY = 0, srcZ = 0, dstName = 2714, dstTarget = GL_TEXTURE_2D, dstLevel = 11, dstX = 0, dstY = 0, dstZ = 0, srcWidth = 1, srcHeight = 1, srcDepth = 1)
Comment 4 Shawn Starr 2015-11-08 09:55:19 UTC
Confirmed:

[Mesa-dev] [PATCH] mesa/copyimage: allow width/height to not be multiples of block

Fixed issue in apitrace/in game.
Comment 5 Shawn Starr 2015-11-08 10:56:06 UTC
I should also note, this has *significantly* boosted FPS and reduced stalls in game. This has fixed a bottleneck somewhere
Comment 6 Ilia Mirkin 2015-11-11 19:47:51 UTC
Fix pushed.

commit 912babba7bf1abd3caa49f6372d581ae1afe7e84
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Sun Nov 8 04:46:38 2015 -0500

    mesa/copyimage: allow width/height to not be multiples of block

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.