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:
@@ -43,13 +43,6 @@ public:
|
||||
void SetUniformVec4(const char* name, float x, float y, float z, float w) override;
|
||||
void SetUniformMat4(const char* name, const float* value) override;
|
||||
|
||||
void SetGlobalInt(const char* name, int value) override;
|
||||
void SetGlobalFloat(const char* name, float value) override;
|
||||
void SetGlobalVec3(const char* name, float x, float y, float z) override;
|
||||
void SetGlobalVec4(const char* name, float x, float y, float z, float w) override;
|
||||
void SetGlobalMat4(const char* name, const float* value) override;
|
||||
void SetGlobalTexture(const char* name, RHIResourceView* texture) override;
|
||||
|
||||
void TransitionBarrier(RHIResourceView* resource, ResourceStates stateBefore, ResourceStates stateAfter) override;
|
||||
void TransitionBarrier(ID3D12Resource* resource, ResourceStates stateBefore, ResourceStates stateAfter);
|
||||
void TransitionBarrierInternal(ID3D12Resource* resource, ResourceStates stateBefore, ResourceStates stateAfter, uint32_t subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES);
|
||||
@@ -164,12 +157,6 @@ private:
|
||||
|
||||
D3D12Shader* m_currentShader;
|
||||
class D3D12PipelineLayout* m_currentPipelineLayout;
|
||||
std::unordered_map<std::string, int> m_globalIntCache;
|
||||
std::unordered_map<std::string, float> m_globalFloatCache;
|
||||
std::unordered_map<std::string, std::vector<float>> m_globalVec3Cache;
|
||||
std::unordered_map<std::string, std::vector<float>> m_globalVec4Cache;
|
||||
std::unordered_map<std::string, std::vector<float>> m_globalMat4Cache;
|
||||
std::unordered_map<std::string, RHIResourceView*> m_globalTextureCache;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
|
||||
@@ -60,13 +60,6 @@ public:
|
||||
void SetUniformVec4(const char* name, float x, float y, float z, float w) override;
|
||||
void SetUniformMat4(const char* name, const float* value) override;
|
||||
|
||||
void SetGlobalInt(const char* name, int value) override;
|
||||
void SetGlobalFloat(const char* name, float value) override;
|
||||
void SetGlobalVec3(const char* name, float x, float y, float z) override;
|
||||
void SetGlobalVec4(const char* name, float x, float y, float z, float w) override;
|
||||
void SetGlobalMat4(const char* name, const float* value) override;
|
||||
void SetGlobalTexture(const char* name, RHIResourceView* texture) override;
|
||||
|
||||
void SetPipelineState(RHIPipelineState* pipelineState) override;
|
||||
void SetGraphicsDescriptorSets(
|
||||
uint32_t firstSet,
|
||||
@@ -203,12 +196,6 @@ private:
|
||||
unsigned int m_currentVAO;
|
||||
unsigned int m_currentProgram;
|
||||
OpenGLShader* m_currentShader;
|
||||
std::unordered_map<std::string, int> m_globalIntCache;
|
||||
std::unordered_map<std::string, float> m_globalFloatCache;
|
||||
std::unordered_map<std::string, std::vector<float>> m_globalVec3Cache;
|
||||
std::unordered_map<std::string, std::vector<float>> m_globalVec4Cache;
|
||||
std::unordered_map<std::string, std::vector<float>> m_globalMat4Cache;
|
||||
std::unordered_map<std::string, RHIResourceView*> m_globalTextureCache;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
|
||||
@@ -70,13 +70,6 @@ public:
|
||||
virtual void SetUniformVec4(const char* name, float x, float y, float z, float w) = 0;
|
||||
virtual void SetUniformMat4(const char* name, const float* value) = 0;
|
||||
|
||||
virtual void SetGlobalInt(const char* name, int value) = 0;
|
||||
virtual void SetGlobalFloat(const char* name, float value) = 0;
|
||||
virtual void SetGlobalVec3(const char* name, float x, float y, float z) = 0;
|
||||
virtual void SetGlobalVec4(const char* name, float x, float y, float z, float w) = 0;
|
||||
virtual void SetGlobalMat4(const char* name, const float* value) = 0;
|
||||
virtual void SetGlobalTexture(const char* name, RHIResourceView* texture) = 0;
|
||||
|
||||
virtual void SetPipelineState(RHIPipelineState* pso) = 0;
|
||||
virtual void SetGraphicsDescriptorSets(
|
||||
uint32_t firstSet,
|
||||
|
||||
Reference in New Issue
Block a user