1
0
forked from 0ad/0ad

minor fixes:

whrt: output timer implementation info, fix assert ( 1/(x-epsilon) < 1/x
+ epsilon )
wsdl: fix slightly incorrect gamma values (first and last are now
exactly 0 and 1)

This was SVN commit r6321.
This commit is contained in:
janwas 2008-08-10 11:02:25 +00:00
parent 16c33c0245
commit 14ec3a3026
4 changed files with 14 additions and 8 deletions

View File

@ -18,6 +18,12 @@
#include "pmt.h" // PMT_FREQ
CounterQPC::CounterQPC()
: m_frequency(-1)
{
}
LibError CounterQPC::Activate()
{
// note: QPC is observed to be universally supported, but the API

View File

@ -16,10 +16,7 @@
class CounterQPC : public ICounter
{
public:
CounterQPC()
: m_frequency(-1)
{
}
CounterQPC();
virtual const char* Name() const
{

View File

@ -96,13 +96,14 @@ static void InitCounter()
nominalFrequency = counter->NominalFrequency();
resolution = counter->Resolution();
counterBits = counter->CounterBits();
counterMask = bit_mask<u64>(counterBits);
debug_printf("HRT: counter=%s freq=%f res=%f bits=%d\n", counter->Name(), nominalFrequency, resolution, counterBits);
// sanity checks
debug_assert(nominalFrequency >= 500.0-DBL_EPSILON);
debug_assert(resolution <= 2e-3+DBL_EPSILON);
debug_assert(resolution <= 2e-3);
debug_assert(8 <= counterBits && counterBits <= 64);
counterMask = bit_mask<u64>(counterBits);
}
static void ShutdownCounter()

View File

@ -111,10 +111,12 @@ private:
for(int i = 0; i < 256; i++)
{
const double val = pow((i+1) / 256.0, (double)gamma);
const double val = pow(i/255.0, (double)gamma);
const double clamped = std::max(0.0, std::min(val, 1.0-DBL_EPSILON));
ramp[i] = u16_from_double(clamped);
}
debug_assert(ramp[0] == 0);
debug_assert(ramp[255] == 0xFFFF);
}
bool Upload(u16* ramps)