2018-05-07 17:13:39 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-10-01 01:39:24 +02:00
|
|
|
#define VK_NO_PROTOTYPES
|
2019-09-30 22:30:37 +02:00
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-10-01 01:39:24 +02:00
|
|
|
typedef VkResult (*PFN_vkCreateShaderModuleFromRpiAssemblyEXT)(
|
2019-09-30 22:30:37 +02:00
|
|
|
VkPhysicalDevice physicalDevice);
|
|
|
|
|
2019-10-01 01:39:24 +02:00
|
|
|
// Sooo we're not really getting the REAL VkPhysicalDevice from the Loader
|
|
|
|
// But rather a Trampoline object that points to a Terminator that finally points to
|
|
|
|
// The real object
|
|
|
|
// Therefore if we would like to pass on information in our VkPhysicalDevice object
|
|
|
|
// We need to walk this chain...
|
2019-09-30 22:30:37 +02:00
|
|
|
typedef struct VkRpiPhysicalDevice
|
|
|
|
{
|
2019-10-01 01:39:24 +02:00
|
|
|
uintptr_t loaderData;
|
|
|
|
uintptr_t customData;
|
2019-09-30 22:30:37 +02:00
|
|
|
} VkRpiPhysicalDevice;
|
|
|
|
|
2019-10-01 01:39:24 +02:00
|
|
|
typedef struct LoaderTerminator
|
|
|
|
{
|
|
|
|
uintptr_t a;
|
|
|
|
uintptr_t b;
|
|
|
|
uint8_t c;
|
|
|
|
VkRpiPhysicalDevice* physicalDevice;
|
|
|
|
} LoaderTerminator;
|
|
|
|
|
|
|
|
typedef struct LoaderTrampoline
|
|
|
|
{
|
|
|
|
uintptr_t a;
|
|
|
|
uintptr_t b;
|
|
|
|
LoaderTerminator* loaderTerminator;
|
|
|
|
} LoaderTrampoline;
|
|
|
|
|
2019-08-18 18:36:57 +02:00
|
|
|
/*
|
|
|
|
* assembly to vulkan resource mapping
|
|
|
|
*
|
|
|
|
* map vulkan resources such as
|
|
|
|
* -push constants
|
|
|
|
* -descriptor set entries
|
|
|
|
* -images
|
|
|
|
* -buffers
|
|
|
|
*
|
|
|
|
* to assembly uniform reads
|
|
|
|
*
|
|
|
|
* push constants should be one read
|
|
|
|
*
|
|
|
|
* buffers and images are handled through the TMU pipeline
|
|
|
|
* and therefore carry implicit uniform reads
|
|
|
|
* buffers should be one uniform (general memory read)
|
|
|
|
* number of uniforms for images are dependent on type (and TMU writes)
|
|
|
|
*
|
|
|
|
* therefore what we need is a mapping for each assembly uniform read
|
|
|
|
* to some vulkan resource
|
|
|
|
* and the driver should be able to figure out what to put in the uniform queue
|
|
|
|
* based on the mapping
|
|
|
|
*
|
|
|
|
* vertex and coordinate shader mappings are shared
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-10-01 20:23:52 +02:00
|
|
|
|
|
|
|
typedef enum VkRpiAssemblyMappingTypeEXT {
|
|
|
|
VK_RPI_ASSEMBLY_MAPPING_TYPE_DESCRIPTOR = 0,
|
|
|
|
VK_RPI_ASSEMBLY_MAPPING_TYPE_PUSH_CONSTANT = 1,
|
|
|
|
VK_RPI_ASSEMBLY_MAPPING_TYPE_MAX
|
|
|
|
} VkRpiAssemblyMappingTypeEXT;
|
|
|
|
|
2019-08-18 18:36:57 +02:00
|
|
|
//defines mapping for a single uniform FIFO read to a Vulkan resource
|
|
|
|
typedef struct VkRpiAssemblyMappingEXT {
|
|
|
|
VkRpiAssemblyMappingTypeEXT mappingType;
|
|
|
|
VkDescriptorType descriptorType;
|
|
|
|
uint32_t descriptorSet;
|
|
|
|
uint32_t descriptorBinding;
|
|
|
|
uint32_t descriptorArrayElement;
|
|
|
|
uint32_t resourceOffset; //in bytes
|
|
|
|
VkShaderStageFlagBits shaderStage;
|
|
|
|
} VkRpiAssemblyMappingEXT;
|
|
|
|
|
2019-05-06 17:58:34 +02:00
|
|
|
typedef struct VkRpiShaderModuleAssemblyCreateInfoEXT {
|
2018-09-23 21:55:30 +02:00
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
2020-04-17 21:59:04 +02:00
|
|
|
uint64_t** instructions;
|
|
|
|
uint32_t* numInstructions;
|
2019-08-18 18:36:57 +02:00
|
|
|
VkRpiAssemblyMappingEXT* mappings;
|
|
|
|
uint32_t numMappings;
|
2019-05-06 17:58:34 +02:00
|
|
|
} VkRpiShaderModuleAssemblyCreateInfoEXT;
|
2019-09-30 22:30:37 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|