summaryrefslogtreecommitdiffstats
path: root/Projects/Asteroids/src/settings.h
blob: 1bee66492dfd6441f982dbf65012d63c35d1fd59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright 2014 Intel Corporation All Rights Reserved
//
// Intel makes no representations about the suitability of this software for any purpose.  
// THIS SOFTWARE IS PROVIDED ""AS IS."" INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES,
// EXPRESS OR IMPLIED, AND ALL LIABILITY, INCLUDING CONSEQUENTIAL AND OTHER INDIRECT DAMAGES,
// FOR THE USE OF THIS SOFTWARE, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PROPRIETARY
// RIGHTS, AND INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// Intel does not assume any responsibility for any errors which may appear in this software
// nor any responsibility to update it.

#pragma once

#include "camera.h"
#include "common_defines.h"

// Profiling
#define ENABLE_VTUNE_TASK_PROFILING 1

// Content settings
#ifdef _DEBUG
enum { NUM_ASTEROIDS = 2000 };
#else
enum { NUM_ASTEROIDS = 50000 };
#endif
enum { TEXTURE_DIM = 256 }; // Req'd to be pow2 at the moment
enum { TEXTURE_ANISO = 2 };
enum { NUM_UNIQUE_MESHES = 1000 };
enum { MESH_MAX_SUBDIV_LEVELS = 3 }; // 4x polys for each step.
// See common_defines.h for NUM_UNIQUE_TEXTURES (also needed by shader now)

#define SIM_ORBIT_RADIUS 450.f
#define SIM_DISC_RADIUS  120.f
#define SIM_MIN_SCALE    0.2f

// In FLIP swap chains the compositor owns one of your buffers at any given point
// Thus to run unconstrained (>vsync) frame rates, you need 3 buffers
enum { NUM_SWAP_CHAIN_BUFFERS = 5 };

// In D3D12, this is the pipeline depth in frames - larger = more latency, shorter = potential bubbles.
// Usually 2-4 are good values.
enum { NUM_FRAMES_TO_BUFFER = 3 };

// In D3D12 this is the number of command buffers we generate for the main scene rendering
// Also effectively max thread parallelism
enum { NUM_SUBSETS = 4 };

// Buffer size for dynamic sprite data
enum { MAX_SPRITE_VERTICES_PER_FRAME = 6 * 1024 };


// This structure is often copied/passed by value so don't put anything really expensive in it.
struct Settings
{
    double closeAfterSeconds = 0.0;

    int windowWidth = 1080;
    int windowHeight = 720;
    int renderWidth;
    int renderHeight;

    int numThreads = 0; // 0 means #cpu-1
    unsigned int lockedFrameRate = 15;

    bool logFrameTimes = false;
    bool vsync = 0;

    bool windowed = true;
    enum RenderMode
    {
        Undefined,
        NativeD3D11,
        NativeD3D12,
        DiligentD3D11,
        DiligentD3D12,
        DiligentVulkan
    }mode = DiligentD3D11;
       
    int resourceBindingMode = 3;  // Only for DiligentD3D12 and DiligentVk modes

    bool lockFrameRate = false;
    bool animate = true;

    // Multithreading actually makes debugging annoying so disable by default
#if defined(_DEBUG)
    bool multithreadedRendering = true;
#else
    bool multithreadedRendering = true;
#endif

    bool submitRendering = true;
    bool executeIndirect = false;
    bool warp = false;
};