mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 08:40:55 +00:00
get vk_info.cpp compiling
This commit is contained in:
@@ -171,10 +171,10 @@ struct VulkanPipelineState
|
||||
struct Raster
|
||||
{
|
||||
Raster()
|
||||
: depthClipEnable(false), rasterizerDiscardEnable(false), FrontCCW(false), FillMode(eFill_Solid), CullMode(eCull_None)
|
||||
: depthClampEnable(false), rasterizerDiscardEnable(false), FrontCCW(false), FillMode(eFill_Solid), CullMode(eCull_None)
|
||||
, depthBias(0), depthBiasClamp(0), slopeScaledDepthBias(0), lineWidth(0) {}
|
||||
|
||||
bool32 depthClipEnable, rasterizerDiscardEnable, FrontCCW;
|
||||
bool32 depthClampEnable, rasterizerDiscardEnable, FrontCCW;
|
||||
TriangleFillMode FillMode;
|
||||
TriangleCullMode CullMode;
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev)
|
||||
|
||||
sampInfo.minFilter = VK_TEX_FILTER_NEAREST;
|
||||
sampInfo.magFilter = VK_TEX_FILTER_NEAREST;
|
||||
sampInfo.mipMode = VK_TEX_MIPMAP_MODE_NEAREST;
|
||||
sampInfo.mipmapMode = VK_TEX_MIPMAP_MODE_NEAREST;
|
||||
|
||||
vkr = vt->CreateSampler(Unwrap(dev), &sampInfo, &m_PointSampler);
|
||||
RDCASSERT(vkr == VK_SUCCESS);
|
||||
@@ -788,13 +788,13 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev)
|
||||
|
||||
GetResourceManager()->WrapResource(Unwrap(dev), m_CheckerboardPipeline);
|
||||
|
||||
msaa.rasterSamples = VULKAN_MESH_VIEW_SAMPLES;
|
||||
msaa.rasterizationSamples = VULKAN_MESH_VIEW_SAMPLES;
|
||||
pipeInfo.renderPass = RGBA8MSRP;
|
||||
|
||||
vkr = vt->CreateGraphicsPipelines(Unwrap(dev), VK_NULL_HANDLE, 1, &pipeInfo, &m_CheckerboardMSAAPipeline);
|
||||
RDCASSERT(vkr == VK_SUCCESS);
|
||||
|
||||
msaa.rasterSamples = 1;
|
||||
msaa.rasterizationSamples = 1;
|
||||
pipeInfo.renderPass = RGBA8RP;
|
||||
|
||||
GetResourceManager()->WrapResource(Unwrap(dev), m_CheckerboardMSAAPipeline);
|
||||
@@ -1851,20 +1851,20 @@ void VulkanDebugManager::MakeGraphicsPipelineInfo(VkGraphicsPipelineCreateInfo &
|
||||
|
||||
static VkPipelineRasterStateCreateInfo rs = { VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO };
|
||||
|
||||
rs.depthClipEnable = pipeInfo.depthClipEnable;
|
||||
rs.depthClipEnable = pipeInfo.depthClampEnable;
|
||||
rs.rasterizerDiscardEnable = pipeInfo.rasterizerDiscardEnable,
|
||||
rs.fillMode = pipeInfo.fillMode;
|
||||
rs.cullMode = pipeInfo.cullMode;
|
||||
rs.frontFace = pipeInfo.frontFace;
|
||||
rs.depthBiasEnable = pipeInfo.depthBiasEnable;
|
||||
rs.depthBias = pipeInfo.depthBias;
|
||||
rs.depthBias = pipeInfo.depthBiasConstantFactor;
|
||||
rs.depthBiasClamp = pipeInfo.depthBiasClamp;
|
||||
rs.slopeScaledDepthBias = pipeInfo.slopeScaledDepthBias;
|
||||
rs.slopeScaledDepthBias = pipeInfo.depthBiasSlopeFactor;
|
||||
rs.lineWidth = pipeInfo.lineWidth;
|
||||
|
||||
static VkPipelineMultisampleStateCreateInfo msaa = { VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO };
|
||||
|
||||
msaa.rasterSamples = pipeInfo.rasterSamples;
|
||||
msaa.rasterizationSamples = pipeInfo.rasterizationSamples;
|
||||
msaa.sampleShadingEnable = pipeInfo.sampleShadingEnable;
|
||||
msaa.minSampleShading = pipeInfo.minSampleShading;
|
||||
msaa.pSampleMask = &pipeInfo.sampleMask;
|
||||
|
||||
@@ -28,10 +28,10 @@ void DescSetLayout::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo
|
||||
{
|
||||
dynamicCount = 0;
|
||||
|
||||
bindings.resize(pCreateInfo->count);
|
||||
for(uint32_t i=0; i < pCreateInfo->count; i++)
|
||||
bindings.resize(pCreateInfo->bindingCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->bindingCount; i++)
|
||||
{
|
||||
bindings[i].arraySize = pCreateInfo->pBinding[i].arraySize;
|
||||
bindings[i].descriptorCount = pCreateInfo->pBinding[i].descriptorCount;
|
||||
bindings[i].descriptorType = pCreateInfo->pBinding[i].descriptorType;
|
||||
bindings[i].stageFlags = pCreateInfo->pBinding[i].stageFlags;
|
||||
|
||||
@@ -41,21 +41,21 @@ void DescSetLayout::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo
|
||||
|
||||
if(pCreateInfo->pBinding[i].pImmutableSamplers)
|
||||
{
|
||||
bindings[i].immutableSampler = new ResourceId[bindings[i].arraySize];
|
||||
bindings[i].immutableSampler = new ResourceId[bindings[i].descriptorCount];
|
||||
|
||||
for(uint32_t s=0; s < bindings[i].arraySize; s++)
|
||||
for(uint32_t s=0; s < bindings[i].descriptorCount; s++)
|
||||
bindings[i].immutableSampler[s] = resourceMan->GetNonDispWrapper(pCreateInfo->pBinding[i].pImmutableSamplers[s])->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DescSetLayout::CreateBindingsArray(vector<VkDescriptorInfo*> &descBindings)
|
||||
void DescSetLayout::CreateBindingsArray(vector<DescriptorSetSlot*> &descBindings)
|
||||
{
|
||||
descBindings.resize(bindings.size());
|
||||
for(size_t i=0; i < bindings.size(); i++)
|
||||
{
|
||||
descBindings[i] = new VkDescriptorInfo[bindings[i].arraySize];
|
||||
memset(descBindings[i], 0, sizeof(VkDescriptorInfo)*bindings[i].arraySize);
|
||||
descBindings[i] = new DescriptorSetSlot[bindings[i].descriptorCount];
|
||||
memset(descBindings[i], 0, sizeof(DescriptorSetSlot)*bindings[i].descriptorCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,27 +70,35 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
// need to figure out which states are valid to be NULL
|
||||
|
||||
// VkPipelineShaderStageCreateInfo
|
||||
RDCEraseEl(shaders);
|
||||
for(uint32_t i=0; i < pCreateInfo->stageCount; i++)
|
||||
shaders[ pCreateInfo->pStages[i].stage ] = resourceMan->GetNonDispWrapper(pCreateInfo->pStages[i].shader)->id;
|
||||
{
|
||||
ResourceId id = resourceMan->GetNonDispWrapper(pCreateInfo->pStages[i].module)->id;
|
||||
Shader &shad = shaders[ pCreateInfo->pStages[i].stage ];
|
||||
|
||||
shad.module = id;
|
||||
shad.refl = new ShaderReflection(info.m_ShaderModule[id].refl);
|
||||
shad.refl->DebugInfo.entryFunc = pCreateInfo->pStages[i].pName;
|
||||
// VKTODOLOW set this properly
|
||||
shad.refl->DebugInfo.entryFile = 0;
|
||||
}
|
||||
|
||||
if(pCreateInfo->pVertexInputState)
|
||||
{
|
||||
vertexBindings.resize(pCreateInfo->pVertexInputState->bindingCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->pVertexInputState->bindingCount; i++)
|
||||
vertexBindings.resize(pCreateInfo->pVertexInputState->vertexBindingDescriptionCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->pVertexInputState->vertexBindingDescriptionCount; i++)
|
||||
{
|
||||
vertexBindings[i].vbufferBinding = pCreateInfo->pVertexInputState->pVertexBindingDescriptions[i].binding;
|
||||
vertexBindings[i].bytestride = pCreateInfo->pVertexInputState->pVertexBindingDescriptions[i].strideInBytes;
|
||||
vertexBindings[i].perInstance = pCreateInfo->pVertexInputState->pVertexBindingDescriptions[i].stepRate == VK_VERTEX_INPUT_STEP_RATE_INSTANCE;
|
||||
vertexBindings[i].bytestride = pCreateInfo->pVertexInputState->pVertexBindingDescriptions[i].stride;
|
||||
vertexBindings[i].perInstance = pCreateInfo->pVertexInputState->pVertexBindingDescriptions[i].inputRate == VK_VERTEX_INPUT_RATE_INSTANCE;
|
||||
}
|
||||
|
||||
vertexAttrs.resize(pCreateInfo->pVertexInputState->attributeCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->pVertexInputState->attributeCount; i++)
|
||||
vertexAttrs.resize(pCreateInfo->pVertexInputState->vertexAttributeDescriptionCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->pVertexInputState->vertexAttributeDescriptionCount; i++)
|
||||
{
|
||||
vertexAttrs[i].binding = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].binding;
|
||||
vertexAttrs[i].location = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].location;
|
||||
vertexAttrs[i].format = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].format;
|
||||
vertexAttrs[i].byteoffset = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].offsetInBytes;
|
||||
vertexAttrs[i].byteoffset = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].offset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,22 +125,24 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
}
|
||||
|
||||
// VkPipelineRasterStateCreateInfo
|
||||
depthClipEnable = pCreateInfo->pRasterState->depthClipEnable ? true : false;
|
||||
rasterizerDiscardEnable = pCreateInfo->pRasterState->rasterizerDiscardEnable ? true : false;
|
||||
fillMode = pCreateInfo->pRasterState->fillMode;
|
||||
cullMode = pCreateInfo->pRasterState->cullMode;
|
||||
frontFace = pCreateInfo->pRasterState->frontFace;
|
||||
depthBiasEnable = pCreateInfo->pRasterState->depthBiasEnable ? true : false;
|
||||
depthBias = pCreateInfo->pRasterState->depthBias;
|
||||
depthBiasClamp = pCreateInfo->pRasterState->depthBiasClamp;
|
||||
slopeScaledDepthBias = pCreateInfo->pRasterState->slopeScaledDepthBias;
|
||||
lineWidth = pCreateInfo->pRasterState->lineWidth;
|
||||
depthClampEnable = pCreateInfo->pRasterizationState->depthClampEnable ? true : false;
|
||||
rasterizerDiscardEnable = pCreateInfo->pRasterizationState->rasterizerDiscardEnable ? true : false;
|
||||
polygonMode = pCreateInfo->pRasterizationState->polygonMode;
|
||||
cullMode = pCreateInfo->pRasterizationState->cullMode;
|
||||
frontFace = pCreateInfo->pRasterizationState->frontFace;
|
||||
depthBiasEnable = pCreateInfo->pRasterizationState->depthBiasEnable ? true : false;
|
||||
depthBiasConstantFactor = pCreateInfo->pRasterizationState->depthBiasConstantFactor;
|
||||
depthBiasClamp = pCreateInfo->pRasterizationState->depthBiasClamp;
|
||||
depthBiasSlopeFactor = pCreateInfo->pRasterizationState->depthBiasSlopeFactor;
|
||||
lineWidth = pCreateInfo->pRasterizationState->lineWidth;
|
||||
|
||||
// VkPipelineMultisampleStateCreateInfo
|
||||
rasterSamples = pCreateInfo->pMultisampleState->rasterSamples;
|
||||
rasterizationSamples = pCreateInfo->pMultisampleState->rasterizationSamples;
|
||||
sampleShadingEnable = pCreateInfo->pMultisampleState->sampleShadingEnable ? true : false;
|
||||
minSampleShading = pCreateInfo->pMultisampleState->minSampleShading;
|
||||
sampleMask = pCreateInfo->pMultisampleState->pSampleMask ? *pCreateInfo->pMultisampleState->pSampleMask : ~0U;
|
||||
alphaToCoverageEnable = pCreateInfo->pMultisampleState->alphaToCoverageEnable ? true : false;
|
||||
alphaToOneEnable = pCreateInfo->pMultisampleState->alphaToOneEnable ? true : false;
|
||||
|
||||
// VkPipelineDepthStencilStateCreateInfo
|
||||
depthTestEnable = pCreateInfo->pDepthStencilState->depthTestEnable ? true : false;
|
||||
@@ -146,11 +156,9 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
maxDepthBounds = pCreateInfo->pDepthStencilState->maxDepthBounds;
|
||||
|
||||
// VkPipelineColorBlendStateCreateInfo
|
||||
alphaToCoverageEnable = pCreateInfo->pColorBlendState->alphaToCoverageEnable ? true : false;
|
||||
alphaToOneEnable = pCreateInfo->pColorBlendState->alphaToOneEnable ? true : false;
|
||||
logicOpEnable = pCreateInfo->pColorBlendState->logicOpEnable ? true : false;
|
||||
logicOp = pCreateInfo->pColorBlendState->logicOp;
|
||||
memcpy(blendConst, pCreateInfo->pColorBlendState->blendConst, sizeof(blendConst));
|
||||
memcpy(blendConst, pCreateInfo->pColorBlendState->blendConstants, sizeof(blendConst));
|
||||
|
||||
attachments.resize(pCreateInfo->pColorBlendState->attachmentCount);
|
||||
|
||||
@@ -158,15 +166,15 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
{
|
||||
attachments[i].blendEnable = pCreateInfo->pColorBlendState->pAttachments[i].blendEnable ? true : false;
|
||||
|
||||
attachments[i].blend.Source = pCreateInfo->pColorBlendState->pAttachments[i].srcBlendColor;
|
||||
attachments[i].blend.Destination = pCreateInfo->pColorBlendState->pAttachments[i].destBlendColor;
|
||||
attachments[i].blend.Operation = pCreateInfo->pColorBlendState->pAttachments[i].blendOpColor;
|
||||
attachments[i].blend.Source = pCreateInfo->pColorBlendState->pAttachments[i].srcColorBlendFactor;
|
||||
attachments[i].blend.Destination = pCreateInfo->pColorBlendState->pAttachments[i].dstColorBlendFactor;
|
||||
attachments[i].blend.Operation = pCreateInfo->pColorBlendState->pAttachments[i].colorBlendOp;
|
||||
|
||||
attachments[i].alphaBlend.Source = pCreateInfo->pColorBlendState->pAttachments[i].srcBlendAlpha;
|
||||
attachments[i].alphaBlend.Destination = pCreateInfo->pColorBlendState->pAttachments[i].destBlendAlpha;
|
||||
attachments[i].alphaBlend.Operation = pCreateInfo->pColorBlendState->pAttachments[i].blendOpAlpha;
|
||||
attachments[i].alphaBlend.Source = pCreateInfo->pColorBlendState->pAttachments[i].srcAlphaBlendFactor;
|
||||
attachments[i].alphaBlend.Destination = pCreateInfo->pColorBlendState->pAttachments[i].dstAlphaBlendFactor;
|
||||
attachments[i].alphaBlend.Operation = pCreateInfo->pColorBlendState->pAttachments[i].alphaBlendOp;
|
||||
|
||||
attachments[i].channelWriteMask = pCreateInfo->pColorBlendState->pAttachments[i].channelWriteMask;
|
||||
attachments[i].channelWriteMask = pCreateInfo->pColorBlendState->pAttachments[i].colorWriteMask;
|
||||
}
|
||||
|
||||
RDCEraseEl(dynamicStates);
|
||||
@@ -186,8 +194,16 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
// need to figure out which states are valid to be NULL
|
||||
|
||||
// VkPipelineShaderStageCreateInfo
|
||||
RDCEraseEl(shaders);
|
||||
shaders[0] = resourceMan->GetNonDispWrapper(pCreateInfo->stage.shader)->id;
|
||||
{
|
||||
ResourceId id = resourceMan->GetNonDispWrapper(pCreateInfo->stage.module)->id;
|
||||
Shader &shad = shaders[0];
|
||||
|
||||
shad.module = id;
|
||||
shad.refl = new ShaderReflection(info.m_ShaderModule[id].refl);
|
||||
shad.refl->DebugInfo.entryFunc = pCreateInfo->stage.pName;
|
||||
// VKTODOLOW set this properly
|
||||
shad.refl->DebugInfo.entryFile = 0;
|
||||
}
|
||||
|
||||
topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
primitiveRestartEnable = false;
|
||||
@@ -197,14 +213,14 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
viewportCount = 0;
|
||||
|
||||
// VkPipelineRasterStateCreateInfo
|
||||
depthClipEnable = false;
|
||||
depthClampEnable = false;
|
||||
rasterizerDiscardEnable = false;
|
||||
fillMode = VK_FILL_MODE_SOLID;
|
||||
polygonMode = VK_POLYGON_MODE_FILL;
|
||||
cullMode = VK_CULL_MODE_NONE;
|
||||
frontFace = VK_FRONT_FACE_CW;
|
||||
frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||
|
||||
// VkPipelineMultisampleStateCreateInfo
|
||||
rasterSamples = 1;
|
||||
rasterizationSamples = 1;
|
||||
sampleShadingEnable = false;
|
||||
minSampleShading = 1.0f;
|
||||
sampleMask = ~0U;
|
||||
@@ -221,13 +237,13 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
// VkPipelineColorBlendStateCreateInfo
|
||||
alphaToCoverageEnable = false;
|
||||
logicOpEnable = false;
|
||||
logicOp = VK_LOGIC_OP_NOOP;
|
||||
logicOp = VK_LOGIC_OP_NO_OP;
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::PipelineLayout::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info, const VkPipelineLayoutCreateInfo* pCreateInfo)
|
||||
{
|
||||
descSetLayouts.resize(pCreateInfo->descriptorSetCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->descriptorSetCount; i++)
|
||||
descSetLayouts.resize(pCreateInfo->setLayoutCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->setLayoutCount; i++)
|
||||
descSetLayouts[i] = resourceMan->GetNonDispWrapper(pCreateInfo->pSetLayouts[i])->id;
|
||||
|
||||
pushRanges.reserve(pCreateInfo->pushConstantRangeCount);
|
||||
@@ -254,16 +270,16 @@ void VulkanCreationInfo::RenderPass::Init(VulkanResourceManager *resourceMan, Vu
|
||||
const VkSubpassDescription &subp = pCreateInfo->pSubpasses[i];
|
||||
Subpass &s = subpasses[i];
|
||||
|
||||
s.inputAttachments.resize(subp.inputCount);
|
||||
for(uint32_t i=0; i < subp.inputCount; i++)
|
||||
s.inputAttachments.resize(subp.inputAttachmentCount);
|
||||
for(uint32_t i=0; i < subp.inputAttachmentCount; i++)
|
||||
s.inputAttachments[i] = subp.pInputAttachments[i].attachment;
|
||||
|
||||
s.colorAttachments.resize(subp.colorCount);
|
||||
for(uint32_t i=0; i < subp.colorCount; i++)
|
||||
s.colorAttachments.resize(subp.colorAttachmentCount);
|
||||
for(uint32_t i=0; i < subp.colorAttachmentCount; i++)
|
||||
s.colorAttachments[i] = subp.pColorAttachments[i].attachment;
|
||||
|
||||
s.depthstencilAttachment = (subp.depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED
|
||||
? (int32_t)subp.depthStencilAttachment.attachment : -1);
|
||||
s.depthstencilAttachment = (subp.pDepthStencilAttachment != NULL && subp.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED
|
||||
? (int32_t)subp.pDepthStencilAttachment->attachment : -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +297,7 @@ void VulkanCreationInfo::Framebuffer::Init(VulkanResourceManager *resourceMan, V
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::Memory::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info, const VkMemoryAllocInfo* pAllocInfo)
|
||||
void VulkanCreationInfo::Memory::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info, const VkMemoryAllocateInfo* pAllocInfo)
|
||||
{
|
||||
size = pAllocInfo->allocationSize;
|
||||
}
|
||||
@@ -306,7 +322,7 @@ void VulkanCreationInfo::Image::Init(VulkanResourceManager *resourceMan, VulkanC
|
||||
type = pCreateInfo->imageType;
|
||||
format = pCreateInfo->format;
|
||||
extent = pCreateInfo->extent;
|
||||
arraySize = pCreateInfo->arraySize;
|
||||
arrayLayers = pCreateInfo->arrayLayers;
|
||||
mipLevels = pCreateInfo->mipLevels;
|
||||
samples = pCreateInfo->samples;
|
||||
|
||||
@@ -328,7 +344,7 @@ void VulkanCreationInfo::Sampler::Init(VulkanResourceManager *resourceMan, Vulka
|
||||
{
|
||||
magFilter = pCreateInfo->magFilter;
|
||||
minFilter = pCreateInfo->minFilter;
|
||||
mipMode = pCreateInfo->mipMode;
|
||||
mipmapMode = pCreateInfo->mipmapMode;
|
||||
address[0] = pCreateInfo->addressModeU;
|
||||
address[1] = pCreateInfo->addressModeV;
|
||||
address[2] = pCreateInfo->addressModeW;
|
||||
@@ -362,16 +378,5 @@ void VulkanCreationInfo::ShaderModule::Init(VulkanResourceManager *resourceMan,
|
||||
ParseSPIRV((uint32_t *)pCreateInfo->pCode, pCreateInfo->codeSize/sizeof(uint32_t), spirv);
|
||||
}
|
||||
|
||||
spirv.MakeReflection(&reflTemplate, &mapping);
|
||||
spirv.MakeReflection(&refl, &mapping);
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::Shader::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info, const VkShaderCreateInfo* pCreateInfo, VulkanCreationInfo::ShaderModule &moduleinfo)
|
||||
{
|
||||
module = resourceMan->GetNonDispWrapper(pCreateInfo->module)->id;
|
||||
entry = pCreateInfo->pName;
|
||||
mapping = moduleinfo.mapping;
|
||||
refl = moduleinfo.reflTemplate;
|
||||
refl.DebugInfo.entryFunc = pCreateInfo->pName;
|
||||
// VKTODOLOW set this properly
|
||||
refl.DebugInfo.entryFile = 0;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ struct DescSetLayout
|
||||
~Binding() { SAFE_DELETE_ARRAY(immutableSampler); }
|
||||
|
||||
VkDescriptorType descriptorType;
|
||||
uint32_t arraySize;
|
||||
uint32_t descriptorCount;
|
||||
VkShaderStageFlags stageFlags;
|
||||
ResourceId *immutableSampler;
|
||||
};
|
||||
@@ -67,7 +67,15 @@ struct VulkanCreationInfo
|
||||
VkPipelineCreateFlags flags;
|
||||
|
||||
// VkPipelineShaderStageCreateInfo
|
||||
ResourceId shaders[6];
|
||||
struct Shader
|
||||
{
|
||||
Shader() : refl(NULL), mapping(NULL) {}
|
||||
~Shader() { SAFE_DELETE(refl); }
|
||||
ResourceId module;
|
||||
ShaderReflection *refl;
|
||||
ShaderBindpointMapping *mapping;
|
||||
};
|
||||
Shader shaders[6];
|
||||
|
||||
// VkPipelineVertexInputStateCreateInfo
|
||||
struct Binding
|
||||
@@ -106,16 +114,18 @@ struct VulkanCreationInfo
|
||||
VkCullModeFlags cullMode;
|
||||
VkFrontFace frontFace;
|
||||
bool depthBiasEnable;
|
||||
float depthBias;
|
||||
float depthBiasConstantFactor;
|
||||
float depthBiasClamp;
|
||||
float slopeScaledDepthBias;
|
||||
float depthBiasSlopeFactor;
|
||||
float lineWidth;
|
||||
|
||||
// VkPipelineMultisampleStateCreateInfo
|
||||
uint32_t rasterSamples;
|
||||
uint32_t rasterizationSamples;
|
||||
bool sampleShadingEnable;
|
||||
float minSampleShading;
|
||||
VkSampleMask sampleMask;
|
||||
bool alphaToCoverageEnable;
|
||||
bool alphaToOneEnable;
|
||||
|
||||
// VkPipelineDepthStencilStateCreateInfo
|
||||
bool depthTestEnable;
|
||||
@@ -129,8 +139,6 @@ struct VulkanCreationInfo
|
||||
float maxDepthBounds;
|
||||
|
||||
// VkPipelineColorBlendStateCreateInfo
|
||||
bool alphaToCoverageEnable;
|
||||
bool alphaToOneEnable;
|
||||
bool logicOpEnable;
|
||||
VkLogicOp logicOp;
|
||||
float blendConst[4];
|
||||
@@ -242,7 +250,7 @@ struct VulkanCreationInfo
|
||||
VkImageType type;
|
||||
VkFormat format;
|
||||
VkExtent3D extent;
|
||||
int arraySize, mipLevels, samples;
|
||||
int arrayLayers, mipLevels, samples;
|
||||
|
||||
bool cube;
|
||||
uint32_t creationFlags;
|
||||
@@ -255,7 +263,7 @@ struct VulkanCreationInfo
|
||||
|
||||
VkFilter magFilter;
|
||||
VkFilter minFilter;
|
||||
VkSamplerMipmapMode mipMode;
|
||||
VkSamplerMipmapMode mipmapMode;
|
||||
VkSamplerAddressMode address[3];
|
||||
float mipLodBias;
|
||||
float maxAnisotropy;
|
||||
@@ -283,7 +291,7 @@ struct VulkanCreationInfo
|
||||
void Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info, const VkShaderModuleCreateInfo* pCreateInfo);
|
||||
|
||||
SPVModule spirv;
|
||||
ShaderReflection reflTemplate;
|
||||
ShaderReflection refl;
|
||||
ShaderBindpointMapping mapping;
|
||||
};
|
||||
map<ResourceId, ShaderModule> m_ShaderModule;
|
||||
|
||||
@@ -1400,7 +1400,7 @@ bool WrappedVulkan::Serialise_InitialState(WrappedVkRes *res)
|
||||
m_CreationInfo.m_Image[liveim->id].format,
|
||||
m_CreationInfo.m_Image[liveim->id].extent,
|
||||
(uint32_t)m_CreationInfo.m_Image[liveim->id].mipLevels,
|
||||
(uint32_t)m_CreationInfo.m_Image[liveim->id].arraySize,
|
||||
(uint32_t)m_CreationInfo.m_Image[liveim->id].arrayLayers,
|
||||
(uint32_t)m_CreationInfo.m_Image[liveim->id].samples,
|
||||
VK_IMAGE_TILING_OPTIMAL, // make this optimal since the format/etc is more likely supported as optimal
|
||||
VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT|VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT,
|
||||
@@ -1847,16 +1847,16 @@ void WrappedVulkan::Apply_InitialState(WrappedVkRes *live, VulkanResourceManager
|
||||
0, 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL,
|
||||
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
|
||||
ToHandle<VkImage>(live),
|
||||
{ aspectFlags, 0, 1, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize }
|
||||
{ aspectFlags, 0, 1, 0, (uint32_t)m_CreationInfo.m_Image[id].arrayLayers }
|
||||
};
|
||||
|
||||
// loop over every mip
|
||||
for(int m=0; m < m_CreationInfo.m_Image[id].mipLevels; m++)
|
||||
{
|
||||
VkImageCopy region = {
|
||||
{ aspect, (uint32_t)m, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize },
|
||||
{ aspect, (uint32_t)m, 0, (uint32_t)m_CreationInfo.m_Image[id].arrayLayers },
|
||||
{ 0, 0, 0 },
|
||||
{ aspect, (uint32_t)m, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize },
|
||||
{ aspect, (uint32_t)m, 0, (uint32_t)m_CreationInfo.m_Image[id].arrayLayers },
|
||||
{ 0, 0, 0 },
|
||||
extent,
|
||||
};
|
||||
|
||||
@@ -659,7 +659,7 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id)
|
||||
|
||||
FetchTexture ret;
|
||||
ret.ID = m_pDriver->GetResourceManager()->GetOriginalID(id);
|
||||
ret.arraysize = iminfo.arraySize;
|
||||
ret.arraysize = iminfo.arrayLayers;
|
||||
ret.creationFlags = iminfo.creationFlags;
|
||||
ret.cubemap = iminfo.cube;
|
||||
ret.width = iminfo.extent.width;
|
||||
@@ -681,13 +681,13 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id)
|
||||
switch(iminfo.type)
|
||||
{
|
||||
case VK_IMAGE_TYPE_1D:
|
||||
ret.resType = iminfo.arraySize > 1 ? eResType_Texture1DArray : eResType_Texture1D;
|
||||
ret.resType = iminfo.arrayLayers > 1 ? eResType_Texture1DArray : eResType_Texture1D;
|
||||
ret.dimension = 1;
|
||||
break;
|
||||
case VK_IMAGE_TYPE_2D:
|
||||
if(ret.msSamp > 1) ret.resType = iminfo.arraySize > 1 ? eResType_Texture2DMSArray : eResType_Texture2DMS;
|
||||
else if(ret.cubemap) ret.resType = iminfo.arraySize > 6 ? eResType_TextureCubeArray : eResType_TextureCube;
|
||||
else ret.resType = iminfo.arraySize > 1 ? eResType_Texture2DArray : eResType_Texture2D;
|
||||
if(ret.msSamp > 1) ret.resType = iminfo.arrayLayers > 1 ? eResType_Texture2DMSArray : eResType_Texture2DMS;
|
||||
else if(ret.cubemap) ret.resType = iminfo.arrayLayers > 6 ? eResType_TextureCubeArray : eResType_TextureCube;
|
||||
else ret.resType = iminfo.arrayLayers > 1 ? eResType_Texture2DArray : eResType_Texture2D;
|
||||
ret.dimension = 2;
|
||||
break;
|
||||
case VK_IMAGE_TYPE_3D:
|
||||
@@ -2675,7 +2675,7 @@ void VulkanReplay::SavePipelineState()
|
||||
}
|
||||
|
||||
// Rasterizer
|
||||
m_VulkanPipelineState.RS.depthClipEnable = p.depthClipEnable;
|
||||
m_VulkanPipelineState.RS.depthClampEnable = p.depthClampEnable;
|
||||
m_VulkanPipelineState.RS.rasterizerDiscardEnable = p.rasterizerDiscardEnable;
|
||||
m_VulkanPipelineState.RS.FrontCCW = p.frontFace == VK_FRONT_FACE_CCW;
|
||||
|
||||
@@ -2708,7 +2708,7 @@ void VulkanReplay::SavePipelineState()
|
||||
m_VulkanPipelineState.RS.lineWidth = state.lineWidth;
|
||||
|
||||
// MSAA
|
||||
m_VulkanPipelineState.MSAA.rasterSamples = p.rasterSamples;
|
||||
m_VulkanPipelineState.MSAA.rasterSamples = p.rasterizationSamples;
|
||||
m_VulkanPipelineState.MSAA.sampleShadingEnable = p.sampleShadingEnable;
|
||||
m_VulkanPipelineState.MSAA.minSampleShading = p.minSampleShading;
|
||||
m_VulkanPipelineState.MSAA.sampleMask = p.sampleMask;
|
||||
@@ -2881,7 +2881,7 @@ void VulkanReplay::SavePipelineState()
|
||||
// sampler info
|
||||
el.mag = ToStr::Get(sampl.magFilter);
|
||||
el.min = ToStr::Get(sampl.minFilter);
|
||||
el.mip = ToStr::Get(sampl.mipMode);
|
||||
el.mip = ToStr::Get(sampl.mipmapMode);
|
||||
el.addrU = ToStr::Get(sampl.address[0]);
|
||||
el.addrV = ToStr::Get(sampl.address[1]);
|
||||
el.addrW = ToStr::Get(sampl.address[2]);
|
||||
@@ -3349,7 +3349,7 @@ bool VulkanReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip,
|
||||
|
||||
data->HistogramTextureResolution.x = (float)RDCMAX(uint32_t(iminfo.extent.width)>>mip, 1U);
|
||||
data->HistogramTextureResolution.y = (float)RDCMAX(uint32_t(iminfo.extent.height)>>mip, 1U);
|
||||
data->HistogramTextureResolution.z = (float)RDCMAX(uint32_t(iminfo.arraySize)>>mip, 1U);
|
||||
data->HistogramTextureResolution.z = (float)RDCMAX(uint32_t(iminfo.arrayLayers)>>mip, 1U);
|
||||
data->HistogramSlice = (float)sliceFace;
|
||||
data->HistogramMip = (int)mip;
|
||||
data->HistogramNumSamples = iminfo.samples;
|
||||
@@ -3556,7 +3556,7 @@ bool VulkanReplay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t m
|
||||
|
||||
data->HistogramTextureResolution.x = (float)RDCMAX(uint32_t(iminfo.extent.width)>>mip, 1U);
|
||||
data->HistogramTextureResolution.y = (float)RDCMAX(uint32_t(iminfo.extent.height)>>mip, 1U);
|
||||
data->HistogramTextureResolution.z = (float)RDCMAX(uint32_t(iminfo.arraySize)>>mip, 1U);
|
||||
data->HistogramTextureResolution.z = (float)RDCMAX(uint32_t(iminfo.arrayLayers)>>mip, 1U);
|
||||
data->HistogramSlice = (float)sliceFace;
|
||||
data->HistogramMip = (int)mip;
|
||||
data->HistogramNumSamples = iminfo.samples;
|
||||
@@ -3715,7 +3715,7 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m
|
||||
VkImageCreateInfo imCreateInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, NULL,
|
||||
imInfo.type, imInfo.format, imInfo.extent,
|
||||
imInfo.mipLevels, imInfo.arraySize, imInfo.samples,
|
||||
imInfo.mipLevels, imInfo.arrayLayers, imInfo.samples,
|
||||
VK_IMAGE_TILING_OPTIMAL,
|
||||
VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT|VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT,
|
||||
0, VK_SHARING_MODE_EXCLUSIVE, 0, NULL,
|
||||
|
||||
@@ -911,9 +911,9 @@ bool WrappedVulkan::Serialise_vkCmdBindPipeline(
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[liveid].dynamicStates[VK_DYNAMIC_STATE_DEPTH_BIAS])
|
||||
{
|
||||
m_RenderState.bias.depth = m_CreationInfo.m_Pipeline[liveid].depthBias;
|
||||
m_RenderState.bias.depth = m_CreationInfo.m_Pipeline[liveid].depthBiasConstantFactor;
|
||||
m_RenderState.bias.biasclamp = m_CreationInfo.m_Pipeline[liveid].depthBiasClamp;
|
||||
m_RenderState.bias.slope = m_CreationInfo.m_Pipeline[liveid].slopeScaledDepthBias;
|
||||
m_RenderState.bias.slope = m_CreationInfo.m_Pipeline[liveid].depthBiasSlopeFactor;
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[liveid].dynamicStates[VK_DYNAMIC_STATE_BLEND_CONSTANTS])
|
||||
{
|
||||
|
||||
@@ -262,7 +262,7 @@ bool WrappedVulkan::Serialise_vkCreateSwapchainKHR(
|
||||
iminfo.extent.height = info.imageExtent.height;
|
||||
iminfo.extent.depth = 1;
|
||||
iminfo.mipLevels = 1;
|
||||
iminfo.arraySize = info.imageArraySize;
|
||||
iminfo.arrayLayers = info.imageArraySize;
|
||||
iminfo.creationFlags = eTextureCreate_SRV|eTextureCreate_RTV|eTextureCreate_SwapBuffer;
|
||||
iminfo.cube = false;
|
||||
iminfo.samples = 1;
|
||||
|
||||
Reference in New Issue
Block a user