Fix premultiplied alpha artifacts

This commit is contained in:
Krzosa Karol
2022-06-29 18:46:57 +02:00
parent 59dbbc2a57
commit efdc23ea57
5 changed files with 54 additions and 30 deletions

View File

@@ -4,20 +4,22 @@ enum ProfileScopeName {
};
struct ProfileScope {
U64 samples[5096];
U64 samples[5096*16];
S64 i;
};
global ProfileScope profile_scopes[ProfileScopeName_Count];
#define PROFILE_BEGIN(name) do { \
ProfileScope *__profile_scope = profile_scopes + ProfileScopeName_##name; \
__profile_scope->samples[__profile_scope->i] = __rdtsc(); \
} while (0)
#define PROFILE_END(name) do { \
ProfileScope *_profile_scope = profile_scopes + ProfileScopeName_##name; \
_profile_scope->samples[_profile_scope->i] = __rdtsc() - _profile_scope->samples[_profile_scope->i]; \
_profile_scope->i = (_profile_scope->i + 1) % 5096; \
}while (0)
#define PROFILE_BEGIN(name) \
do { \
ProfileScope *__profile_scope = profile_scopes + ProfileScopeName_##name; \
__profile_scope->samples[__profile_scope->i] = __rdtsc(); \
} while (0)
#define PROFILE_END(name) \
do { \
ProfileScope *_profile_scope = profile_scopes + ProfileScopeName_##name; \
_profile_scope->samples[_profile_scope->i] = \
__rdtsc() - _profile_scope->samples[_profile_scope->i]; \
_profile_scope->i = (_profile_scope->i + 1) % 5096*16; \
} while (0)