Merge pull request #8720 from unknownbrackets/tex-range

Move texture decode/hash to after vertex decode
This commit is contained in:
Henrik Rydgård committed 2016-05-07 22:15:19 +02:00
commit 2c84411426
9 files changed
+633 -433

No files matched your search

+19 -8
View File
@@ -591,8 +591,6 @@ void DrawEngineVulkan::DirtyAllUBOs() {
if (!gstate.isModeClear()) {
// TODO: Test texture?
textureCache_->ApplyTexture();
if (fboTexNeedBind_) {
// Note that this is positions, not UVs, that we need the copy from.
framebufferManager_->BindFramebufferColor(1, nullptr, BINDFBCOLOR_MAY_COPY);
@@ -612,19 +610,16 @@ void DrawEngineVulkan::DoFlush(VkCommandBuffer cmd) {
FrameData *frame = &frame_[curFrame_ & 1];
bool textureNeedsApply = false;
if (gstate_c.textureChanged != TEXCHANGE_UNCHANGED && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
textureCache_->SetTexture(frame->pushUBO);
textureCache_->SetTexture();
textureNeedsApply = true;
gstate_c.textureChanged = TEXCHANGE_UNCHANGED;
if (gstate_c.needShaderTexClamp) {
// We will rarely need to set this, so let's do it every time on use rather than in runloop.
// Most of the time non-framebuffer textures will be used which can be clamped themselves.
shaderManager_->DirtyUniform(DIRTY_TEXCLAMP);
}
textureCache_->ApplyTexture(imageView, sampler);
if (imageView == VK_NULL_HANDLE)
imageView = nullTexture_->GetImageView();
if (sampler == VK_NULL_HANDLE)
sampler = nullSampler_;
}
GEPrimitiveType prim = prevPrim_;
@@ -661,6 +656,14 @@ void DrawEngineVulkan::DoFlush(VkCommandBuffer cmd) {
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && ((hasColor && (gstate.materialupdate & 1)) || gstate.getMaterialAmbientA() == 255) && (!gstate.isLightingEnabled() || gstate.getAmbientA() == 255);
}
if (textureNeedsApply) {
textureCache_->ApplyTexture(frame->pushUBO, imageView, sampler);
if (imageView == VK_NULL_HANDLE)
imageView = nullTexture_->GetImageView();
if (sampler == VK_NULL_HANDLE)
sampler = nullSampler_;
}
VulkanPipelineRasterStateKey pipelineKey;
VulkanDynamicState dynState;
ConvertStateToVulkanKey(*framebufferManager_, shaderManager_, prim, pipelineKey, dynState);
@@ -753,6 +756,14 @@ void DrawEngineVulkan::DoFlush(VkCommandBuffer cmd) {
// Only here, where we know whether to clear or to draw primitives, should we actually set the current framebuffer! Because that gives use the opportunity
// to use a "pre-clear" render pass, for high efficiency on tilers.
if (result.action == SW_DRAW_PRIMITIVES) {
if (textureNeedsApply) {
textureCache_->ApplyTexture(frame->pushUBO, imageView, sampler);
if (imageView == VK_NULL_HANDLE)
imageView = nullTexture_->GetImageView();
if (sampler == VK_NULL_HANDLE)
sampler = nullSampler_;
}
VulkanPipelineRasterStateKey pipelineKey;
VulkanDynamicState dynState;
ConvertStateToVulkanKey(*framebufferManager_, shaderManager_, prim, pipelineKey, dynState);