mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Implement Maxwell3D Color Logic Operations
Implements a basic part of Vulkan blending state which are color logic operations applied on the framebuffer after running the fragment shader. It is an optional feature in Vulkan and not supported on any mobile GPU vendor aside from ImgTec/NVIDIA by default.
This commit is contained in:
@ -479,5 +479,57 @@ namespace skyline::gpu::interconnect {
|
||||
void SetDepthBiasSlopeFactor(float factor) {
|
||||
rasterizerState.get<vk::PipelineRasterizationStateCreateInfo>().depthBiasSlopeFactor = factor;
|
||||
}
|
||||
|
||||
/* Color Blending */
|
||||
private:
|
||||
vk::PipelineColorBlendStateCreateInfo blendState{};
|
||||
|
||||
public:
|
||||
void SetBlendLogicOpEnable(bool enabled) {
|
||||
if (!gpu.quirks.supportsLogicOp && enabled) {
|
||||
Logger::Warn("Cannot enable framebuffer logical operation without host GPU support");
|
||||
return;
|
||||
}
|
||||
blendState.logicOpEnable = enabled;
|
||||
}
|
||||
|
||||
void SetBlendLogicOpType(maxwell3d::ColorLogicOp logicOp) {
|
||||
blendState.logicOp = [logicOp]() {
|
||||
switch (logicOp) {
|
||||
case maxwell3d::ColorLogicOp::Clear:
|
||||
return vk::LogicOp::eClear;
|
||||
case maxwell3d::ColorLogicOp::And:
|
||||
return vk::LogicOp::eAnd;
|
||||
case maxwell3d::ColorLogicOp::AndReverse:
|
||||
return vk::LogicOp::eAndReverse;
|
||||
case maxwell3d::ColorLogicOp::Copy:
|
||||
return vk::LogicOp::eCopy;
|
||||
case maxwell3d::ColorLogicOp::AndInverted:
|
||||
return vk::LogicOp::eAndInverted;
|
||||
case maxwell3d::ColorLogicOp::Noop:
|
||||
return vk::LogicOp::eNoOp;
|
||||
case maxwell3d::ColorLogicOp::Xor:
|
||||
return vk::LogicOp::eXor;
|
||||
case maxwell3d::ColorLogicOp::Or:
|
||||
return vk::LogicOp::eOr;
|
||||
case maxwell3d::ColorLogicOp::Nor:
|
||||
return vk::LogicOp::eNor;
|
||||
case maxwell3d::ColorLogicOp::Equiv:
|
||||
return vk::LogicOp::eEquivalent;
|
||||
case maxwell3d::ColorLogicOp::Invert:
|
||||
return vk::LogicOp::eInvert;
|
||||
case maxwell3d::ColorLogicOp::OrReverse:
|
||||
return vk::LogicOp::eOrReverse;
|
||||
case maxwell3d::ColorLogicOp::CopyInverted:
|
||||
return vk::LogicOp::eCopyInverted;
|
||||
case maxwell3d::ColorLogicOp::OrInverted:
|
||||
return vk::LogicOp::eOrInverted;
|
||||
case maxwell3d::ColorLogicOp::Nand:
|
||||
return vk::LogicOp::eNand;
|
||||
case maxwell3d::ColorLogicOp::Set:
|
||||
return vk::LogicOp::eSet;
|
||||
}
|
||||
}();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "quirk_manager.h"
|
||||
|
||||
namespace skyline {
|
||||
QuirkManager::QuirkManager(vk::PhysicalDeviceProperties properties, vk::PhysicalDeviceFeatures2 features, const std::vector<vk::ExtensionProperties> &extensions) {
|
||||
QuirkManager::QuirkManager(vk::PhysicalDeviceProperties properties, vk::PhysicalDeviceFeatures2 features2, const std::vector<vk::ExtensionProperties> &extensions) {
|
||||
for (auto &extension : extensions) {
|
||||
#define EXT_SET(name, property) \
|
||||
case util::Hash(name): \
|
||||
@ -27,5 +27,7 @@ namespace skyline {
|
||||
#undef EXT_SET
|
||||
#undef EXT_SET_V
|
||||
}
|
||||
|
||||
supportsLogicOp = features2.features.logicOp;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace skyline {
|
||||
class QuirkManager {
|
||||
public:
|
||||
bool supportsLastProvokingVertex{}; //!< If the device supports setting the last vertex as the provoking vertex (with VK_EXT_provoking_vertex)
|
||||
bool supportsLogicOp{}; //!< If the device supports framebuffer logical operations during blending
|
||||
|
||||
QuirkManager() = default;
|
||||
|
||||
|
Reference in New Issue
Block a user