Share GPU skinning palette per instance; push it once per change
Render3DDraw/HardwareBatch hold the SDK's shared palette instead of copying 16 floats per bone per draw, and HardwareScene re-pushes the uniform only when the palette pointer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1eccdc87d7
commit
837ccc2f31
@@ -67,7 +67,7 @@ Render3DDraw ToRender3DDraw(gr2_render::Gr2MeshDraw&& mesh) {
|
||||
draw.indices = std::move(mesh.indices);
|
||||
draw.bone_indices = std::move(mesh.bone_indices);
|
||||
draw.bone_weights = std::move(mesh.bone_weights);
|
||||
draw.bone_matrices = std::move(mesh.bone_matrices);
|
||||
draw.palette = std::move(mesh.palette);
|
||||
draw.alpha_test = mesh.alpha_test;
|
||||
draw.alpha_ref = mesh.alpha_ref;
|
||||
draw.cull_mode = mesh.double_sided ? 1 : 2;
|
||||
@@ -914,7 +914,7 @@ void Gr2SceneRenderer::RenderSceneGPU(SDL_Renderer* renderer, const std::vector<
|
||||
t.fogColor[0]=fog_r;t.fogColor[1]=fog_g;t.fogColor[2]=fog_b;
|
||||
t.fogParams[0]=m_fog_density;t.fogParams[1]=m_fog_near;t.fogParams[2]=m_fog_far;
|
||||
t.modes[0]=1;t.modes[1]=draw.lighting ? 1.f : 0.f;t.modes[2]=m_fog_enabled&&draw.fog ? (m_fog_exp ? 2.f : 1.f) : 0.f;t.modes[3]=draw.z_enable ? 0.f : 1.f;
|
||||
if(draw.gpu_skinning){batch.palette=draw.bone_matrices;t.skin[0]=batch.palette.size()/16;}
|
||||
if(draw.gpu_skinning && draw.palette){batch.palette=draw.palette;t.skin[0]=batch.palette->size()/16;}
|
||||
batch.indexCount=mesh.indices.size();
|
||||
if(!batch.geometry) {
|
||||
const uint32_t base=m_hardwareVertices.size();batch.firstIndex=m_hardwareIndices.size();
|
||||
|
||||
Reference in New Issue
Block a user