1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-02-19 16:54:18 +01:00
This commit is contained in:
Unknown 2019-08-25 21:59:18 +01:00
parent aee2971014
commit 1598083a37
5 changed files with 28 additions and 4 deletions

View File

@ -216,6 +216,7 @@ typedef struct VkShaderModule_T
uint32_t sizes[RPI_ASSEMBLY_TYPE_MAX];
VkRpiAssemblyMappingEXT* mappings;
uint32_t numMappings;
uint32_t hasThreadSwitch;
} _shaderModule;
typedef struct VkDescriptorSetLayout_T

View File

@ -13,6 +13,10 @@ void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t ins
_renderpass* rp = cb->renderpass;
_framebuffer* fb = cb->fbo;
//TODO handle cases when submitting >65k vertices in a VBO
//TODO HW-2116 workaround
//TODO GFXH-515 / SW-5891 workaround
//TODO handle multiple attachments etc.
_image* i = fb->attachmentViews[rp->subpasses[cb->currentSubpass].pColorAttachments[0].attachment].image;
@ -75,6 +79,7 @@ void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t ins
clInsertClipperXYScaling(&commandBuffer->binCl, (float)(i->width) * 0.5f * 16.0f, -1.0f * (float)(i->height) * 0.5f * 16.0f);
//TODO how is this calculated?
//it's Zc to Zs scale and bias
//seems to go from -1.0 .. 1.0 to 0.0 .. 1.0
//eg. x * 0.5 + 0.5
//cb->graphicsPipeline->minDepthBounds;
@ -130,8 +135,8 @@ void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t ins
clInsertShaderRecord(&commandBuffer->shaderRecCl,
&relocCl,
&commandBuffer->handlesCl,
0, //TODO single threaded?
0, //point size included in shaded vertex data?
!cb->graphicsPipeline->modules[ulog2(VK_SHADER_STAGE_FRAGMENT_BIT)]->hasThreadSwitch,
0, //TODO point size included in shaded vertex data?
1, //enable clipping?
0, //fragment number of unused uniforms?
0, //fragment number of varyings?
@ -492,5 +497,5 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(
int32_t vertexOffset,
uint32_t firstInstance)
{
//TODO
}

View File

@ -4,6 +4,11 @@
#include "QPUassembler/qpu_assembler.h"
//TODO collect shader performance data
//eg number of texture samples etc.
//TODO check if shader has flow control and make sure instance also has flow control
//TODO make sure instance has threaded fs if shader contains thread switch
VkResult vkCreateShaderModuleFromRpiAssemblyEXT(VkDevice device, VkRpiShaderModuleAssemblyCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
{
assert(device);
@ -18,6 +23,8 @@ VkResult vkCreateShaderModuleFromRpiAssemblyEXT(VkDevice device, VkRpiShaderModu
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
shader->hasThreadSwitch = 0;
for(int c = 0; c < RPI_ASSEMBLY_TYPE_MAX; ++c)
{
if(pCreateInfo->asmStrings[c])
@ -41,6 +48,15 @@ VkResult vkCreateShaderModuleFromRpiAssemblyEXT(VkDevice device, VkRpiShaderModu
disassemble_qpu_asm(instructions[c]);
}
for(uint64_t c = 0; c < numInstructions; ++c)
{
if((instructions[c] & (0xf << 60)) == (2 << 60))
{
shader->hasThreadSwitch = 1;
break;
}
}
printf("\n");
FREE(instructions);

View File

@ -39,7 +39,7 @@ static VkPhysicalDeviceLimits _limits =
.maxVertexInputBindings = 8, //TODO will fail CTS, MIN is 16
.maxVertexInputAttributeOffset = 2047,
.maxVertexInputBindingStride = 2048,
.maxVertexOutputComponents = 128,
.maxVertexOutputComponents = 128, //TODO?
.maxTessellationGenerationLevel = 0, //No tessellation
.maxTessellationPatchSize = 0,
.maxTessellationControlPerVertexInputComponents = 0,

View File

@ -88,6 +88,8 @@ VkResult vkCreateShaderModuleFromRpiAssemblyEXT(
VkShaderModule* pShaderModule
);
//TODO performance counters / perfmon
#ifdef __cplusplus
}