Add a macro for indicating unoptimized code paths

This should be used when knowingly leaving some code unoptimized, so it
can more easily be found again later when investigating performance
issues or during optimization efforts.

Bug: b/260246698
Change-Id: I6287e98493c5ad4c6c358d4438233b402bad1d81
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/69829
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Commit-Queue: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Device/Context.cpp b/src/Device/Context.cpp
index 0d88fce..cb8131f 100644
--- a/src/Device/Context.cpp
+++ b/src/Device/Context.cpp
@@ -350,7 +350,6 @@
 	}
 }
 
-// TODO(b/137740918): Optimize instancing to use a single draw call.
 void Inputs::advanceInstanceAttributes(bool dynamicInstanceStride)
 {
 	for(uint32_t i = 0; i < vk::MAX_VERTEX_INPUT_BINDINGS; i++)
diff --git a/src/System/Debug.hpp b/src/System/Debug.hpp
index 10457b3..f3d3932 100644
--- a/src/System/Debug.hpp
+++ b/src/System/Debug.hpp
@@ -159,4 +159,14 @@
 		} while(0)
 #endif
 
+// A macro to indicate unoptimized code paths.
+#define UNOPTIMIZED(message, ...)                                                            \
+	do                                                                                       \
+	{                                                                                        \
+		if(false)                                                                            \
+		{                                                                                    \
+			sw::warn("%s:%d UNOPTIMIZED: " message "\n", __FILE__, __LINE__, ##__VA_ARGS__); \
+		}                                                                                    \
+	} while(0)
+
 #endif  // Debug_hpp
diff --git a/src/Vulkan/VkCommandBuffer.cpp b/src/Vulkan/VkCommandBuffer.cpp
index f333d1f..3bfe933 100644
--- a/src/Vulkan/VkCommandBuffer.cpp
+++ b/src/Vulkan/VkCommandBuffer.cpp
@@ -957,7 +957,11 @@
 				}
 			}
 
-			inputs.advanceInstanceAttributes(hasDynamicVertexStride);
+			if(instanceCount > 1)
+			{
+				UNOPTIMIZED("Optimize instancing to use a single draw call.");  // TODO(b/137740918)
+				inputs.advanceInstanceAttributes(hasDynamicVertexStride);
+			}
 		}
 	}
 };