aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 4a97fa7866dc571aa4986a7f57ddc49b1e7aceb7 (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
QtD3D12Window is a Qt 5.6 module providing a QD3D12Window class
similar to QOpenGLWindow, a handy qmake rule for offline HLSL shader
compilation via fxc, and a number of basic examples.

In the .pro file, add:

    QT += d3d12window

Then use it like QOpenGLWindow:

    class Window : public QD3D12Window
    {
    public:
        void initializeD3D() { create command list etc. }
        void resizeD3D(const QSize &size) { ... }
        void paintD3D() { populate and execute command list }
        void afterPresent() { wait as necessary }
    };

Use QWidget::createWindowContainer() to embed into widget-based UIs.

To use the qmake rule to generate headers from shaders at build time,
copy hlsl.prf to mkspecs/features folder of the Qt SDK.

    VSPS = shader.hlsl

    vshader.input = VSPS
    vshader.header = shader_vs.h
    vshader.entry = VS_MyShader
    vshader.type = vs_5_0

    pshader.input = VSPS
    pshader.header = shader_ps.h
    pshader.entry = PS_MyShader
    pshader.type = ps_5_0

    HLSL_SHADERS = vshader pshader
    load(hlsl)

Examples in order of increasing complexity:

1. hellowindow - Bringing up a window and clearing the backbuffer

2. hellodevicereset - Handle device removed errors and make the application able to survive a driver update, shader timeout, etc.

3. hellotriangle - Basic rendering, shader and pipeline setup, constant buffers

4. hellotexture - Texturing, mipmaps

5. hellooffscreen - Rendering into offscreen render targets, then using them from the pixel shader

       hellooffscreen_opengl - OpenGL version, for comparing performance, overhead, etc.

6. hellomultisample - Rendering with MSAA

7. hellocompressedtexture - Compressed textures loaded from DDS files

8. hellogpumipmap - Mipmap generation via compute shaders