mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Fix WMO wall collision, normal mapping, POM backfill, and M2/WMO rendering performance
- Fix MOPY flag check (0x08 not 0x01) for proper wall collision detection - Cap MAX_PUSH to PLAYER_RADIUS to prevent gradual clip-through - Fix WMO doodad quaternion component ordering (X/Y swap) - Linear normal map strength blend in shader for smooth slider control - Enable shadow sampling for interior WMO groups (covered outdoor areas) - Backfill deferred normal/height maps after streaming with descriptor rebind - M2: prepareRender only iterates animated instances, bone dirty flag - M2: remove worker thread VMA allocation, skip unready bone instances - WMO: persistent visibility vectors, sequential culling - Add FSR EASU/RCAS shaders
This commit is contained in:
parent
16c6c2b6a0
commit
a4966e486f
25 changed files with 1467 additions and 352 deletions
|
|
@ -4,10 +4,12 @@
|
|||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <future>
|
||||
#include <glm/glm.hpp>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vk_mem_alloc.h>
|
||||
#include "rendering/vk_frame_data.hpp"
|
||||
#include "rendering/vk_utils.hpp"
|
||||
#include "rendering/sky_system.hpp"
|
||||
|
||||
namespace wowee {
|
||||
|
|
@ -259,6 +261,14 @@ public:
|
|||
float getShadowDistance() const { return shadowDistance_; }
|
||||
void setMsaaSamples(VkSampleCountFlagBits samples);
|
||||
|
||||
// FSR 1.0 (FidelityFX Super Resolution) upscaling
|
||||
void setFSREnabled(bool enabled);
|
||||
bool isFSREnabled() const { return fsr_.enabled; }
|
||||
void setFSRQuality(float scaleFactor); // 0.50=Perf, 0.59=Balanced, 0.67=Quality, 0.77=UltraQuality
|
||||
void setFSRSharpness(float sharpness); // 0.0 - 2.0
|
||||
float getFSRScaleFactor() const { return fsr_.scaleFactor; }
|
||||
float getFSRSharpness() const { return fsr_.sharpness; }
|
||||
|
||||
void setWaterRefractionEnabled(bool enabled);
|
||||
bool isWaterRefractionEnabled() const;
|
||||
|
||||
|
|
@ -312,7 +322,7 @@ private:
|
|||
VmaAllocation selCircleIdxAlloc = VK_NULL_HANDLE;
|
||||
int selCircleVertCount = 0;
|
||||
void initSelectionCircle();
|
||||
void renderSelectionCircle(const glm::mat4& view, const glm::mat4& projection);
|
||||
void renderSelectionCircle(const glm::mat4& view, const glm::mat4& projection, VkCommandBuffer overrideCmd = VK_NULL_HANDLE);
|
||||
glm::vec3 selCirclePos{0.0f};
|
||||
glm::vec3 selCircleColor{1.0f, 0.0f, 0.0f};
|
||||
float selCircleRadius = 1.5f;
|
||||
|
|
@ -322,7 +332,36 @@ private:
|
|||
VkPipeline overlayPipeline = VK_NULL_HANDLE;
|
||||
VkPipelineLayout overlayPipelineLayout = VK_NULL_HANDLE;
|
||||
void initOverlayPipeline();
|
||||
void renderOverlay(const glm::vec4& color);
|
||||
void renderOverlay(const glm::vec4& color, VkCommandBuffer overrideCmd = VK_NULL_HANDLE);
|
||||
|
||||
// FSR 1.0 upscaling state
|
||||
struct FSRState {
|
||||
bool enabled = false;
|
||||
bool needsRecreate = false;
|
||||
float scaleFactor = 0.77f; // Ultra Quality default
|
||||
float sharpness = 0.5f;
|
||||
uint32_t internalWidth = 0;
|
||||
uint32_t internalHeight = 0;
|
||||
|
||||
// Off-screen scene target (reduced resolution)
|
||||
AllocatedImage sceneColor{}; // 1x color (non-MSAA render target / MSAA resolve target)
|
||||
AllocatedImage sceneDepth{}; // Depth (matches current MSAA sample count)
|
||||
AllocatedImage sceneMsaaColor{}; // MSAA color target (only when MSAA > 1x)
|
||||
AllocatedImage sceneDepthResolve{}; // Depth resolve (only when MSAA + depth resolve)
|
||||
VkFramebuffer sceneFramebuffer = VK_NULL_HANDLE;
|
||||
VkSampler sceneSampler = VK_NULL_HANDLE;
|
||||
|
||||
// Upscale pipeline
|
||||
VkPipeline pipeline = VK_NULL_HANDLE;
|
||||
VkPipelineLayout pipelineLayout = VK_NULL_HANDLE;
|
||||
VkDescriptorSetLayout descSetLayout = VK_NULL_HANDLE;
|
||||
VkDescriptorPool descPool = VK_NULL_HANDLE;
|
||||
VkDescriptorSet descSet = VK_NULL_HANDLE;
|
||||
};
|
||||
FSRState fsr_;
|
||||
bool initFSRResources();
|
||||
void destroyFSRResources();
|
||||
void renderFSRUpscale();
|
||||
|
||||
// Footstep event tracking (animation-driven)
|
||||
uint32_t footstepLastAnimationId = 0;
|
||||
|
|
@ -411,6 +450,36 @@ private:
|
|||
void setupWater1xPass();
|
||||
void renderReflectionPass();
|
||||
|
||||
// ── Multithreaded secondary command buffer recording ──
|
||||
// Indices into secondaryCmds_ arrays
|
||||
static constexpr uint32_t SEC_SKY = 0; // sky (main thread)
|
||||
static constexpr uint32_t SEC_TERRAIN = 1; // terrain (worker 0)
|
||||
static constexpr uint32_t SEC_WMO = 2; // WMO (worker 1)
|
||||
static constexpr uint32_t SEC_CHARS = 3; // selection circle + characters (main thread)
|
||||
static constexpr uint32_t SEC_M2 = 4; // M2 + particles + glow (worker 2)
|
||||
static constexpr uint32_t SEC_POST = 5; // water + weather + effects (main thread)
|
||||
static constexpr uint32_t SEC_IMGUI = 6; // ImGui (main thread, non-FSR only)
|
||||
static constexpr uint32_t NUM_SECONDARIES = 7;
|
||||
static constexpr uint32_t NUM_WORKERS = 3; // terrain, WMO, M2
|
||||
|
||||
// Per-worker command pools (thread-safe: one pool per thread)
|
||||
VkCommandPool workerCmdPools_[NUM_WORKERS] = {};
|
||||
// Main-thread command pool for its secondary buffers
|
||||
VkCommandPool mainSecondaryCmdPool_ = VK_NULL_HANDLE;
|
||||
// Pre-allocated secondary command buffers [secondaryIndex][frameInFlight]
|
||||
VkCommandBuffer secondaryCmds_[NUM_SECONDARIES][MAX_FRAMES] = {};
|
||||
|
||||
bool parallelRecordingEnabled_ = false; // set true after pools/buffers created
|
||||
bool createSecondaryCommandResources();
|
||||
void destroySecondaryCommandResources();
|
||||
VkCommandBuffer beginSecondary(uint32_t secondaryIndex);
|
||||
void setSecondaryViewportScissor(VkCommandBuffer cmd);
|
||||
|
||||
// Cached render pass state for secondary buffer inheritance
|
||||
VkRenderPass activeRenderPass_ = VK_NULL_HANDLE;
|
||||
VkFramebuffer activeFramebuffer_ = VK_NULL_HANDLE;
|
||||
VkExtent2D activeRenderExtent_ = {0, 0};
|
||||
|
||||
// Active character previews for off-screen rendering
|
||||
std::vector<CharacterPreview*> activePreviews_;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue