mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
change ContextStats::evalDelta to better handle wrapping values in graphics stats
This commit is contained in:
parent
97c4726e1e
commit
c5e1f2aedc
4 changed files with 32 additions and 22 deletions
|
@ -309,7 +309,7 @@ void GLBackend::setResourceTexture(unsigned int slot, const TexturePointer& reso
|
|||
glActiveTexture(GL_TEXTURE0 + slot);
|
||||
glBindTexture(textureState._target, to);
|
||||
(void)CHECK_GL_ERROR();
|
||||
_stats._RSAmountTextureMemoryBounded += (int)object->size();
|
||||
_stats._RSAmountTextureMemoryBounded += (uint64_t)object->size();
|
||||
|
||||
} else {
|
||||
releaseResourceTexture(slot);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include <limits>
|
||||
#include "Context.h"
|
||||
|
||||
#include <shared/GlobalAppProperties.h>
|
||||
|
@ -18,19 +19,28 @@
|
|||
|
||||
using namespace gpu;
|
||||
|
||||
template<typename T>
|
||||
T subWrap(T endValue, T beginValue) {
|
||||
if (endValue >= beginValue) {
|
||||
return endValue - beginValue;
|
||||
} else {
|
||||
return endValue + ((std::numeric_limits<T>::max() - beginValue) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ContextStats::evalDelta(const ContextStats& begin, const ContextStats& end) {
|
||||
_ISNumFormatChanges = end._ISNumFormatChanges - begin._ISNumFormatChanges;
|
||||
_ISNumInputBufferChanges = end._ISNumInputBufferChanges - begin._ISNumInputBufferChanges;
|
||||
_ISNumIndexBufferChanges = end._ISNumIndexBufferChanges - begin._ISNumIndexBufferChanges;
|
||||
_ISNumFormatChanges = subWrap<uint32_t>(end._ISNumFormatChanges, begin._ISNumFormatChanges);
|
||||
_ISNumInputBufferChanges = subWrap<uint32_t>(end._ISNumInputBufferChanges, begin._ISNumInputBufferChanges);
|
||||
_ISNumIndexBufferChanges = subWrap<uint32_t>(end._ISNumIndexBufferChanges, begin._ISNumIndexBufferChanges);
|
||||
|
||||
_RSNumTextureBounded = end._RSNumTextureBounded - begin._RSNumTextureBounded;
|
||||
_RSAmountTextureMemoryBounded = end._RSAmountTextureMemoryBounded - begin._RSAmountTextureMemoryBounded;
|
||||
_RSNumTextureBounded = subWrap<uint32_t>(end._RSNumTextureBounded, begin._RSNumTextureBounded);
|
||||
_RSAmountTextureMemoryBounded = subWrap<uint64_t>(end._RSAmountTextureMemoryBounded, begin._RSAmountTextureMemoryBounded);
|
||||
|
||||
_DSNumAPIDrawcalls = end._DSNumAPIDrawcalls - begin._DSNumAPIDrawcalls;
|
||||
_DSNumDrawcalls = end._DSNumDrawcalls - begin._DSNumDrawcalls;
|
||||
_DSNumTriangles= end._DSNumTriangles - begin._DSNumTriangles;
|
||||
_DSNumAPIDrawcalls = subWrap<uint32_t>(end._DSNumAPIDrawcalls, begin._DSNumAPIDrawcalls);
|
||||
_DSNumDrawcalls = subWrap<uint32_t>(end._DSNumDrawcalls, begin._DSNumDrawcalls);
|
||||
_DSNumTriangles= subWrap<uint32_t>(end._DSNumTriangles, begin._DSNumTriangles);
|
||||
|
||||
_PSNumSetPipelines = end._PSNumSetPipelines - begin._PSNumSetPipelines;
|
||||
_PSNumSetPipelines = subWrap<uint32_t>(end._PSNumSetPipelines, begin._PSNumSetPipelines);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,19 +32,19 @@ namespace gpu {
|
|||
|
||||
struct ContextStats {
|
||||
public:
|
||||
int _ISNumFormatChanges = 0;
|
||||
int _ISNumInputBufferChanges = 0;
|
||||
int _ISNumIndexBufferChanges = 0;
|
||||
uint32_t _ISNumFormatChanges { 0 };
|
||||
uint32_t _ISNumInputBufferChanges { 0 };
|
||||
uint32_t _ISNumIndexBufferChanges { 0 };
|
||||
|
||||
int _RSNumResourceBufferBounded = 0;
|
||||
int _RSNumTextureBounded = 0;
|
||||
int _RSAmountTextureMemoryBounded = 0;
|
||||
uint32_t _RSNumResourceBufferBounded { 0 };
|
||||
uint32_t _RSNumTextureBounded { 0 };
|
||||
uint64_t _RSAmountTextureMemoryBounded { 0 };
|
||||
|
||||
int _DSNumAPIDrawcalls = 0;
|
||||
int _DSNumDrawcalls = 0;
|
||||
int _DSNumTriangles = 0;
|
||||
uint32_t _DSNumAPIDrawcalls { 0 };
|
||||
uint32_t _DSNumDrawcalls { 0 };
|
||||
uint32_t _DSNumTriangles { 0 };
|
||||
|
||||
int _PSNumSetPipelines = 0;
|
||||
uint32_t _PSNumSetPipelines { 0 };
|
||||
|
||||
ContextStats() {}
|
||||
ContextStats(const ContextStats& stats) = default;
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace render {
|
|||
|
||||
Q_PROPERTY(quint32 frameTextureCount MEMBER frameTextureCount NOTIFY dirty)
|
||||
Q_PROPERTY(quint32 frameTextureRate MEMBER frameTextureRate NOTIFY dirty)
|
||||
Q_PROPERTY(quint32 frameTextureMemoryUsage MEMBER frameTextureMemoryUsage NOTIFY dirty)
|
||||
Q_PROPERTY(quint64 frameTextureMemoryUsage MEMBER frameTextureMemoryUsage NOTIFY dirty)
|
||||
|
||||
Q_PROPERTY(quint32 frameSetPipelineCount MEMBER frameSetPipelineCount NOTIFY dirty)
|
||||
Q_PROPERTY(quint32 frameSetInputFormatCount MEMBER frameSetInputFormatCount NOTIFY dirty)
|
||||
|
@ -124,4 +124,4 @@ namespace render {
|
|||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue