2018-05-07 17:13:39 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//we need something like the other platforms to create surfaces on the RPI
|
|
|
|
//so I created this little "extension"
|
|
|
|
//full spec in this file ;)
|
|
|
|
|
2019-05-06 17:58:34 +02:00
|
|
|
typedef enum VkRpiSurfaceCreateFlagsEXT {
|
2018-05-07 17:13:39 +02:00
|
|
|
//reserved
|
|
|
|
VK_RPI_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
2019-05-06 17:58:34 +02:00
|
|
|
} VkRpiSurfaceCreateFlagsEXT;
|
2018-05-07 17:13:39 +02:00
|
|
|
|
2019-05-06 17:58:34 +02:00
|
|
|
typedef struct VkRpiSurfaceCreateInfoEXT {
|
2018-05-13 20:29:47 +02:00
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
2019-05-06 17:58:34 +02:00
|
|
|
VkRpiSurfaceCreateFlagsEXT flags; //reserved
|
2018-05-13 20:29:47 +02:00
|
|
|
//maybe include some other stuff dunno
|
2019-05-06 17:58:34 +02:00
|
|
|
} VkRpiSurfaceCreateInfoEXT;
|
2018-05-07 17:13:39 +02:00
|
|
|
|
2019-08-18 18:36:57 +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;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//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;
|
2019-05-06 17:58:34 +02:00
|
|
|
char** asmStrings;
|
2019-08-18 18:36:57 +02:00
|
|
|
VkRpiAssemblyMappingEXT* mappings;
|
|
|
|
uint32_t numMappings;
|
2019-05-06 17:58:34 +02:00
|
|
|
} VkRpiShaderModuleAssemblyCreateInfoEXT;
|
2018-09-23 21:55:30 +02:00
|
|
|
|
2018-05-12 14:24:25 +02:00
|
|
|
//extension name something like: VK_KHR_rpi_surface
|
2018-09-18 22:22:43 +02:00
|
|
|
//extension that allows developers to create a surface to render to on Raspbian Stretch Lite
|
2019-05-06 17:58:34 +02:00
|
|
|
VkResult vkCreateRpiSurfaceEXT(
|
2018-05-13 20:29:47 +02:00
|
|
|
VkInstance instance,
|
2019-05-06 17:58:34 +02:00
|
|
|
const VkRpiSurfaceCreateInfoEXT* pCreateInfo,
|
2018-05-13 20:29:47 +02:00
|
|
|
const VkAllocationCallbacks* pAllocator,
|
|
|
|
VkSurfaceKHR* pSurface);
|
2018-05-07 17:13:39 +02:00
|
|
|
|
2018-09-18 22:22:43 +02:00
|
|
|
//extension that allows developers to submit QPU assembly directly and thus hand optimise code
|
2019-05-06 17:58:34 +02:00
|
|
|
VkResult vkCreateShaderModuleFromRpiAssemblyEXT(
|
2018-09-18 22:22:43 +02:00
|
|
|
VkDevice device,
|
2019-05-06 17:58:34 +02:00
|
|
|
VkRpiShaderModuleAssemblyCreateInfoEXT* pCreateInfo,
|
2018-09-23 21:55:30 +02:00
|
|
|
const VkAllocationCallbacks* pAllocator,
|
2018-09-18 22:22:43 +02:00
|
|
|
VkShaderModule* pShaderModule
|
|
|
|
);
|
|
|
|
|
2018-05-07 17:13:39 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|