Detect OpImageWrite in the analysis pass

This refactoring moves detection of OpImageWrite SPIR-V instructions
out of EmitImageWrite(). The latter method will be moved to EmitState,
so static analysis needs to happen in the SpirvShader constructor, which
we were already doing for other bits of analysis.

Bug: b/247020580
Change-Id: I53ef9ac9f9bb78a03634724ab90fa8124d51e95a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/68908
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index 26ec28f..972ec15 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -785,12 +785,15 @@
 
 		case spv::OpStore:
 		case spv::OpAtomicStore:
-		case spv::OpImageWrite:
 		case spv::OpCopyMemory:
 		case spv::OpMemoryBarrier:
 			// Don't need to do anything during analysis pass
 			break;
 
+		case spv::OpImageWrite:
+			analysis.ContainsImageWrite = true;
+			break;
+
 		case spv::OpControlBarrier:
 			analysis.ContainsControlBarriers = true;
 			break;