Pass only descriptor data to shader execution

vk::DescriptorSet has a header which has a pointer to the descriptor set
layout, which is needed for vkUpdateDescriptorSets. This information
should not be available to shaders during execution.

Bug: b/152227757
Change-Id: I088828a28ab4ed75ae84fb3f103455f70a8bc051
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43968
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Vulkan/VkCommandBuffer.cpp b/src/Vulkan/VkCommandBuffer.cpp
index 364c318..ec1131a 100644
--- a/src/Vulkan/VkCommandBuffer.cpp
+++ b/src/Vulkan/VkCommandBuffer.cpp
@@ -1108,7 +1108,7 @@
 		auto dynamicOffsetBase = pipelineLayout->getDynamicOffsetBase(set);
 		ASSERT_OR_RETURN(dynamicOffsetBase + dynamicOffsetCount <= vk::MAX_DESCRIPTOR_SET_COMBINED_BUFFERS_DYNAMIC);
 
-		pipelineState.descriptorSets[set] = descriptorSet;
+		pipelineState.descriptorSets[set] = descriptorSet->data;
 		for(uint32_t i = 0; i < dynamicOffsetCount; i++)
 		{
 			pipelineState.descriptorDynamicOffsets[dynamicOffsetBase + i] = dynamicOffsets[i];
diff --git a/src/Vulkan/VkDescriptorSet.hpp b/src/Vulkan/VkDescriptorSet.hpp
index 606b0f1..d0564ef 100644
--- a/src/Vulkan/VkDescriptorSet.hpp
+++ b/src/Vulkan/VkDescriptorSet.hpp
@@ -18,6 +18,7 @@
 // Intentionally not including VkObject.hpp here due to b/127920555
 
 #include <array>
+#include <cstdint>
 #include <memory>
 
 namespace vk {
@@ -37,7 +38,7 @@
 		return static_cast<DescriptorSet *>(static_cast<void *>(object));
 	}
 
-	using Bindings = std::array<vk::DescriptorSet *, vk::MAX_BOUND_DESCRIPTOR_SETS>;
+	using Bindings = std::array<uint8_t *, vk::MAX_BOUND_DESCRIPTOR_SETS>;
 	using DynamicOffsets = std::array<uint32_t, vk::MAX_DESCRIPTOR_SET_COMBINED_BUFFERS_DYNAMIC>;
 
 	DescriptorSetHeader header;
diff --git a/src/Vulkan/VkDescriptorSetLayout.cpp b/src/Vulkan/VkDescriptorSetLayout.cpp
index 27d9969..cd8f3c1 100644
--- a/src/Vulkan/VkDescriptorSetLayout.cpp
+++ b/src/Vulkan/VkDescriptorSetLayout.cpp
@@ -19,9 +19,9 @@
 #include "VkDescriptorSet.hpp"
 #include "VkImageView.hpp"
 #include "VkSampler.hpp"
-#include "System/Types.hpp"
 
 #include <algorithm>
+#include <cstddef>
 #include <cstring>
 
 namespace {
@@ -115,8 +115,8 @@
 
 size_t DescriptorSetLayout::getDescriptorSetAllocationSize() const
 {
-	// vk::DescriptorSet has a layout member field.
-	return sw::align<alignof(DescriptorSet)>(OFFSET(DescriptorSet, data) + getDescriptorSetDataSize());
+	// vk::DescriptorSet has a header with a pointer to the layout.
+	return sw::align<alignof(DescriptorSet)>(offsetof(DescriptorSet, data) + getDescriptorSetDataSize());
 }
 
 size_t DescriptorSetLayout::getDescriptorSetDataSize() const
@@ -196,7 +196,7 @@
 {
 	uint32_t index = getBindingIndex(binding);
 	auto typeSize = GetDescriptorSize(bindings[index].descriptorType);
-	return bindingOffsets[index] + OFFSET(DescriptorSet, data[0]) + (typeSize * arrayElement);
+	return bindingOffsets[index] + (typeSize * arrayElement);
 }
 
 bool DescriptorSetLayout::isDynamic(VkDescriptorType type)