mirror of https://git.suyu.dev/suyu/suyu
MacroHLE: Final cleanup and fixes.
This commit is contained in:
parent
581a7d785b
commit
d09aa0182f
|
@ -13,8 +13,8 @@ namespace Common {
|
||||||
template <typename KeyTBase, typename ValueT>
|
template <typename KeyTBase, typename ValueT>
|
||||||
class RangeMap {
|
class RangeMap {
|
||||||
private:
|
private:
|
||||||
using KeyT = std::conditional_t<std::is_signed_v<KeyTBase>, typename KeyTBase,
|
using KeyT =
|
||||||
std::make_signed_t<KeyTBase>>;
|
std::conditional_t<std::is_signed_v<KeyTBase>, KeyTBase, std::make_signed_t<KeyTBase>>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RangeMap(ValueT null_value_) : null_value{null_value_} {
|
explicit RangeMap(ValueT null_value_) : null_value{null_value_} {
|
||||||
|
@ -56,8 +56,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using MapType = std::map<KeyT, ValueT>;
|
using MapType = std::map<KeyT, ValueT>;
|
||||||
using IteratorType = MapType::iterator;
|
using IteratorType = typename MapType::iterator;
|
||||||
using ConstIteratorType = MapType::const_iterator;
|
using ConstIteratorType = typename MapType::const_iterator;
|
||||||
|
|
||||||
size_t ContinousSizeInternal(KeyT address) const {
|
size_t ContinousSizeInternal(KeyT address) const {
|
||||||
const auto it = GetFirstElemnentBeforeOrOn(address);
|
const auto it = GetFirstElemnentBeforeOrOn(address);
|
||||||
|
|
|
@ -36,8 +36,8 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] virtual bool HasHLEMacroState() const = 0;
|
[[nodiscard]] virtual bool HasHLEMacroState() const = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual std::optional<ReplaceConstant> GetReplaceConstBuffer(
|
[[nodiscard]] virtual std::optional<ReplaceConstant> GetReplaceConstBuffer(u32 bank,
|
||||||
u32 bank, u32 offset) = 0;
|
u32 offset) = 0;
|
||||||
|
|
||||||
virtual void Dump(u64 hash) = 0;
|
virtual void Dump(u64 hash) = 0;
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,8 @@ public:
|
||||||
/// Return true when a CPU region is modified from the CPU
|
/// Return true when a CPU region is modified from the CPU
|
||||||
[[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size);
|
[[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size);
|
||||||
|
|
||||||
void SetDrawIndirect(const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect_) {
|
void SetDrawIndirect(
|
||||||
|
const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect_) {
|
||||||
current_draw_indirect = current_draw_indirect_;
|
current_draw_indirect = current_draw_indirect_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,8 @@ void DrawManager::DrawArrayIndirect(PrimitiveTopology topology) {
|
||||||
ProcessDrawIndirect(true);
|
ProcessDrawIndirect(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_first, u32 index_count) {
|
void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_first,
|
||||||
|
u32 index_count) {
|
||||||
const auto& regs{maxwell3d->regs};
|
const auto& regs{maxwell3d->regs};
|
||||||
draw_state.topology = topology;
|
draw_state.topology = topology;
|
||||||
draw_state.index_buffer = regs.index_buffer;
|
draw_state.index_buffer = regs.index_buffer;
|
||||||
|
|
|
@ -47,21 +47,7 @@ public:
|
||||||
explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {}
|
explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void advanceCheck() {
|
|
||||||
current_value = (current_value + 1) % fibonacci_post;
|
|
||||||
check_limit = current_value == 0;
|
|
||||||
if (check_limit) {
|
|
||||||
const u32 new_fibonacci = fibonacci_pre + fibonacci_post;
|
|
||||||
fibonacci_pre = fibonacci_post;
|
|
||||||
fibonacci_post = new_fibonacci;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Engines::Maxwell3D& maxwell3d;
|
Engines::Maxwell3D& maxwell3d;
|
||||||
u32 fibonacci_pre{89};
|
|
||||||
u32 fibonacci_post{144};
|
|
||||||
u32 current_value{fibonacci_post - 1};
|
|
||||||
bool check_limit{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HLE_771BB18C62444DA0 final : public HLEMacroImpl {
|
class HLE_771BB18C62444DA0 final : public HLEMacroImpl {
|
||||||
|
@ -124,12 +110,13 @@ private:
|
||||||
maxwell3d.RefreshParameters();
|
maxwell3d.RefreshParameters();
|
||||||
const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
|
const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
|
||||||
|
|
||||||
|
auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[0]);
|
||||||
const u32 vertex_first = parameters[3];
|
const u32 vertex_first = parameters[3];
|
||||||
const u32 vertex_count = parameters[1];
|
const u32 vertex_count = parameters[1];
|
||||||
|
|
||||||
|
if (!IsTopologySafe(topology) &&
|
||||||
if (maxwell3d.AnyParametersDirty() &&
|
static_cast<size_t>(maxwell3d.GetMaxCurrentVertices()) <
|
||||||
maxwell3d.GetMaxCurrentVertices() < vertex_first + vertex_count) {
|
static_cast<size_t>(vertex_first) + static_cast<size_t>(vertex_count)) {
|
||||||
ASSERT_MSG(false, "Faulty draw!");
|
ASSERT_MSG(false, "Faulty draw!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -141,9 +128,8 @@ private:
|
||||||
maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance);
|
maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
maxwell3d.draw_manager->DrawArray(
|
maxwell3d.draw_manager->DrawArray(topology, vertex_first, vertex_count, base_instance,
|
||||||
static_cast<Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology>(parameters[0]),
|
instance_count);
|
||||||
vertex_first, vertex_count, base_instance, instance_count);
|
|
||||||
|
|
||||||
if (extended) {
|
if (extended) {
|
||||||
maxwell3d.regs.global_base_instance_index = 0;
|
maxwell3d.regs.global_base_instance_index = 0;
|
||||||
|
@ -166,13 +152,7 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
advanceCheck();
|
|
||||||
if (check_limit) {
|
|
||||||
maxwell3d.RefreshParameters();
|
|
||||||
minimum_limit = std::max(parameters[3], minimum_limit);
|
|
||||||
}
|
|
||||||
const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize());
|
const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize());
|
||||||
const u32 base_size = std::max<u32>(minimum_limit, estimate);
|
|
||||||
const u32 element_base = parameters[4];
|
const u32 element_base = parameters[4];
|
||||||
const u32 base_instance = parameters[5];
|
const u32 base_instance = parameters[5];
|
||||||
maxwell3d.regs.vertex_id_base = element_base;
|
maxwell3d.regs.vertex_id_base = element_base;
|
||||||
|
@ -191,7 +171,7 @@ public:
|
||||||
params.max_draw_counts = 1;
|
params.max_draw_counts = 1;
|
||||||
params.stride = 0;
|
params.stride = 0;
|
||||||
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
||||||
maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size);
|
maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate);
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
maxwell3d.regs.vertex_id_base = 0x0;
|
maxwell3d.regs.vertex_id_base = 0x0;
|
||||||
|
@ -223,8 +203,6 @@ private:
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 minimum_limit{1 << 18};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HLE_MultiLayerClear final : public HLEMacroImpl {
|
class HLE_MultiLayerClear final : public HLEMacroImpl {
|
||||||
|
@ -257,10 +235,6 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
advanceCheck();
|
|
||||||
if (check_limit) {
|
|
||||||
maxwell3d.RefreshParameters();
|
|
||||||
}
|
|
||||||
const u32 start_indirect = parameters[0];
|
const u32 start_indirect = parameters[0];
|
||||||
const u32 end_indirect = parameters[1];
|
const u32 end_indirect = parameters[1];
|
||||||
if (start_indirect >= end_indirect) {
|
if (start_indirect >= end_indirect) {
|
||||||
|
@ -274,20 +248,7 @@ public:
|
||||||
const u32 indirect_words = 5 + padding;
|
const u32 indirect_words = 5 + padding;
|
||||||
const u32 stride = indirect_words * sizeof(u32);
|
const u32 stride = indirect_words * sizeof(u32);
|
||||||
const std::size_t draw_count = end_indirect - start_indirect;
|
const std::size_t draw_count = end_indirect - start_indirect;
|
||||||
u32 lowest_first = std::numeric_limits<u32>::max();
|
|
||||||
u32 highest_limit = std::numeric_limits<u32>::min();
|
|
||||||
for (std::size_t index = 0; index < draw_count; index++) {
|
|
||||||
const std::size_t base = index * indirect_words + 5;
|
|
||||||
const u32 count = parameters[base];
|
|
||||||
const u32 first_index = parameters[base + 2];
|
|
||||||
lowest_first = std::min(lowest_first, first_index);
|
|
||||||
highest_limit = std::max(highest_limit, first_index + count);
|
|
||||||
}
|
|
||||||
if (check_limit) {
|
|
||||||
minimum_limit = std::max(highest_limit, minimum_limit);
|
|
||||||
}
|
|
||||||
const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize());
|
const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize());
|
||||||
const u32 base_size = std::max(minimum_limit, estimate);
|
|
||||||
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
||||||
auto& params = maxwell3d.draw_manager->GetIndirectParams();
|
auto& params = maxwell3d.draw_manager->GetIndirectParams();
|
||||||
params.is_indexed = true;
|
params.is_indexed = true;
|
||||||
|
@ -301,7 +262,7 @@ public:
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
|
maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
|
||||||
maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex);
|
maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex);
|
||||||
maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance);
|
maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance);
|
||||||
maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size);
|
maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate);
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
}
|
}
|
||||||
|
@ -323,7 +284,6 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[2]);
|
const auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[2]);
|
||||||
maxwell3d.regs.draw.topology.Assign(topology);
|
|
||||||
const u32 padding = parameters[3];
|
const u32 padding = parameters[3];
|
||||||
const std::size_t max_draws = parameters[4];
|
const std::size_t max_draws = parameters[4];
|
||||||
|
|
||||||
|
@ -345,8 +305,6 @@ private:
|
||||||
base_vertex, base_instance, parameters[base + 1]);
|
base_vertex, base_instance, parameters[base + 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 minimum_limit{1 << 12};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl {
|
class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl {
|
||||||
|
@ -431,53 +389,53 @@ public:
|
||||||
HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {
|
HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {
|
||||||
builders.emplace(0x771BB18C62444DA0ULL,
|
builders.emplace(0x771BB18C62444DA0ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_771BB18C62444DA0>(maxwell3d);
|
return std::make_unique<HLE_771BB18C62444DA0>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0x0D61FC9FAAC9FCADULL,
|
builders.emplace(0x0D61FC9FAAC9FCADULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_DrawArraysIndirect>(maxwell3d);
|
return std::make_unique<HLE_DrawArraysIndirect>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0x8A4D173EB99A8603ULL,
|
builders.emplace(0x8A4D173EB99A8603ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_DrawArraysIndirect>(maxwell3d, true);
|
return std::make_unique<HLE_DrawArraysIndirect>(maxwell3d__, true);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0x0217920100488FF7ULL,
|
builders.emplace(0x0217920100488FF7ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_DrawIndexedIndirect>(maxwell3d);
|
return std::make_unique<HLE_DrawIndexedIndirect>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0x3F5E74B9C9A50164ULL,
|
builders.emplace(0x3F5E74B9C9A50164ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_MultiDrawIndexedIndirectCount>(maxwell3d);
|
return std::make_unique<HLE_MultiDrawIndexedIndirectCount>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xEAD26C3E2109B06BULL,
|
builders.emplace(0xEAD26C3E2109B06BULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_MultiLayerClear>(maxwell3d);
|
return std::make_unique<HLE_MultiLayerClear>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xC713C83D8F63CCF3ULL,
|
builders.emplace(0xC713C83D8F63CCF3ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_C713C83D8F63CCF3>(maxwell3d);
|
return std::make_unique<HLE_C713C83D8F63CCF3>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xD7333D26E0A93EDEULL,
|
builders.emplace(0xD7333D26E0A93EDEULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_D7333D26E0A93EDE>(maxwell3d);
|
return std::make_unique<HLE_D7333D26E0A93EDE>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xEB29B2A09AA06D38ULL,
|
builders.emplace(0xEB29B2A09AA06D38ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_BindShader>(maxwell3d);
|
return std::make_unique<HLE_BindShader>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xDB1341DBEB4C8AF7ULL,
|
builders.emplace(0xDB1341DBEB4C8AF7ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> {
|
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_SetRasterBoundingBox>(maxwell3d);
|
return std::make_unique<HLE_SetRasterBoundingBox>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,7 @@ public:
|
||||||
void SignalReference() override;
|
void SignalReference() override;
|
||||||
void ReleaseFences() override;
|
void ReleaseFences() override;
|
||||||
void FlushAndInvalidateRegion(
|
void FlushAndInvalidateRegion(
|
||||||
VAddr addr, u64 size,
|
VAddr addr, u64 size, VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
|
||||||
VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
|
|
||||||
void WaitForIdle() override;
|
void WaitForIdle() override;
|
||||||
void FragmentBarrier() override;
|
void FragmentBarrier() override;
|
||||||
void TiledCacheBarrier() override;
|
void TiledCacheBarrier() override;
|
||||||
|
|
|
@ -164,7 +164,8 @@ struct FixedPipelineState {
|
||||||
};
|
};
|
||||||
|
|
||||||
void Refresh(const Maxwell& regs);
|
void Refresh(const Maxwell& regs);
|
||||||
void Refresh2(const Maxwell& regs, Maxwell::PrimitiveTopology topology, bool base_feautures_supported);
|
void Refresh2(const Maxwell& regs, Maxwell::PrimitiveTopology topology,
|
||||||
|
bool base_feautures_supported);
|
||||||
void Refresh3(const Maxwell& regs);
|
void Refresh3(const Maxwell& regs);
|
||||||
|
|
||||||
Maxwell::ComparisonOp DepthTestFunc() const noexcept {
|
Maxwell::ComparisonOp DepthTestFunc() const noexcept {
|
||||||
|
|
|
@ -227,7 +227,8 @@ struct DefaultSpec {
|
||||||
|
|
||||||
ConfigureFuncPtr ConfigureFunc(const std::array<vk::ShaderModule, NUM_STAGES>& modules,
|
ConfigureFuncPtr ConfigureFunc(const std::array<vk::ShaderModule, NUM_STAGES>& modules,
|
||||||
const std::array<Shader::Info, NUM_STAGES>& infos) {
|
const std::array<Shader::Info, NUM_STAGES>& infos) {
|
||||||
return FindSpec<SimpleVertexSpec, SimpleVertexFragmentSpec, SimpleStorageSpec, SimpleImageSpec, DefaultSpec>(modules, infos);
|
return FindSpec<SimpleVertexSpec, SimpleVertexFragmentSpec, SimpleStorageSpec, SimpleImageSpec,
|
||||||
|
DefaultSpec>(modules, infos);
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
@ -505,11 +506,9 @@ void GraphicsPipeline::ConfigureDraw(const RescalingPushConstant& rescaling,
|
||||||
if (bind_pipeline) {
|
if (bind_pipeline) {
|
||||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline);
|
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline);
|
||||||
}
|
}
|
||||||
if (is_rescaling) {
|
|
||||||
cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS,
|
cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS,
|
||||||
RESCALING_LAYOUT_WORDS_OFFSET, sizeof(rescaling_data),
|
RESCALING_LAYOUT_WORDS_OFFSET, sizeof(rescaling_data),
|
||||||
rescaling_data.data());
|
rescaling_data.data());
|
||||||
}
|
|
||||||
if (update_rescaling) {
|
if (update_rescaling) {
|
||||||
const f32 config_down_factor{Settings::values.resolution_info.down_factor};
|
const f32 config_down_factor{Settings::values.resolution_info.down_factor};
|
||||||
const f32 scale_down_factor{is_rescaling ? config_down_factor : 1.0f};
|
const f32 scale_down_factor{is_rescaling ? config_down_factor : 1.0f};
|
||||||
|
|
|
@ -89,8 +89,7 @@ public:
|
||||||
void SignalReference() override;
|
void SignalReference() override;
|
||||||
void ReleaseFences() override;
|
void ReleaseFences() override;
|
||||||
void FlushAndInvalidateRegion(
|
void FlushAndInvalidateRegion(
|
||||||
VAddr addr, u64 size,
|
VAddr addr, u64 size, VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
|
||||||
VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
|
|
||||||
void WaitForIdle() override;
|
void WaitForIdle() override;
|
||||||
void FragmentBarrier() override;
|
void FragmentBarrier() override;
|
||||||
void TiledCacheBarrier() override;
|
void TiledCacheBarrier() override;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
@ -587,11 +587,16 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||||
dynamic_state_3 = {
|
dynamic_state_3 = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT,
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.extendedDynamicState3DepthClampEnable = ext_extended_dynamic_state_3_enables ? VK_TRUE : VK_FALSE,
|
.extendedDynamicState3DepthClampEnable =
|
||||||
.extendedDynamicState3LogicOpEnable = ext_extended_dynamic_state_3_enables ? VK_TRUE : VK_FALSE,
|
ext_extended_dynamic_state_3_enables ? VK_TRUE : VK_FALSE,
|
||||||
.extendedDynamicState3ColorBlendEnable = ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
|
.extendedDynamicState3LogicOpEnable =
|
||||||
.extendedDynamicState3ColorBlendEquation = ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
|
ext_extended_dynamic_state_3_enables ? VK_TRUE : VK_FALSE,
|
||||||
.extendedDynamicState3ColorWriteMask = ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
|
.extendedDynamicState3ColorBlendEnable =
|
||||||
|
ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
|
||||||
|
.extendedDynamicState3ColorBlendEquation =
|
||||||
|
ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
|
||||||
|
.extendedDynamicState3ColorWriteMask =
|
||||||
|
ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
|
||||||
};
|
};
|
||||||
SetNext(next, dynamic_state_3);
|
SetNext(next, dynamic_state_3);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1342,14 +1347,17 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||||
features.pNext = &extended_dynamic_state_3;
|
features.pNext = &extended_dynamic_state_3;
|
||||||
physical.GetFeatures2(features);
|
physical.GetFeatures2(features);
|
||||||
|
|
||||||
ext_extended_dynamic_state_3_blend = extended_dynamic_state_3.extendedDynamicState3ColorBlendEnable &&
|
ext_extended_dynamic_state_3_blend =
|
||||||
|
extended_dynamic_state_3.extendedDynamicState3ColorBlendEnable &&
|
||||||
extended_dynamic_state_3.extendedDynamicState3ColorBlendEquation &&
|
extended_dynamic_state_3.extendedDynamicState3ColorBlendEquation &&
|
||||||
extended_dynamic_state_3.extendedDynamicState3ColorWriteMask;
|
extended_dynamic_state_3.extendedDynamicState3ColorWriteMask;
|
||||||
|
|
||||||
ext_extended_dynamic_state_3_enables = extended_dynamic_state_3.extendedDynamicState3DepthClampEnable &&
|
ext_extended_dynamic_state_3_enables =
|
||||||
|
extended_dynamic_state_3.extendedDynamicState3DepthClampEnable &&
|
||||||
extended_dynamic_state_3.extendedDynamicState3LogicOpEnable;
|
extended_dynamic_state_3.extendedDynamicState3LogicOpEnable;
|
||||||
|
|
||||||
ext_extended_dynamic_state_3 = ext_extended_dynamic_state_3_blend || ext_extended_dynamic_state_3_enables;
|
ext_extended_dynamic_state_3 =
|
||||||
|
ext_extended_dynamic_state_3_blend || ext_extended_dynamic_state_3_enables;
|
||||||
if (ext_extended_dynamic_state_3) {
|
if (ext_extended_dynamic_state_3) {
|
||||||
extensions.push_back(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME);
|
extensions.push_back(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1269,7 +1269,8 @@ public:
|
||||||
dld->vkCmdSetColorBlendEnableEXT(handle, first, enables.size(), enables.data());
|
dld->vkCmdSetColorBlendEnableEXT(handle, first, enables.size(), enables.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetColorBlendEquationEXT(u32 first, Span<VkColorBlendEquationEXT> equations) const noexcept {
|
void SetColorBlendEquationEXT(u32 first,
|
||||||
|
Span<VkColorBlendEquationEXT> equations) const noexcept {
|
||||||
dld->vkCmdSetColorBlendEquationEXT(handle, first, equations.size(), equations.data());
|
dld->vkCmdSetColorBlendEquationEXT(handle, first, equations.size(), equations.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue