Remove color interpolation from image sampling benchmark

Also make the image not a solid color.

Bug: b/179897703
Change-Id: Ibe2084c4e9f0d9023269218df1ad467bb24a1ae3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52750
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/tests/VulkanBenchmarks/TriangleBenchmarks.cpp b/tests/VulkanBenchmarks/TriangleBenchmarks.cpp
index 9050010..1bbf369 100644
--- a/tests/VulkanBenchmarks/TriangleBenchmarks.cpp
+++ b/tests/VulkanBenchmarks/TriangleBenchmarks.cpp
@@ -153,20 +153,18 @@
 		struct Vertex
 		{
 			float position[3];
-			float color[3];
 			float texCoord[2];
 		};
 
 		Vertex vertexBufferData[] = {
-			{ { 1.0f, 1.0f, 0.5f }, { 1.0f, 0.0f, 0.0f }, { 1.0f, 0.0f } },
-			{ { -1.0f, 1.0f, 0.5f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f } },
-			{ { 0.0f, -1.0f, 0.5f }, { 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f } }
+			{ { 1.0f, 1.0f, 0.5f }, { 1.0f, 0.0f } },
+			{ { -1.0f, 1.0f, 0.5f }, { 0.0f, 1.0f } },
+			{ { 0.0f, -1.0f, 0.5f }, { 0.0f, 0.0f } }
 		};
 
 		std::vector<vk::VertexInputAttributeDescription> inputAttributes;
 		inputAttributes.push_back(vk::VertexInputAttributeDescription(0, 0, vk::Format::eR32G32B32Sfloat, offsetof(Vertex, position)));
-		inputAttributes.push_back(vk::VertexInputAttributeDescription(1, 0, vk::Format::eR32G32B32Sfloat, offsetof(Vertex, color)));
-		inputAttributes.push_back(vk::VertexInputAttributeDescription(2, 0, vk::Format::eR32G32Sfloat, offsetof(Vertex, texCoord)));
+		inputAttributes.push_back(vk::VertexInputAttributeDescription(1, 0, vk::Format::eR32G32Sfloat, offsetof(Vertex, texCoord)));
 
 		tester.addVertexBuffer(vertexBufferData, sizeof(vertexBufferData), std::move(inputAttributes));
 	});
@@ -174,16 +172,13 @@
 	tester.onCreateVertexShader([](DrawTester &tester) {
 		const char *vertexShader = R"(#version 310 es
 			layout(location = 0) in vec3 inPos;
-			layout(location = 1) in vec3 inColor;
-
-			layout(location = 0) out vec3 outColor;
-			layout(location = 1) out vec2 fragTexCoord;
+			layout(location = 1) in vec2 inTexCoord;
+			layout(location = 0) out vec2 outTexCoord;
 
 			void main()
 			{
-				outColor = inColor;
 				gl_Position = vec4(inPos.xyz, 1.0);
-				fragTexCoord = inPos.xy;
+				outTexCoord = inTexCoord;
 			})";
 
 		return tester.createShaderModule(vertexShader, EShLanguage::EShLangVertex);
@@ -193,16 +188,13 @@
 		const char *fragmentShader = R"(#version 310 es
 			precision highp float;
 
-			layout(location = 0) in vec3 inColor;
-			layout(location = 1) in vec2 fragTexCoord;
-
+			layout(location = 0) in vec2 inTexCoord;
 			layout(location = 0) out vec4 outColor;
-
-			layout(binding = 1) uniform sampler2D texSampler;
+			layout(binding = 0) uniform sampler2D texSampler;
 
 			void main()
 			{
-				outColor = texture(texSampler, fragTexCoord) * vec4(inColor, 1.0);
+				outColor = texture(texSampler, inTexCoord);
 			})";
 
 		return tester.createShaderModule(fragmentShader, EShLanguage::EShLangFragment);
@@ -226,11 +218,28 @@
 
 		auto &texture = tester.addImage(device, physicalDevice, 16, 16, vk::Format::eR8G8B8A8Unorm).obj;
 
-		// Fill texture with white
+		// Fill texture with colorful checkerboard
+		std::array<uint32_t, 3> rgb = { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF };
+		int colorIndex = 0;
 		vk::DeviceSize bufferSize = 16 * 16 * 4;
 		Buffer buffer(device, bufferSize, vk::BufferUsageFlagBits::eTransferSrc);
-		void *data = buffer.mapMemory();
-		memset(data, 255, bufferSize);
+		uint32_t *data = static_cast<uint32_t *>(buffer.mapMemory());
+
+		for(int i = 0; i < 16; i++)
+		{
+			for(int j = 0; j < 16; j++)
+			{
+				if(((i ^ j) & 1) == 0)
+				{
+					data[i + 16 * j] = rgb[colorIndex++ % rgb.size()];
+				}
+				else
+				{
+					data[i + 16 * j] = 0;
+				}
+			}
+		}
+
 		buffer.unmapMemory();
 
 		Util::transitionImageLayout(device, commandPool, queue, texture.getImage(), vk::Format::eR8G8B8A8Unorm, vk::ImageLayout::eUndefined, vk::ImageLayout::eTransferDstOptimal);