Replace imageAtomicExchange with imageAtomicCompSwap in vertex shader
authorAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 25 Sep 2019 08:15:36 +0000 (10:15 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 17 Oct 2019 09:00:00 +0000 (05:00 -0400)
commitc3075b15db925e6a0503ad6a85cbc401a32f39c5
tree278d93363ec94897a2dacebe0cc4b8c6d7e610e5
parentf7ede20a9805615a3c371b786fa7407708cf612c
Replace imageAtomicExchange with imageAtomicCompSwap in vertex shader

Recently the test was changed in order to replace a imageAtomicAdd for
a imageAtomicExchange, as the test can't assume that the vertex shader
will be executed exactly one per vertex shader (see VK-GL-CTS issue
1910).

But imageAtomicExchange is also problematic because in some
architecture/driver, specially tile-based, the test can't also assume
that all the vertex shader executions would finish before
rasterization starts (so fragment shader execution). So when using
imageAtomicExchange could happend that a vertex shader execution would
override the value that the fragment shader already started to update.

Due this two restrictions, this patch changes the atomic operation on
the vertex shader to imageAtomicCompSwap, that sets the value of the
image at the vertex shader only if it is the initial value (so
zero). That would prevent any possible execution when the
rasterization already started to override the value of such image.

This patch also adds a comment on the code explaining the situation,
to avoid any possible future change to a simpler atomic operation by
mistake.

Components: OpenGL ES

VK-GL-CTS issue: 1997

Affects:
KHR-GLES31.core.shader_image_load_store.advanced-allStages-oneImage

Change-Id: Icbc34662f33839a1ced9f728cee45a1198e4b495
external/openglcts/modules/gles31/es31cShaderImageLoadStoreTests.cpp