Commit ee841c56 by Nicolas Capens Committed by Nicolas Capens

Base the driver version on Version.h.

Also always clear the UUIDs first so that shorter strings don't leave data undefined. Bug b/116336664 Change-Id: I77d5ae1514db5d68d540614b7c57c4872695ecca Reviewed-on: https://swiftshader-review.googlesource.com/c/22490Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 513a1165
......@@ -14,11 +14,11 @@
#define MAJOR_VERSION 5
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define PATCH_VERSION 0
#define BUILD_REVISION 1
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(PATCH_VERSION)
......@@ -120,7 +120,7 @@ private:
VkBuffer buffer;
VkDeviceSize offset;
};
VertexInputBindings vertexInputBindings[MaxVertexInputBindings];
VertexInputBindings vertexInputBindings[MAX_VERTEX_INPUT_BINDINGS];
};
using DispatchableCommandBuffer = DispatchableObject<CommandBuffer, VkCommandBuffer>;
......
......@@ -15,17 +15,22 @@
#ifndef VK_CONFIG_HPP_
#define VK_CONFIG_HPP_
#include "Version.h"
#include <vulkan/vulkan_core.h>
namespace vk
{
// Note: Constant array initialization requires a string literal.
// constexpr char* or char[] does not work for that purpose.
#define SWIFTSHADER_DEVICE_NAME "SwiftShader Device" // Max length: VK_MAX_PHYSICAL_DEVICE_NAME_SIZE
#define SWIFTSHADER_UUID "SwiftShaderUUID" // Max length: VK_UUID_SIZE
#define SWIFTSHADER_UUID "SwiftShaderUUID" // Max length: VK_UUID_SIZE (16)
enum
{
DRIVER_VERSION = 1,
API_VERSION = VK_API_VERSION_1_1,
DRIVER_VERSION = VK_MAKE_VERSION(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION),
VENDOR_ID = 0x1AE0, // Google
DEVICE_ID = 0xC0DE, // SwiftShader
};
......@@ -45,8 +50,9 @@ enum
MAX_IMAGE_ARRAY_LAYERS = 11,
};
enum {
MaxVertexInputBindings = 16,
enum
{
MAX_VERTEX_INPUT_BINDINGS = 16,
};
}
......
......@@ -166,7 +166,7 @@ const VkPhysicalDeviceLimits& PhysicalDevice::getLimits() const
24, // maxDescriptorSetStorageImages
4, // maxDescriptorSetInputAttachments
16, // maxVertexInputAttributes
vk::MaxVertexInputBindings, // maxVertexInputBindings
vk::MAX_VERTEX_INPUT_BINDINGS, // maxVertexInputBindings
2047, // maxVertexInputAttributeOffset
2048, // maxVertexInputBindingStride
64, // maxVertexOutputComponents
......@@ -247,17 +247,11 @@ const VkPhysicalDeviceLimits& PhysicalDevice::getLimits() const
return limits;
}
const VkPhysicalDeviceProperties& PhysicalDevice::getProperties() const
{
uint32_t apiVersion;
VkResult result = vkEnumerateInstanceVersion(&apiVersion);
ASSERT(result == VK_SUCCESS);
(void)result; // Slence unused variable warning
static const VkPhysicalDeviceProperties properties
{
apiVersion,
API_VERSION,
DRIVER_VERSION,
VENDOR_ID,
DEVICE_ID,
......@@ -273,10 +267,13 @@ const VkPhysicalDeviceProperties& PhysicalDevice::getProperties() const
void PhysicalDevice::getProperties(VkPhysicalDeviceIDProperties* properties) const
{
memcpy(properties->deviceUUID, SWIFTSHADER_UUID, VK_UUID_SIZE);
memset(properties->deviceLUID, 0, VK_LUID_SIZE);
memset(properties->deviceUUID, 0, VK_UUID_SIZE);
memset(properties->driverUUID, 0, VK_UUID_SIZE);
memset(properties->deviceLUID, 0, VK_LUID_SIZE);
memcpy(properties->deviceUUID, SWIFTSHADER_UUID, VK_UUID_SIZE);
*((uint64_t*)properties->driverUUID) = DRIVER_VERSION;
properties->deviceNodeMask = 0;
properties->deviceLUIDValid = VK_FALSE;
}
......
......@@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
FILEVERSION MAJOR_VERSION,MINOR_VERSION,PATCH_VERSION,BUILD_REVISION
PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,PATCH_VERSION,BUILD_REVISION
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
......
......@@ -1376,7 +1376,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, u
VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t* pApiVersion)
{
TRACE("(uint32_t* pApiVersion = 0x%X)", pApiVersion);
*pApiVersion = VK_API_VERSION_1_1;
*pApiVersion = vk::API_VERSION;
return VK_SUCCESS;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment