Skip to content

Commit

Permalink
Fix volumetric fog empty texture and remove sm4_0
Browse files Browse the repository at this point in the history
  • Loading branch information
ForserX committed Aug 1, 2024
1 parent 4a8fada commit 5e9d529
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 286 deletions.
2 changes: 1 addition & 1 deletion gamedata/shaders/d3d11/fluid_edge_detect.vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Vertex
// A full-screen edge detection pass to locate artifacts
VS_OUTPUT_EDGE main_vs_4_0(VS_INPUT input)
VS_OUTPUT_EDGE main(VS_INPUT input)
{
VS_OUTPUT_EDGE output = (VS_OUTPUT_EDGE)0;
output.position = float4(input.pos, 1);
Expand Down
2 changes: 1 addition & 1 deletion gamedata/shaders/d3d11/fluid_grid.vs.hlsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "fluid_common.hlsli"

// Vertex
v2g_fluidsim main_vs_4_0(v_fluidsim input)
v2g_fluidsim main(v_fluidsim input)
{
v2g_fluidsim output = (v2g_fluidsim)0;

Expand Down
2 changes: 1 addition & 1 deletion gamedata/shaders/d3d11/fluid_grid_dyn_oobb.vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cbuffer DynOOBBData
}

// Vertex
v2g_fluidsim_dyn_aabb main_vs_4_0(v_fluidsim input)
v2g_fluidsim_dyn_aabb main(v_fluidsim input)
{
v2g_fluidsim_dyn_aabb output = (v2g_fluidsim_dyn_aabb)0;

Expand Down
2 changes: 1 addition & 1 deletion gamedata/shaders/d3d11/fluid_grid_oobb.vs.hlsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "fluid_common.hlsli"

// Vertex
v2g_fluidsim_clip main_vs_4_0(v_fluidsim input)
v2g_fluidsim_clip main(v_fluidsim input)
{
v2g_fluidsim_clip output = (v2g_fluidsim_clip)0;

Expand Down
2 changes: 1 addition & 1 deletion gamedata/shaders/d3d11/fluid_raycast_quad.vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Vertex
// TODO: DX10: replace WorldViewProjection with m_WVP
PS_INPUT_RAYCAST main_vs_4_0(VS_INPUT input)
PS_INPUT_RAYCAST main(VS_INPUT input)
{
PS_INPUT_RAYCAST output = (PS_INPUT_RAYCAST)0;
output.pos = float4(input.pos, 1);
Expand Down
2 changes: 1 addition & 1 deletion gamedata/shaders/d3d11/fluid_raydata_back.vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Vertex
// TODO: DX10: replace WorldViewProjection with m_WVP
PS_INPUT_RAYDATA_BACK main_vs_4_0(VS_INPUT input)
PS_INPUT_RAYDATA_BACK main(VS_INPUT input)
{
PS_INPUT_RAYDATA_BACK output = (PS_INPUT_RAYDATA_BACK)0;
// output.pos = mul(float4(input.pos,1), WorldViewProjection);
Expand Down
2 changes: 1 addition & 1 deletion gamedata/shaders/d3d11/fluid_raydata_front.vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Vertex
// TODO: DX10: replace WorldViewProjection with m_WVP
PS_INPUT_RAYDATA_FRONT main_vs_4_0(VS_INPUT input)
PS_INPUT_RAYDATA_FRONT main(VS_INPUT input)
{
PS_INPUT_RAYDATA_FRONT output = (PS_INPUT_RAYDATA_FRONT)0;
// output.pos = mul(float4(input.pos,1), WorldViewProjection);
Expand Down
22 changes: 14 additions & 8 deletions src/Layers/xrRender/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "blenders\blender_recorder.h"
#include <execution>

#ifdef USE_DX11
#include "../xrRenderDX10/3DFluid/dx103DFluidManager.h"
#endif
// Already defined in Texture.cpp
void fix_texture_name(LPSTR fn);
/*
Expand Down Expand Up @@ -348,21 +351,24 @@ void CResourceManager::DeferredUpload()
pair.second->Load();
}
}

#ifdef USE_DX11
FluidManager.Initialize(70, 70, 70);
FluidManager.SetScreenSize((u32)RCache.get_width(), (u32)RCache.get_height());
#endif
}

void CResourceManager::DeferredUnload() {
void CResourceManager::DeferredUnload()
{
if (!RDEVICE.b_is_Ready)
return;
#ifdef DEBUG
Msg("%s, texture unloading -> START, size = [%d]", __FUNCTION__, m_textures.size());
#endif // DEBUG

#ifdef USE_DX11
FluidManager.Destroy();
#endif

for (auto& texture : m_textures)
texture.second->Unload();

#ifdef DEBUG
Msg("%s, texture unloading -> COMPLETE", __FUNCTION__);
#endif // DEBUG
}

#ifdef _EDITOR
Expand Down
26 changes: 15 additions & 11 deletions src/Layers/xrRenderDX10/3DFluid/dx103DFluidManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,20 +372,24 @@ void dx103DFluidManager::AttachFluidData(dx103DFluidData &FluidData)
}
}

void dx103DFluidManager::DetachAndSwapFluidData(dx103DFluidData &FluidData)
void dx103DFluidManager::DetachAndSwapFluidData(dx103DFluidData& FluidData)
{
PIX_EVENT(DetachAndSwapFluidData);

ID3DTexture3D *pTTarg = (ID3DTexture3D*) pRTTextures[RENDER_TARGET_COLOR]->surface_get();

if (pTTarg == nullptr)
return;

ID3DTexture3D *pTSrc = FluidData.GetTexture(dx103DFluidData::VP_COLOR);
FluidData.SetTexture(dx103DFluidData::VP_COLOR, pTTarg);
pRTTextures[RENDER_TARGET_COLOR]->surface_set(pTSrc);
_RELEASE(pTTarg);
_RELEASE(pTSrc);
if (ID3DTexture3D* pTTarg = (ID3DTexture3D*)pRTTextures[RENDER_TARGET_COLOR]->surface_get())
{
ID3DTexture3D* pTSrc = FluidData.GetTexture(dx103DFluidData::VP_COLOR);
FluidData.SetTexture(dx103DFluidData::VP_COLOR, pTTarg);
pRTTextures[RENDER_TARGET_COLOR]->surface_set(pTSrc);
_RELEASE(pTTarg);
_RELEASE(pTSrc);
}
else
{
ID3DTexture3D* pTSrc = FluidData.GetTexture(dx103DFluidData::VP_COLOR);
pRTTextures[RENDER_TARGET_COLOR]->surface_set(pTSrc);
_RELEASE(pTSrc);
}

ID3DRenderTargetView *pV = FluidData.GetView(dx103DFluidData::VP_COLOR);
FluidData.SetView(dx103DFluidData::VP_COLOR, pRenderTargetViews[RENDER_TARGET_COLOR]);
Expand Down
Loading

0 comments on commit 5e9d529

Please sign in to comment.