Another test

This commit is contained in:
CamilleLaVey 2026-06-26 02:51:27 -04:00
parent f285e2ea27
commit 993384ea17
7 changed files with 16 additions and 81 deletions

View file

@ -62,6 +62,7 @@ void FixedPipelineState::Refresh(Tegra::Engines::Maxwell3D& maxwell3d, DynamicFe
extended_dynamic_state_2_logic_op.Assign(features.has_extended_dynamic_state_2_logic_op ? 1 : 0);
extended_dynamic_state_3_blend.Assign(features.has_extended_dynamic_state_3_blend ? 1 : 0);
extended_dynamic_state_3_enables.Assign(features.has_extended_dynamic_state_3_enables ? 1 : 0);
dynamic_state3_depth_clamp_enable.Assign(features.has_dynamic_state3_depth_clamp_enable ? 1 : 0);
dynamic_vertex_input.Assign(features.has_dynamic_vertex_input ? 1 : 0);
xfb_enabled.Assign(regs.transform_feedback_enabled != 0);
ndc_minus_one_to_one.Assign(regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1 : 0);

View file

@ -208,6 +208,7 @@ struct FixedPipelineState {
BitField<12, 2, u32> tessellation_spacing;
BitField<14, 1, u32> tessellation_clockwise;
BitField<15, 5, u32> patch_control_points_minus_one;
BitField<20, 1, u32> dynamic_state3_depth_clamp_enable;
BitField<24, 4, Maxwell::PrimitiveTopology> topology;
BitField<28, 4, Tegra::Texture::MsaaMode> msaa_mode;

View file

@ -907,7 +907,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
// EDS3 - Enables (composite: per-feature)
if (key.state.extended_dynamic_state_3_enables) {
if (device.SupportsDynamicState3DepthClampEnable()) {
if (key.state.dynamic_state3_depth_clamp_enable != 0) {
dynamic_states.push_back(VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT);
}
if (device.SupportsDynamicState3LogicOpEnable()) {

View file

@ -492,7 +492,9 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_,
device.IsExtExtendedDynamicState3BlendingSupported();
dynamic_features.has_extended_dynamic_state_3_enables =
device.IsExtExtendedDynamicState3EnablesSupported();
dynamic_features.has_dynamic_state3_depth_clamp_enable = false;
dynamic_features.has_dynamic_state3_depth_clamp_enable =
dynamic_features.has_extended_dynamic_state_3_enables &&
device.SupportsDynamicState3DepthClampEnable();
dynamic_features.has_dynamic_state3_logic_op_enable =
device.SupportsDynamicState3LogicOpEnable();
dynamic_features.has_dynamic_state3_line_stipple_enable =

View file

@ -113,6 +113,10 @@ public:
[[nodiscard]] ComputePipeline* CurrentComputePipeline();
[[nodiscard]] bool SupportsDynamicState3DepthClampEnable() const {
return dynamic_features.has_dynamic_state3_depth_clamp_enable;
}
void LoadDiskResources(u64 title_id, std::stop_token stop_loading,
const VideoCore::DiskResourceLoadCallback& callback);

View file

@ -1271,7 +1271,7 @@ struct QueryCacheRuntimeImpl {
, tfb_streamer(size_t(QueryType::StreamingByteCount), runtime, device, scheduler, memory_allocator, staging_pool)
, primitives_succeeded_streamer(size_t(QueryType::StreamingPrimitivesSucceeded), runtime, tfb_streamer, device_memory_)
, primitives_needed_minus_succeeded_streamer(size_t(QueryType::StreamingPrimitivesNeededMinusSucceeded), runtime, 0u)
, hcr_setup{}, hcr_is_set{}, is_hcr_running{}, hcr_bc_resolve_cache{}, maxwell3d{} {
, hcr_setup{}, hcr_is_set{}, is_hcr_running{}, maxwell3d{} {
hcr_setup.sType = VK_STRUCTURE_TYPE_CONDITIONAL_RENDERING_BEGIN_INFO_EXT;
hcr_setup.pNext = nullptr;
@ -1326,15 +1326,6 @@ struct QueryCacheRuntimeImpl {
bool hcr_is_set;
bool is_hcr_running;
struct HCRBCResolveCache {
DAddr address{};
u64 record_serial{};
bool is_equal{};
bool compare_to_zero{};
bool valid{};
};
HCRBCResolveCache hcr_bc_resolve_cache;
// maxwell3d
Maxwell3D* maxwell3d;
};
@ -1360,7 +1351,6 @@ void QueryCacheRuntime::EndHostConditionalRendering() {
PauseHostConditionalRendering();
impl->hcr_is_set = false;
impl->is_hcr_running = false;
impl->hcr_bc_resolve_cache.valid = false;
impl->hcr_buffer = VkBuffer{};
impl->hcr_offset = 0;
}
@ -1390,7 +1380,6 @@ void QueryCacheRuntime::ResumeHostConditionalRendering() {
void QueryCacheRuntime::HostConditionalRenderingCompareValueImpl(VideoCommon::LookupData object,
bool is_equal) {
impl->hcr_bc_resolve_cache.valid = false;
{
std::scoped_lock lk(impl->buffer_cache.mutex);
static constexpr auto sync_info = VideoCommon::ObtainBufferSynchronize::FullSynchronize;
@ -1422,14 +1411,6 @@ void QueryCacheRuntime::HostConditionalRenderingCompareValueImpl(VideoCommon::Lo
void QueryCacheRuntime::HostConditionalRenderingCompareBCImpl(DAddr address, bool is_equal,
bool compare_to_zero) {
const u64 current_record_serial = impl->scheduler.CurrentRecordSerial();
auto& cache = impl->hcr_bc_resolve_cache;
if (cache.valid && cache.address == address && cache.is_equal == is_equal &&
cache.compare_to_zero == compare_to_zero &&
cache.record_serial == current_record_serial) {
return;
}
VkBuffer to_resolve;
u32 to_resolve_offset;
const u32 resolve_size = compare_to_zero ? 8 : 24;
@ -1453,66 +1434,16 @@ void QueryCacheRuntime::HostConditionalRenderingCompareBCImpl(DAddr address, boo
impl->hcr_setup.flags = is_equal ? 0 : VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT;
impl->hcr_is_set = true;
impl->is_hcr_running = false;
cache.address = address;
cache.record_serial = impl->scheduler.CurrentRecordSerial();
cache.is_equal = is_equal;
cache.compare_to_zero = compare_to_zero;
cache.valid = true;
if (was_running) {
ResumeHostConditionalRendering();
}
}
bool QueryCacheRuntime::HostConditionalRenderingCompareValue(VideoCommon::LookupData object_1,
bool qc_dirty) {
[[maybe_unused]] bool qc_dirty) {
if (!impl->device.IsExtConditionalRendering()) {
return false;
}
if (object_1.address == 0) {
EndHostConditionalRendering();
return false;
}
const bool is_in_qc = object_1.found_query != nullptr;
bool is_in_bc = false;
if (!is_in_qc) {
std::scoped_lock lk(impl->buffer_cache.mutex);
is_in_bc = impl->buffer_cache.IsRegionGpuModified(object_1.address, 8);
}
const bool is_in_ac = is_in_qc || is_in_bc;
if (!is_in_ac) {
EndHostConditionalRendering();
return false;
}
if (!qc_dirty && !is_in_bc) {
EndHostConditionalRendering();
return false;
}
const auto driver_id = impl->device.GetDriverID();
const bool is_gpu_high = Settings::IsGPULevelHigh();
if ((!is_gpu_high && driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS) ||
driver_id == VK_DRIVER_ID_ARM_PROPRIETARY || driver_id == VK_DRIVER_ID_MESA_TURNIP) {
EndHostConditionalRendering();
return true;
}
if (!is_gpu_high) {
EndHostConditionalRendering();
return true;
}
if (!is_in_bc) {
// Avoid comparing stale data: query cache can be newer than guest memory.
EndHostConditionalRendering();
return true;
}
HostConditionalRenderingCompareBCImpl(object_1.address, true, true);
return true;
}
@ -1540,18 +1471,14 @@ bool QueryCacheRuntime::HostConditionalRenderingCompareValues(VideoCommon::Looku
std::array<bool, 2> is_in_qc{};
std::array<bool, 2> is_in_ac{};
std::array<bool, 2> is_null{};
for (size_t i = 0; i < 2; i++) {
is_in_qc[i] = objects[i]->found_query != nullptr;
}
if (!is_in_qc[0] || !is_in_qc[1]) {
{
std::scoped_lock lk(impl->buffer_cache.mutex);
for (size_t i = 0; i < 2; i++) {
is_in_qc[i] = objects[i]->found_query != nullptr;
is_in_bc[i] = !is_in_qc[i] && check_in_bc(objects[i]->address);
is_in_ac[i] = is_in_qc[i] || is_in_bc[i];
}
}
for (size_t i = 0; i < 2; i++) {
is_in_ac[i] = is_in_qc[i] || is_in_bc[i];
}
if (!is_in_ac[0] && !is_in_ac[1]) {
EndHostConditionalRendering();

View file

@ -1578,7 +1578,7 @@ void RasterizerVulkan::UpdateDepthClampEnable(Tegra::Engines::Maxwell3D::Regs& r
if (!state_tracker.TouchDepthClampEnable()) {
return;
}
if (!device.SupportsDynamicState3DepthClampEnable()) {
if (!pipeline_cache.SupportsDynamicState3DepthClampEnable()) {
return;
}
bool is_enabled = !(regs.viewport_clip_control.geometry_clip ==