forked from mirrors/0ad
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2024 Wildfire Games.
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -236,12 +236,10 @@ void CModel::ValidatePosition()
|
||||
// For CPU skinning, we precompute as much as possible so that the only
|
||||
// per-vertex work is a single matrix*vec multiplication.
|
||||
// For GPU skinning, we try to minimise CPU work by doing most computation
|
||||
// in the vertex shader instead.
|
||||
// Using g_RenderingOptions to detect CPU vs GPU is a bit hacky,
|
||||
// and this doesn't allow the setting to change at runtime, but there isn't
|
||||
// an obvious cleaner way to determine what data needs to be computed.
|
||||
bool worldSpaceBoneMatrices = !g_RenderingOptions.GetGPUSkinning();
|
||||
bool computeBlendMatrices = !g_RenderingOptions.GetGPUSkinning();
|
||||
// in the compute shader instead.
|
||||
const bool isGPUSkinningEnabled{g_RenderingOptions.GetGPUSkinning()};
|
||||
const bool worldSpaceBoneMatrices{!isGPUSkinningEnabled};
|
||||
const bool computeBlendMatrices{!isGPUSkinningEnabled};
|
||||
|
||||
if (m_BoneMatrices && worldSpaceBoneMatrices)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2024 Wildfire Games.
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -219,6 +219,7 @@ void ShaderModelRenderer::Submit(int cullGroup, CModel* model)
|
||||
const void* key = m->vertexRenderer.get();
|
||||
if (!rdata || rdata->GetKey() != key)
|
||||
{
|
||||
model->InvalidatePosition();
|
||||
rdata = m->vertexRenderer->CreateModelData(key, model);
|
||||
model->SetRenderData(rdata);
|
||||
model->SetDirty(~0u);
|
||||
|
||||
@@ -248,6 +248,9 @@ void CRenderingOptions::ReadConfigAndSetupHooks()
|
||||
m_GPUSkinning = true;
|
||||
else
|
||||
LOGMESSAGE("GPU skinning isn't supported on the current hardware.");
|
||||
|
||||
if (CRenderer::IsInitialised())
|
||||
g_Renderer.MakeShadersDirty();
|
||||
});
|
||||
|
||||
m_ConfigHooks->Setup("renderactors", m_RenderActors);
|
||||
|
||||
Reference in New Issue
Block a user