OpCopy* fixes

This CL fixes 2 issues with OpCopy* operations:
1) descriptorDecorations should propagate when making a copy
2) pointers can be copied

Bug: b/236957718
Change-Id: Id99a94f45416df94ad74803313f1e6176ee3b9f7
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/67808
Commit-Queue: Alexis Hétu <sugoi@google.com>
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/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index 9a628dd..28516ed 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -572,6 +572,8 @@
 		case spv::OpPtrAccessChain:
 		case spv::OpSampledImage:
 		case spv::OpImage:
+		case spv::OpCopyObject:
+		case spv::OpCopyLogical:
 			{
 				// Propagate the descriptor decorations to the result.
 				Object::ID resultId = insn.word(2);
@@ -765,8 +767,6 @@
 		case spv::OpGroupNonUniformLogicalAnd:
 		case spv::OpGroupNonUniformLogicalOr:
 		case spv::OpGroupNonUniformLogicalXor:
-		case spv::OpCopyObject:
-		case spv::OpCopyLogical:
 		case spv::OpArrayLength:
 		case spv::OpIsHelperInvocationEXT:
 			// Instructions that yield an intermediate value or divergent pointer
@@ -2642,12 +2642,19 @@
 
 SpirvShader::EmitResult SpirvShader::EmitCopyObject(InsnIterator insn, EmitState *state) const
 {
-	auto type = getType(insn.resultTypeId());
-	auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
 	auto src = Operand(this, state, insn.word(3));
-	for(uint32_t i = 0; i < type.componentCount; i++)
+	if(src.isPointer())
 	{
-		dst.move(i, src.Int(i));
+		state->createPointer(insn.resultId(), src.Pointer(0));
+	}
+	else
+	{
+		auto type = getType(insn.resultTypeId());
+		auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
+		for(uint32_t i = 0; i < type.componentCount; i++)
+		{
+			dst.move(i, src.Int(i));
+		}
 	}
 	return EmitResult::Continue;
 }