Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Premake/ProjectUtil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ end

systemToExecutableExtensionMap =
{
windows = "exe",
linux = "sh"
windows = ".exe",
linux = ""
}

systemToDynamicLibExtensionMap =
Expand Down Expand Up @@ -237,6 +237,11 @@ Solution.Util.CreateProject = function(name, projectType, binDir, dependencies,
characterset ("ASCII")
editandcontinue "Off"

filter "system:linux"
linkgroups "On"
linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
filter {}

filter "configurations:Debug"
runtime "Debug"
symbols "On"
Expand Down
2 changes: 1 addition & 1 deletion Source/Game-Lib/Game-Lib/Application/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ bool Application::Init(bool enableRenderDoc)
ServiceLocator::SetEnttRegistries(&_registries);

std::filesystem::path currentPath = std::filesystem::current_path();
std::filesystem::path pactPath = currentPath / "data/pact";
std::filesystem::path pactPath = currentPath / "Data/Pact";
std::filesystem::path customOverlayPath = pactPath / "data/custom";
std::filesystem::path stagingOverlayPath = pactPath / "data/staging";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <Jolt/Physics/Body/Body.h>
#include <Jolt/Physics/Body/BodyFilter.h>

#include <tracy/tracy.hpp>
#include <tracy/Tracy.hpp>

namespace ECS::Systems
{
Expand Down
15 changes: 8 additions & 7 deletions Source/Game-Lib/Game-Lib/ECS/Util/FactionUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,16 @@ namespace ECS::Util::Faction
Reaction Presentation(const State::FactionState& state, const Components::UnitFaction& unitFaction)
{
const FactionRuntimeData& runtime = *state.runtime;
if (state.localPlayerFaction == NONE_FACTION_INDEX || unitFaction.factionIndex == NONE_FACTION_INDEX)
if (unitFaction.factionIndex == NONE_FACTION_INDEX)
return Reaction::Neutral;

const State::PerceptionOverride* perception = FindPerception(state, unitFaction.factionIndex);
if (perception && HasPerceptionField(perception->activeFields, State::PerceptionOverrideFields::Reaction))
return perception->effectiveReaction;

if (state.localPlayerFaction == NONE_FACTION_INDEX)
return Reaction::Neutral;

Reaction reaction = runtime.GetRelation(unitFaction.factionIndex, state.localPlayerFaction);

if (perception && HasPerceptionField(perception->activeFields, State::PerceptionOverrideFields::Standing))
Expand All @@ -113,12 +119,7 @@ namespace ECS::Util::Faction
? ReactionBounds::Unpack(unitFaction.playerReactionBounds)
: ReactionBounds::Unpack(NEUTRAL_REACTION_BOUNDS);

reaction = bounds.Clamp(reaction);

if (perception && HasPerceptionField(perception->activeFields, State::PerceptionOverrideFields::Reaction))
reaction = perception->effectiveReaction;

return reaction;
return bounds.Clamp(reaction);
}

bool HasAtWarFlag(const State::FactionState& state, FactionIndex targetFaction)
Expand Down
2 changes: 1 addition & 1 deletion Source/Game-Lib/Game-Lib/Rendering/CulledRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ void CulledRenderer::RunInstancedCullingDispatch(CullingPassParams& params, bool
cullConstants->numTotalInstances = numInstances;
cullConstants->occlusionCull = params.occlusionCull;

u32 instanceCountOffset = params.cullingResources->IsIndexed() ? offsetof(Renderer::IndexedIndirectDraw, Renderer::IndexedIndirectDraw::instanceCount) : offsetof(Renderer::IndirectDraw, Renderer::IndirectDraw::instanceCount);
u32 instanceCountOffset = params.cullingResources->IsIndexed() ? offsetof(Renderer::IndexedIndirectDraw, instanceCount) : offsetof(Renderer::IndirectDraw, instanceCount);
cullConstants->instanceCountOffset = instanceCountOffset;
cullConstants->drawCallSize = params.cullingResources->IsIndexed() ? sizeof(Renderer::IndexedIndirectDraw) : sizeof(Renderer::IndirectDraw);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void JoltDebugRenderer::AddOccluderPass(Renderer::RenderGraph* renderGraph, Rend
Draw(resources, frameIndex, graphResources, commandList, drawParams);
};

params.baseInstanceLookupOffset = offsetof(DrawCallData, DrawCallData::baseInstanceLookupOffset);
params.baseInstanceLookupOffset = offsetof(DrawCallData, baseInstanceLookupOffset);
params.drawCallDataSize = sizeof(DrawCallData);

params.enableDrawing = CVAR_JoltDebugDrawOccluders.Get();
Expand Down Expand Up @@ -272,7 +272,7 @@ void JoltDebugRenderer::AddOccluderPass(Renderer::RenderGraph* renderGraph, Rend
Draw(resources, frameIndex, graphResources, commandList, drawParams);
};

params.baseInstanceLookupOffset = offsetof(DrawCallData, DrawCallData::baseInstanceLookupOffset);
params.baseInstanceLookupOffset = offsetof(DrawCallData, baseInstanceLookupOffset);
params.drawCallDataSize = sizeof(DrawCallData);

params.enableDrawing = CVAR_JoltDebugDrawOccluders.Get();
Expand Down
2 changes: 1 addition & 1 deletion Source/Game-Lib/Game-Lib/Rendering/Light/LightRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Renderer
{
class Renderer;
class RenderGraph;

class RenderGraphBuilder;
}

class DebugRenderer;
Expand Down
6 changes: 3 additions & 3 deletions Source/Game-Lib/Game-Lib/Rendering/Model/ModelRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ void ModelRenderer::AddOccluderPass(Renderer::RenderGraph* renderGraph, RenderRe
Draw(resources, frameIndex, graphResources, commandList, drawParams);
};

params.baseInstanceLookupOffset = offsetof(DrawCallData, DrawCallData::baseInstanceLookupOffset);
params.baseInstanceLookupOffset = offsetof(DrawCallData, baseInstanceLookupOffset);
params.drawCallDataSize = sizeof(DrawCallData);

params.enableDrawing = CVAR_ModelDrawOccluders.Get();
Expand Down Expand Up @@ -1050,7 +1050,7 @@ void ModelRenderer::AddGeometryPass(Renderer::RenderGraph* renderGraph, RenderRe
Draw(resources, frameIndex, graphResources, commandList, drawParams);
};

params.baseInstanceLookupOffset = offsetof(DrawCallData, DrawCallData::baseInstanceLookupOffset);
params.baseInstanceLookupOffset = offsetof(DrawCallData, baseInstanceLookupOffset);
params.drawCallDataSize = sizeof(DrawCallData);

params.numShadowViews = numShadowViews;
Expand Down Expand Up @@ -1308,7 +1308,7 @@ void ModelRenderer::AddSVSMGeometryPass(Renderer::RenderGraph* renderGraph, Rend
Draw(resources, frameIndex, graphResources, commandList, drawParams);
};

params.baseInstanceLookupOffset = offsetof(DrawCallData, DrawCallData::baseInstanceLookupOffset);
params.baseInstanceLookupOffset = offsetof(DrawCallData, baseInstanceLookupOffset);
params.drawCallDataSize = sizeof(DrawCallData);

params.firstViewIndex = 1;
Expand Down
4 changes: 3 additions & 1 deletion Source/Game-Tests/Game-Tests/ScriptingAutomationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ namespace

i32 GetGlobalInteger(const char* name)
{
// The counters are plain Lua numbers; Luau integers are a distinct type whose
// reads are strict, so read as number and cast host-side
_zenith->GetGlobalKey(name);
const i32 value = _zenith->Get<i32>(-1);
const i32 value = static_cast<i32>(_zenith->Get<f64>(-1));
_zenith->Pop();
return value;
}
Expand Down
9 changes: 9 additions & 0 deletions Source/ShaderCookerStandalone/ShaderCookerStandalone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Solution.Util.CreateConsoleApp(mod.Name, Solution.Projects.Current.BinDir, mod.D
Solution.Util.SetIncludes(mod.Path)
Solution.Util.SetDefines(defines)

if os.target() ~= "windows" then
-- premake's gmake backend generates no build target for Utility projects, so the
-- Shaders project's prebuild cook never runs there; cook after building the cooker instead
local shaderSourceDir = path.getabsolute(mod.Path .. "/../Shaders/Shaders")
local shaderOutputPath = (Solution.Projects.Current.BuildDir .. "/Data/Shaders")
postbuildmessage ("Compiling Shaders...")
postbuildcommands { "%{cfg.buildtarget.abspath} " .. shaderSourceDir .. " " .. shaderOutputPath }
end

vpaths {
["/*"] = { "*.lua", "*.cpp" }
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Shaders/Shaders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Solution.Util.CreateProject(mod.Name, "Utility", Solution.Projects.Current.BinDi
}
Solution.Util.SetFiles(files)

local shaderCookerStandalonePath = (Solution.Projects.Current.BinDir .. "/%{cfg.buildcfg}/ShaderCookerStandalone.%{systemToExecutableExtensionMap[cfg.system]}")
local shaderCookerStandalonePath = (Solution.Projects.Current.BinDir .. "/%{cfg.buildcfg}/ShaderCookerStandalone%{systemToExecutableExtensionMap[cfg.system]}")
local shaderOutputPath = (Solution.Projects.Current.BuildDir .. "/Data/Shaders")

prebuildmessage ("Compiling Shaders...")
Expand Down
8 changes: 6 additions & 2 deletions Source/Shaders/Shaders/Model/Draw.vs.slang
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct VSOutput
float4 uv01 : TEXCOORD1;
#endif
#if SVSM_PASS
float4 clipDistances : SV_ClipDistance; // Fixed-function culls fragments outside the draw's clip rect
float clipDistances[4] : SV_ClipDistance; // Fixed-function culls fragments outside the draw's clip rect
#endif
};

Expand Down Expand Up @@ -77,7 +77,11 @@ VSOutput main(VSInput input)
output.position = mul(position, _cameras[_constants.viewIndex].worldToClip);

#if SVSM_PASS
output.clipDistances = SVSMRectClipDistances(position.xyz, _constants.viewIndex - 1, _constants.svsmRectIndex, _cameras[0].eyePosition.xyz, _svsmData);
float4 clipDistances = SVSMRectClipDistances(position.xyz, _constants.viewIndex - 1, _constants.svsmRectIndex, _cameras[0].eyePosition.xyz, _svsmData);
output.clipDistances[0] = clipDistances.x;
output.clipDistances[1] = clipDistances.y;
output.clipDistances[2] = clipDistances.z;
output.clipDistances[3] = clipDistances.w;
#endif

#if !EDITOR_PASS
Expand Down
13 changes: 10 additions & 3 deletions Source/Shaders/Shaders/Terrain/Draw.vs.slang
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct VSOutput
uint instanceID : TEXCOORD0;
#endif
#if SVSM_PASS
float4 clipDistances : SV_ClipDistance; // Fixed-function culls fragments outside the draw's clip rect
float clipDistances[4] : SV_ClipDistance; // Fixed-function culls fragments outside the draw's clip rect
#endif
};

Expand All @@ -53,7 +53,10 @@ VSOutput main(VSInput input)
const float NaN = asfloat(0b01111111100000000000000000000000);
output.position = float4(NaN, NaN, NaN, NaN);
#if SVSM_PASS
output.clipDistances = float4(-1.0f, -1.0f, -1.0f, -1.0f);
output.clipDistances[0] = -1.0f;
output.clipDistances[1] = -1.0f;
output.clipDistances[2] = -1.0f;
output.clipDistances[3] = -1.0f;
#endif
return output;
}
Expand All @@ -70,7 +73,11 @@ VSOutput main(VSInput input)
output.instanceID = instanceData.globalCellID;
#endif
#if SVSM_PASS
output.clipDistances = SVSMRectClipDistances(vertex.position, _constants.viewIndex - 1, _constants.svsmRectIndex, _cameras[0].eyePosition.xyz, _svsmData);
float4 clipDistances = SVSMRectClipDistances(vertex.position, _constants.viewIndex - 1, _constants.svsmRectIndex, _cameras[0].eyePosition.xyz, _svsmData);
output.clipDistances[0] = clipDistances.x;
output.clipDistances[1] = clipDistances.y;
output.clipDistances[2] = clipDistances.z;
output.clipDistances[3] = clipDistances.w;
#endif

return output;
Expand Down
2 changes: 1 addition & 1 deletion Submodules/Engine
Loading