diff options
author | Sven Göthel <[email protected]> | 2024-01-22 05:38:15 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-22 05:38:15 +0100 |
commit | ffe4e670c9d35121934c6f3c95067d9c18aee386 (patch) | |
tree | 1c59963b7f1ad24ae92fd2724e527cff5df07a64 /src/graphui | |
parent | 93adc67938cfcf00fc5f5f5efb78cd6319ffdc31 (diff) |
Bug 1488 - Graph RegionRenderer Shader Mapping: Revert to IntObjectHashMap and throw exception on shaderKey collision
Commit 6363ae5fb6975a6f2e7c1093ce81f25b699e3e61 changed
RegionRenderer.useShaderProgram()'s shader mapping using a new ShaderKey instance.
Such ShaderKey instance is created every time @ RegionRenderer.useShaderProgram()
to retrieve the ShaderProgram from the HashMap<ShaderKey, Shader Program>.
While this is most correct, creating the ShaderKey instance causes
a lot of temp objects.
ShaderKey also uses the optional colorTexSeq shader code for equality test
in case of hash-collisions.
Previous code simply ignored hash-collisions and used a 1:1 hashCode -> ShaderProgram mapping using our IntObjectHashMap.
However, there was no test whether collision occur.
+++
Solution would be either
1- Revert fully to the previous code just using an IntObjectHashMap,
but throwing a RuntimeException in case of hashCode collisions.
In case of a collisions, we would need to produce a better hashCode.
This is possible, as the underlying data is fully internal .. etc.
2- Use the IntObjectHashMap as long there is no hashCode collision,
then revert back to HashMap<ShaderKey, Shader Program>.
+++
This patch implements variant (1), so far no exception has been thrown on
multiple demos w/ and w/o diff color-textures.
Diffstat (limited to 'src/graphui')
0 files changed, 0 insertions, 0 deletions