Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
aras-p committed Mar 23, 2018
1 parent 547b7cd commit fa45e87
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Cpp/Windows/TestWin.cpp
Expand Up @@ -138,7 +138,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
QueryPerformanceCounter(&time1);
float t = float(clock()) / CLOCKS_PER_SEC;
static int s_FrameCount = 0;
DrawTest(t, s_FrameCount++, g_BackbufferWidth, g_BackbufferHeight, g_Backbuffer);
static size_t s_RayCounter = 0;
int rayCount;
DrawTest(t, s_FrameCount++, g_BackbufferWidth, g_BackbufferHeight, g_Backbuffer, rayCount);
s_RayCounter += rayCount;
LARGE_INTEGER time2;
QueryPerformanceCounter(&time2);

Expand All @@ -157,9 +160,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
QueryPerformanceFrequency(&frequency);

double s = double(s_Time) / double(frequency.QuadPart) / s_Count;
sprintf_s(s_Buffer, sizeof(s_Buffer), "ms: %.2f FPS %.1f\n", s * 1000.0f, 1.f / s);
sprintf_s(s_Buffer, sizeof(s_Buffer), "%.2fms (%.1f FPS) %.1fMrays/s %.2fMrays/frame frames %i\n", s * 1000.0f, 1.f / s, s_RayCounter / s_Count / s * 1.0e-6f, s_RayCounter / s_Count * 1.0e-6f, s_FrameCount);
OutputDebugStringA(s_Buffer);
s_Count = 0;
s_Time = 0;
s_RayCounter = 0;
}
RECT textRect;
textRect.left = 5;
Expand Down
2 changes: 1 addition & 1 deletion Cs/Program.cs
Expand Up @@ -36,7 +36,7 @@ static void Main(string[] args)
bytes[i + 0] = (byte)(System.Math.Clamp(backbuffer[i + 2], 0.0f, 1.0f) * 255.0f);
bytes[i + 1] = (byte)(System.Math.Clamp(backbuffer[i + 1], 0.0f, 1.0f) * 255.0f);
bytes[i + 2] = (byte)(System.Math.Clamp(backbuffer[i + 0], 0.0f, 1.0f) * 255.0f);
bytes[i + 3] = (byte)(System.Math.Clamp(backbuffer[i + 3], 0.0f, 1.0f) * 255.0f);
bytes[i + 3] = 255;
}
byte[] header = {
0, // ID length
Expand Down
2 changes: 2 additions & 0 deletions Cs/TestCs.csproj
Expand Up @@ -3,6 +3,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<StartupObject>Program</StartupObject>
<ApplicationIcon />
</PropertyGroup>

<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
Expand Down

0 comments on commit fa45e87

Please sign in to comment.