mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 00:35:29 +03:00
Add blend, scissor, viewport and vertex state to shader hash
These caused a ton of additional comparisons in Zelda Link's Awakening as many shaders would have the same hash.
This commit is contained in:
parent
e6cfdeb06a
commit
e816256220
@ -57,6 +57,22 @@ namespace skyline::gpu::cache {
|
|||||||
auto &vertexInputState{key.VertexInputState()};
|
auto &vertexInputState{key.VertexInputState()};
|
||||||
HASH(vertexInputState.vertexBindingDescriptionCount);
|
HASH(vertexInputState.vertexBindingDescriptionCount);
|
||||||
HASH(vertexInputState.vertexAttributeDescriptionCount);
|
HASH(vertexInputState.vertexAttributeDescriptionCount);
|
||||||
|
HASH(static_cast<VkFlags>(vertexInputState.flags));
|
||||||
|
|
||||||
|
for (size_t i{}; i < vertexInputState.vertexBindingDescriptionCount; i++) {
|
||||||
|
const auto &descr{vertexInputState.pVertexBindingDescriptions[i]};
|
||||||
|
HASH(descr.binding);
|
||||||
|
HASH(descr.stride);
|
||||||
|
HASH(static_cast<VkVertexInputRate>(descr.inputRate));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i{}; i < vertexInputState.vertexAttributeDescriptionCount; i++) {
|
||||||
|
const auto &descr{vertexInputState.pVertexAttributeDescriptions[i]};
|
||||||
|
HASH(descr.binding);
|
||||||
|
HASH(descr.offset);
|
||||||
|
HASH(descr.location);
|
||||||
|
HASH(static_cast<VkFormat>(descr.format));
|
||||||
|
}
|
||||||
|
|
||||||
if (key.vertexState.template isLinked<vk::PipelineVertexInputDivisorStateCreateInfoEXT>())
|
if (key.vertexState.template isLinked<vk::PipelineVertexInputDivisorStateCreateInfoEXT>())
|
||||||
HASH(key.VertexDivisorState().vertexBindingDivisorCount);
|
HASH(key.VertexDivisorState().vertexBindingDivisorCount);
|
||||||
@ -69,6 +85,24 @@ namespace skyline::gpu::cache {
|
|||||||
HASH(key.viewportState.viewportCount);
|
HASH(key.viewportState.viewportCount);
|
||||||
HASH(key.viewportState.scissorCount);
|
HASH(key.viewportState.scissorCount);
|
||||||
|
|
||||||
|
for (size_t i{}; i < key.viewportState.viewportCount; i++) {
|
||||||
|
const auto &viewport{key.viewportState.pViewports[i]};
|
||||||
|
HASH(viewport.x);
|
||||||
|
HASH(viewport.y);
|
||||||
|
HASH(viewport.width);
|
||||||
|
HASH(viewport.height);
|
||||||
|
HASH(viewport.minDepth);
|
||||||
|
HASH(viewport.maxDepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i{}; i < key.viewportState.scissorCount; i++) {
|
||||||
|
const auto &scissor{key.viewportState.pScissors[i]};
|
||||||
|
HASH(scissor.offset.x);
|
||||||
|
HASH(scissor.offset.y);
|
||||||
|
HASH(scissor.extent.width);
|
||||||
|
HASH(scissor.extent.height);
|
||||||
|
}
|
||||||
|
|
||||||
auto &rasterizationState{key.RasterizationState()};
|
auto &rasterizationState{key.RasterizationState()};
|
||||||
HASH(rasterizationState.depthClampEnable);
|
HASH(rasterizationState.depthClampEnable);
|
||||||
HASH(rasterizationState.rasterizerDiscardEnable);
|
HASH(rasterizationState.rasterizerDiscardEnable);
|
||||||
@ -116,6 +150,19 @@ namespace skyline::gpu::cache {
|
|||||||
HASH(key.colorBlendState.logicOp);
|
HASH(key.colorBlendState.logicOp);
|
||||||
HASH(key.colorBlendState.attachmentCount);
|
HASH(key.colorBlendState.attachmentCount);
|
||||||
|
|
||||||
|
for (size_t i{}; i < key.colorBlendState.attachmentCount; i++) {
|
||||||
|
const auto &attachment{key.colorBlendState.pAttachments[i]};
|
||||||
|
HASH(static_cast<VkBool32>(attachment.blendEnable));
|
||||||
|
|
||||||
|
HASH(static_cast<VkBlendOp>(attachment.alphaBlendOp));
|
||||||
|
HASH(static_cast<VkBlendOp>(attachment.colorBlendOp));
|
||||||
|
|
||||||
|
HASH(static_cast<VkBlendFactor>(attachment.dstAlphaBlendFactor));
|
||||||
|
HASH(static_cast<VkBlendFactor>(attachment.dstColorBlendFactor));
|
||||||
|
HASH(static_cast<VkBlendFactor>(attachment.srcAlphaBlendFactor));
|
||||||
|
HASH(static_cast<VkBlendFactor>(attachment.srcColorBlendFactor));
|
||||||
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user