Also use out of bound detection for image stores

Followup to:
https://swiftshader-review.googlesource.com/c/SwiftShader/+/43950

Fixes dEQP.KHR_GLES31/core_compute_shader_copyimage.
This dEQP test was passing by chance, because load and store
were paired properly together, being equally incorrect with
regards to the OpenGL ES specs, which mentions:

GLES 3.1 spec, section 8.22:
If the individual texel identified for an image load or store
operation doesn’t exist, the access is treated as invalid.
Invalid image loads will return a vector where the value of
R, G, and B components is 0 and the value of the A component
is undefined. Invalid image stores will have no effect.

Bug: b/150464740
Change-Id: I5aa508ed7f08e234387478d3a6faee958ca9dd97
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44868
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/SpirvShaderImage.cpp b/src/Pipeline/SpirvShaderImage.cpp
index 557aa5e..145b8a9 100644
--- a/src/Pipeline/SpirvShaderImage.cpp
+++ b/src/Pipeline/SpirvShaderImage.cpp
@@ -1017,7 +1017,10 @@
 	}
 
 	// SPIR-V 1.4: "If the coordinates are outside the image, the memory location that is accessed is undefined."
-	auto robustness = OutOfBoundsBehavior::UndefinedValue;
+
+	// Emulating the glsl function imageStore() requires that this function is noop when used with out of bounds
+	// coordinates, so we have to use OutOfBoundsBehavior::Nullify in that case.
+	auto robustness = OutOfBoundsBehavior::Nullify;
 
 	auto basePtr = SIMD::Pointer(imageBase, imageSizeInBytes);
 	auto texelPtr = GetTexelAddress(state, basePtr, coordinate, imageType, binding, texelSize, 0, false, robustness);