Fix dynamic state for line width

Line width was always taken from the pipeline state.  If dynamic state
is used however, it should be taken from the dynamically set state.

Since SwiftShader doesn't support wideLines, this is implicitly always
1.0

Bug: angleproject:5906
Change-Id: I46665c45a5455f63ef0798d11b7c1381fcfddbf2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/65768
Commit-Queue: Shahbaz Youssefi <syoussefi@google.com>
Tested-by: Shahbaz Youssefi <syoussefi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Device/Context.cpp b/src/Device/Context.cpp
index 57e6670..1d25cc3 100644
--- a/src/Device/Context.cpp
+++ b/src/Device/Context.cpp
@@ -426,7 +426,10 @@
 		depthBiasClamp = 0.0f;
 	}
 
-	lineWidth = rasterizationState->lineWidth;
+	if (!dynamicStateFlags.dynamicLineWidth)
+	{
+		lineWidth = rasterizationState->lineWidth;
+	}
 
 	const VkBaseInStructure *extensionCreateInfo = reinterpret_cast<const VkBaseInStructure *>(rasterizationState->pNext);
 	while(extensionCreateInfo)
@@ -829,6 +832,11 @@
 		combinedState.viewport = dynamicState.viewport;
 	}
 
+	if(dynamicStateFlags.dynamicLineWidth)
+	{
+		combinedState.lineWidth = dynamicState.lineWidth;
+	}
+
 	if(dynamicStateFlags.dynamicBlendConstants)
 	{
 		combinedState.blendConstants = dynamicState.blendConstants;
@@ -1117,4 +1125,4 @@
 	return colorWriteMask[index];
 }
 
-}  // namespace vk
\ No newline at end of file
+}  // namespace vk
diff --git a/src/Device/Context.hpp b/src/Device/Context.hpp
index 17ed488..5111da3 100644
--- a/src/Device/Context.hpp
+++ b/src/Device/Context.hpp
@@ -129,6 +129,7 @@
 	float depthBiasSlopeFactor = 0.0f;
 	float minDepthBounds = 0.0f;
 	float maxDepthBounds = 0.0f;
+	float lineWidth = 0.0f;
 
 	VkCullModeFlags cullMode = VK_CULL_MODE_NONE;
 	VkBool32 depthBoundsTestEnable = VK_FALSE;
diff --git a/src/Vulkan/VkCommandBuffer.cpp b/src/Vulkan/VkCommandBuffer.cpp
index 72e5cb6..9d84afc 100644
--- a/src/Vulkan/VkCommandBuffer.cpp
+++ b/src/Vulkan/VkCommandBuffer.cpp
@@ -430,6 +430,25 @@
 	const uint32_t scissorID;
 };
 
+class CmdSetLineWidth : public vk::CommandBuffer::Command
+{
+public:
+	CmdSetLineWidth(float lineWidth)
+	    : lineWidth(lineWidth)
+	{
+	}
+
+	void execute(vk::CommandBuffer::ExecutionState &executionState) override
+	{
+		executionState.dynamicState.lineWidth = lineWidth;
+	}
+
+	std::string description() override { return "vkCmdSetLineWidth()"; }
+
+private:
+	const float lineWidth;
+};
+
 class CmdSetDepthBias : public vk::CommandBuffer::Command
 {
 public:
@@ -1945,8 +1964,7 @@
 
 void CommandBuffer::setLineWidth(float lineWidth)
 {
-	// If the wide lines feature is not enabled, lineWidth must be 1.0
-	ASSERT(lineWidth == 1.0f);
+	addCommand<::CmdSetLineWidth>(lineWidth);
 }
 
 void CommandBuffer::setDepthBias(float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor)