Skip to content

NFSU2 Revived v0.15.22

Choose a tag to compare

@mininxd mininxd released this 11 Nov 06:39
· 14 commits to main since this release

What's Changed in v0.15.22

Enhanced Contrast Optimization & Bloom Bypass

  • Pure Rust In-Game Contrast Regulator: Reworked the in-game Enhanced Contrast pipeline to evaluate directly inside native Rust (contrast_filter.rs). When Enhanced Contrast is enabled in the game options, redundant multi-pass overbright bloom shaders are bypassed, eliminating the severe GPU fillrate and bandwidth drop on mobile tile-based architectures:
    // In-game Enhanced Contrast regulator: suppresses redundant multi-pass overbright bloom
    #[no_mangle]
    pub extern "C" fn nfs_gfx_rust_filter_overbright(default_val: u32) -> u32 {
        if nfs_contrast_is_enabled() {
            0 // Bypass multi-pass bloom to eliminate GPU fillrate bottleneck
        } else {
            default_val
        }
    }
  • Hardware Gamma Calibration: Replaced the performance-heavy software bleach-bypass blit with hardware gamma ramp adjustments via SetGammaRamp:
    // Hardware gamma curve replaces expensive software shader passes
    extern "C" void nfs_d3d9_set_enhanced_contrast_ramp(int enable) {
        if (!s_active_d3d9_device) return;
        D3DGAMMARAMP ramp;
        for (int i = 0; i < 256; ++i) {
            float normalized = (float)i / 255.0f;
            float adjusted = enable ? std::pow(normalized, 1.25f) : normalized;
            uint16_t val = (uint16_t)std::round(adjusted * 65535.0f);
            ramp.red[i] = ramp.green[i] = ramp.blue[i] = val;
        }
        s_active_d3d9_device->SetGammaRamp(0, D3DSGR_NO_CALIBRATION, &ramp);
    }

Rust Native Performance Engine Migration

  • Game Performance Booster to Rust: Migrated core tuning and configuration routines from Java (GamePerformanceBooster.java) into pure native Rust modules (settings_engine.rs and driver_inspector.rs). Eliminates Java VM garbage collection pauses and JNI boundary latency during high-speed rendering:
    // Native Rust settings engine replaces JVM performance booster
    pub fn apply_performance_preset(&self, preset: PerformancePreset) {
        match preset {
            PerformancePreset::UltraPerformance => {
                self.dxvk_async.store(true, Ordering::Relaxed);
                self.draw_distance.store(350.0f32.to_bits(), Ordering::Relaxed);
                self.frame_limit.store(60, Ordering::Relaxed);
            }
        }
    }

Full Changelog: v0.15.21...v0.15.22