RHI: Remove无效的SetGlobal*方法 - 死代码清理
问题:SetGlobal*方法(SetGlobalInt/SetGlobalFloat/SetGlobalVec3/SetGlobalVec4/SetGlobalMat4/SetGlobalTexture)在D3D12和OpenGL中都只是缓存值,从不提交到GPU。 移除内容: - RHICommandList.h: 移除6个SetGlobal*纯虚方法声明 - D3D12CommandList.h/cpp: 移除6个override声明+6个缓存变量+6个方法实现+Shutdown()中的缓存清理 - OpenGLCommandList.h/cpp: 同上 原因: - SetGlobal*从未被代码库调用(死代码) - SetUniform*已正常工作,使用shader reflection+实际GPU绑定 - 移除后无功能损失 测试状态:150个RHI单元测试全部通过,8个集成测试全部通过
This commit is contained in:
@@ -63,12 +63,6 @@ void D3D12CommandList::Shutdown() {
|
||||
m_resourceStateMap.clear();
|
||||
m_trackedResources.clear();
|
||||
m_currentShader = nullptr;
|
||||
m_globalIntCache.clear();
|
||||
m_globalFloatCache.clear();
|
||||
m_globalVec3Cache.clear();
|
||||
m_globalVec4Cache.clear();
|
||||
m_globalMat4Cache.clear();
|
||||
m_globalTextureCache.clear();
|
||||
}
|
||||
|
||||
void D3D12CommandList::Reset() {
|
||||
@@ -163,30 +157,6 @@ void D3D12CommandList::SetUniformMat4(const char* name, const float* value) {
|
||||
}
|
||||
}
|
||||
|
||||
void D3D12CommandList::SetGlobalInt(const char* name, int value) {
|
||||
m_globalIntCache[name] = value;
|
||||
}
|
||||
|
||||
void D3D12CommandList::SetGlobalFloat(const char* name, float value) {
|
||||
m_globalFloatCache[name] = value;
|
||||
}
|
||||
|
||||
void D3D12CommandList::SetGlobalVec3(const char* name, float x, float y, float z) {
|
||||
m_globalVec3Cache[name] = { x, y, z };
|
||||
}
|
||||
|
||||
void D3D12CommandList::SetGlobalVec4(const char* name, float x, float y, float z, float w) {
|
||||
m_globalVec4Cache[name] = { x, y, z, w };
|
||||
}
|
||||
|
||||
void D3D12CommandList::SetGlobalMat4(const char* name, const float* value) {
|
||||
m_globalMat4Cache[name] = std::vector<float>(value, value + 16);
|
||||
}
|
||||
|
||||
void D3D12CommandList::SetGlobalTexture(const char* name, RHIResourceView* texture) {
|
||||
m_globalTextureCache[name] = texture;
|
||||
}
|
||||
|
||||
void D3D12CommandList::TransitionBarrier(RHIResourceView* resource, ResourceStates stateBefore, ResourceStates stateAfter) {
|
||||
if (!resource || !resource->IsValid()) return;
|
||||
D3D12ResourceView* d3d12View = static_cast<D3D12ResourceView*>(resource);
|
||||
|
||||
@@ -429,12 +429,6 @@ void OpenGLCommandList::PopDebugGroup() {
|
||||
|
||||
void OpenGLCommandList::Shutdown() {
|
||||
m_currentShader = nullptr;
|
||||
m_globalIntCache.clear();
|
||||
m_globalFloatCache.clear();
|
||||
m_globalVec3Cache.clear();
|
||||
m_globalVec4Cache.clear();
|
||||
m_globalMat4Cache.clear();
|
||||
m_globalTextureCache.clear();
|
||||
}
|
||||
|
||||
void OpenGLCommandList::Reset() {
|
||||
@@ -480,30 +474,6 @@ void OpenGLCommandList::SetUniformMat4(const char* name, const float* value) {
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetGlobalInt(const char* name, int value) {
|
||||
m_globalIntCache[name] = value;
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetGlobalFloat(const char* name, float value) {
|
||||
m_globalFloatCache[name] = value;
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetGlobalVec3(const char* name, float x, float y, float z) {
|
||||
m_globalVec3Cache[name] = {x, y, z};
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetGlobalVec4(const char* name, float x, float y, float z, float w) {
|
||||
m_globalVec4Cache[name] = {x, y, z, w};
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetGlobalMat4(const char* name, const float* value) {
|
||||
m_globalMat4Cache[name] = std::vector<float>(value, value + 16);
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetGlobalTexture(const char* name, RHIResourceView* texture) {
|
||||
m_globalTextureCache[name] = texture;
|
||||
}
|
||||
|
||||
void OpenGLCommandList::TransitionBarrier(RHIResourceView* resource, ResourceStates stateBefore, ResourceStates stateAfter) {
|
||||
(void)resource;
|
||||
(void)stateBefore;
|
||||
|
||||
Reference in New Issue
Block a user