Skip to content

Commit

Permalink
Flag shader blending as broken on Adreno for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Sep 16, 2022
1 parent 5f5277a commit 262a306
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 13 deletions.
10 changes: 9 additions & 1 deletion Common/GPU/Vulkan/thin3d_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,6 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
caps_.textureNPOTFullySupported = true;
caps_.fragmentShaderDepthWriteSupported = true;
caps_.logicOpSupported = vulkan->GetDeviceFeatures().enabled.logicOp != 0;
caps_.framebufferFetchSupported = true; // Limited, through input attachments and self-dependencies.

auto deviceProps = vulkan->GetPhysicalDeviceProperties(vulkan_->GetCurrentPhysicalDeviceIndex()).properties;
switch (deviceProps.vendorID) {
Expand All @@ -813,6 +812,11 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
// Color write mask not masking write in certain scenarios with a depth test, see #10421.
// Known still present on driver 0x80180000 and Adreno 5xx (possibly more.)
bugs_.Infest(Bugs::COLORWRITEMASK_BROKEN_WITH_DEPTHTEST);

// Trying to follow all the rules in https://registry.khronos.org/vulkan/specs/1.3/html/vkspec.html#synchronization-pipeline-barriers-subpass-self-dependencies
// and https://registry.khronos.org/vulkan/specs/1.3/html/vkspec.html#renderpass-feedbackloop, but still it doesn't
// quite work - artifacts on triangle boundaries on Adreno.
bugs_.Infest(Bugs::SUBPASS_FEEDBACK_BROKEN);
} else if (caps_.vendor == GPUVendor::VENDOR_AMD) {
// See issue #10074, and also #10065 (AMD) and #10109 for the choice of the driver version to check for.
if (deviceProps.driverVersion < 0x00407000) {
Expand All @@ -839,6 +843,10 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
}
}

// Limited, through input attachments and self-dependencies.
// We turn it off here already if buggy.
caps_.framebufferFetchSupported = !bugs_.Has(Bugs::SUBPASS_FEEDBACK_BROKEN);

caps_.deviceID = deviceProps.deviceID;
device_ = vulkan->GetDevice();

Expand Down
1 change: 1 addition & 0 deletions Common/GPU/thin3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ const char *Bugs::GetBugName(uint32_t bug) {
case MALI_STENCIL_DISCARD_BUG: return "MALI_STENCIL_DISCARD_BUG";
case RASPBERRY_SHADER_COMP_HANG: return "RASPBERRY_SHADER_COMP_HANG";
case MALI_CONSTANT_LOAD_BUG: return "MALI_CONSTANT_LOAD_BUG";
case SUBPASS_FEEDBACK_BROKEN: return "SUBPASS_FEEDBACK_BROKEN";
default: return "(N/A)";
}
}
Expand Down
1 change: 1 addition & 0 deletions Common/GPU/thin3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class Bugs {
MALI_STENCIL_DISCARD_BUG = 8,
RASPBERRY_SHADER_COMP_HANG = 9,
MALI_CONSTANT_LOAD_BUG = 10,
SUBPASS_FEEDBACK_BROKEN = 11,
MAX_BUG,
};

Expand Down
6 changes: 3 additions & 3 deletions Common/UI/UIScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class SliderPopupScreen : public PopupScreen {
disabled_ = *value_ < 0;
}

const char *tag() const { return "SliderPopup"; }
const char *tag() const override { return "SliderPopup"; }

Event OnChange;

Expand Down Expand Up @@ -216,7 +216,7 @@ class SliderFloatPopupScreen : public PopupScreen {
: PopupScreen(title, "OK", "Cancel"), units_(units), value_(value), originalValue_(*value), minValue_(minValue), maxValue_(maxValue), step_(step), changing_(false), liveUpdate_(liveUpdate) {}
void CreatePopupContents(UI::ViewGroup *parent) override;

const char *tag() const { return "SliderFloatPopup"; }
const char *tag() const override { return "SliderFloatPopup"; }

Event OnChange;

Expand Down Expand Up @@ -245,7 +245,7 @@ class TextEditPopupScreen : public PopupScreen {
: PopupScreen(title, "OK", "Cancel"), value_(value), placeholder_(placeholder), maxLen_(maxLen) {}
virtual void CreatePopupContents(ViewGroup *parent) override;

const char *tag() const { return "TextEditPopup"; }
const char *tag() const override { return "TextEditPopup"; }

Event OnChange;

Expand Down
10 changes: 4 additions & 6 deletions GPU/D3D11/StateMappingD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,21 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
// We ignore the logicState on D3D since there's no support, the emulation of it is blend-and-shader only.

if (pipelineState_.FramebufferRead()) {
FBOTexState fboTexBindState_ = FBO_TEX_NONE;
ApplyFramebufferRead(&fboTexBindState_);
FBOTexState fboTexBindState = FBO_TEX_NONE;
ApplyFramebufferRead(&fboTexBindState);
// The shader takes over the responsibility for blending, so recompute.
ApplyStencilReplaceAndLogicOpIgnoreBlend(blendState.replaceAlphaWithStencil, blendState);

if (fboTexBindState_ == FBO_TEX_COPY_BIND_TEX) {
if (fboTexBindState == FBO_TEX_COPY_BIND_TEX) {
framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY);
// No sampler required, we do a plain Load in the pixel shader.
fboTexBound_ = true;
fboTexBindState_ = FBO_TEX_NONE;
fboTexBindState = FBO_TEX_NONE;

framebufferManager_->RebindFramebuffer("RebindFramebuffer - ApplyDrawState");
// Must dirty blend state here so we re-copy next time. Example: Lunar's spell effects.
dirtyRequiresRecheck_ |= DIRTY_BLEND_STATE;
gstate_c.Dirty(DIRTY_BLEND_STATE);
} else if (fboTexBindState_ == FBO_TEX_READ_FRAMEBUFFER) {
fboTexBindState_ = FBO_TEX_NONE;
}

dirtyRequiresRecheck_ |= DIRTY_FRAGMENTSHADER_STATE;
Expand Down
1 change: 1 addition & 0 deletions GPU/Vulkan/DrawEngineVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ VkDescriptorSet DrawEngineVulkan::GetOrCreateDescriptorSet(VkImageView imageView
key.base_ = base;
key.light_ = light;
key.bone_ = bone;
key.secondaryIsInputAttachment = boundSecondaryIsInputAttachment_;

FrameData &frame = GetCurFrame();
// See if we already have this descriptor set cached.
Expand Down
2 changes: 2 additions & 0 deletions GPU/Vulkan/DrawEngineVulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ class DrawEngineVulkan : public DrawEngineCommon {

// Secondary texture for shader blending
VkImageView boundSecondary_ = VK_NULL_HANDLE;
bool boundSecondaryIsInputAttachment_ = false;

// CLUT texture for shader depal
VkImageView boundDepal_ = VK_NULL_HANDLE;
bool boundDepalSmoothed_ = false;
Expand Down
6 changes: 4 additions & 2 deletions GPU/Vulkan/GPU_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ void GPU_Vulkan::CheckGPUFeatures() {
features |= GPU_SUPPORTS_TEXTURE_FLOAT;
features |= GPU_SUPPORTS_DEPTH_TEXTURE;

// input attachments
features |= GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH;
// through input attachments, when not broken.
if (draw_->GetDeviceCaps().framebufferFetchSupported) {
features |= GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH;
}

auto &enabledFeatures = vulkan->GetDeviceFeatures().enabled;
if (enabledFeatures.depthClamp) {
Expand Down
4 changes: 4 additions & 0 deletions GPU/Vulkan/StateMappingVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ void DrawEngineVulkan::BindShaderBlendTex() {
bool bindResult = framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY);
_dbg_assert_(bindResult);
boundSecondary_ = (VkImageView)draw_->GetNativeObject(Draw::NativeObject::BOUND_TEXTURE1_IMAGEVIEW);
boundSecondaryIsInputAttachment_ = false;
fboTexBound_ = true;
fboTexBindState_ = FBO_TEX_NONE;

Expand All @@ -376,7 +377,10 @@ void DrawEngineVulkan::BindShaderBlendTex() {
} else if (fboTexBindState_ == FBO_TEX_READ_FRAMEBUFFER) {
draw_->BindCurrentFramebufferForColorInput();
boundSecondary_ = (VkImageView)draw_->GetNativeObject(Draw::NativeObject::BOUND_FRAMEBUFFER_COLOR_IMAGEVIEW);
boundSecondaryIsInputAttachment_ = true;
fboTexBindState_ = FBO_TEX_NONE;
} else {
boundSecondary_ = VK_NULL_HANDLE;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion UI/InstallZipScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class InstallZipScreen : public UIDialogScreenWithBackground {
virtual void update() override;
virtual bool key(const KeyInput &key) override;

const char *tag() const { return "install_zip"; }
const char *tag() const override { return "install_zip"; }

protected:
virtual void CreateViews() override;
Expand Down

0 comments on commit 262a306

Please sign in to comment.