Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include "stdafx.h"

#include "Headers/GenericDrawCommand.h"

#include "Core/Math/Headers/MathHelper.h"
#include "Platform/Video/Headers/RenderAPIEnums.h"

namespace Divide {

namespace GenericDrawCommandResults {
    hashMapImpl<I64, QueryResult> g_queryResults;
};

IndirectDrawCommand::IndirectDrawCommand()
    : indexCount(0),
      primCount(1),
      firstIndex(0),
      baseVertex(0),
      baseInstance(0)
{
    static_assert(sizeof(IndirectDrawCommand) == 20, "Size of IndirectDrawCommand is incorrect!");
}

void IndirectDrawCommand::set(const IndirectDrawCommand& other) {
    indexCount = other.indexCount;
    primCount = other.primCount;
    firstIndex = other.firstIndex;
    baseVertex = other.baseVertex;
    baseInstance = other.baseInstance;
}

bool IndirectDrawCommand::operator==(const IndirectDrawCommand &other) const {
    return indexCount == other.indexCount &&
           primCount == other.primCount &&
           firstIndex == other.firstIndex &&
           baseVertex == other.baseVertex &&
           baseInstance == other.baseInstance;
}

GenericDrawCommand::GenericDrawCommand()
    : GenericDrawCommand(PrimitiveType::TRIANGLE_STRIP, 0, 0)
{
}

GenericDrawCommand::GenericDrawCommand(PrimitiveType type,
                                       U32 firstIndex,
                                       U32 indexCount,
                                       U32 primCount)
  : _lodIndex(0),
    _drawCount(1),
    _drawToBuffer(0),
    _type(type),
    _commandOffset(0),
    _patchVertexCount(4),
    _sourceBuffer(nullptr),
    _renderOptions(to_base(RenderOptions::RENDER_GEOMETRY))
{
    _cmd.indexCount = indexCount;
    _cmd.firstIndex = firstIndex;
    _cmd.primCount = primCount;

    static_assert(sizeof(GenericDrawCommand) == 56, "Size of GenericDrawCommand is incorrect!");
}

GenericDrawCommand::GenericDrawCommand(const GenericDrawCommand& other)
    : _cmd(other._cmd),
      _lodIndex(other._lodIndex),
      _drawCount(other._drawCount),
      _drawToBuffer(other._drawToBuffer),
      _renderOptions(other._renderOptions),
      _type(other._type),
      _sourceBuffer(other._sourceBuffer),
      _commandOffset(other._commandOffset)
{
}

const GenericDrawCommand& GenericDrawCommand::operator= (const GenericDrawCommand& other) {
    _cmd.set(other._cmd);
    _lodIndex = other._lodIndex;
    _drawCount = other._drawCount;
    _drawToBuffer = other._drawToBuffer;
    _renderOptions = other._renderOptions;
    _type = other._type;
    _sourceBuffer = other._sourceBuffer;
    _commandOffset = other._commandOffset;
    return *this;
}

void GenericDrawCommand::reset() {
    *this = GenericDrawCommand();
}

bool GenericDrawCommand::compatible(const GenericDrawCommand& other) const {
    return _lodIndex == other._lodIndex &&
           _drawToBuffer == other._drawToBuffer &&
           _renderOptions == other._renderOptions &&
           _type == other._type &&
           (_sourceBuffer != nullptr) == (other._sourceBuffer != nullptr);
}

bool GenericDrawCommand::isEnabledOption(RenderOptions option) const {
    return BitCompare(_renderOptions, to_U32(option));
}

void GenericDrawCommand::enableOption(RenderOptions option) {
    SetBit(_renderOptions, to_U32(option));
}

void GenericDrawCommand::disableOption(RenderOptions option) {
    ClearBit(_renderOptions, to_U32(option));
}

void GenericDrawCommand::toggleOption(RenderOptions option) {
    toggleOption(option, !isEnabledOption(option));
}

void GenericDrawCommand::toggleOption(RenderOptions option, const bool state) {
    if (state) {
        enableOption(option);
    } else {
        disableOption(option);
    }
}

}; //namespace Divide

Commits for Divide-Framework/trunk/Source Code/Platform/Video/GenericDrawCommand.cpp

Diff revisions: vs.
Revision Author Commited Message
949 Diff Diff IonutCava picture IonutCava Thu 19 Oct, 2017 21:48:37 +0000

[Ionut]
- More command buffer refactoring

932 Diff Diff IonutCava picture IonutCava Mon 14 Aug, 2017 16:17:59 +0000

[Ionut]
- Transition every GPU call to the new GFX::CommandBuffer system.
- Part 1/3: Infrastructure. Does not compile yet; (ToDo: part 2/3: transition commands to new infrastructure. part 3/3: debug and optimize)

Currently supported commands:
BEGIN_RENDER_PASS
END_RENDER_PASS
BEGIN_RENDER_SUB_PASS
END_RENDER_SUB_PASS
SET_VIEWPORT
SET_SCISSOR
BIND_PIPELINE
BIND_DESCRIPTOR_SETS
SEND_PUSH_CONSTANTS
DRAW_COMMANDS
DRAW_TEXT
DISPATCH_COMPUTE

930 Diff Diff IonutCava picture IonutCava Sun 13 Aug, 2017 20:33:31 +0000

[Ionut]
- Fix a bug with Push Constant to Uniform conversion
- Add more push constant types
- Fix RENDER_INDIRECT param for draw commands
- Cleanup Sky, Terrain and Vegetation a bit

929 Diff Diff IonutCava picture IonutCava Sat 12 Aug, 2017 17:34:44 +0000

[Ionut]
- More work on finishing up new PushConstant / Command buffer rendering system:
— Everything compiles and runs but with graphical and performance issues

928 Diff Diff IonutCava picture IonutCava Fri 11 Aug, 2017 16:20:37 +0000

[Ionut]
- Started porting Shader uniforms to more generic PushConstants (Part 1/2: does not compile yet)
— Implemented in OpenGL via Uniform emulation

904 Diff Diff IonutCava picture IonutCava Sun 25 Jun, 2017 21:38:57 +0000

[Ionut]
- Rework the way GPU queries are handled via GenericDrawCommand rendering options.

895 Diff Diff IonutCava picture IonutCava Wed 21 Jun, 2017 21:10:26 +0000

[IonutCava]
- Reorder and cleanup OpenGL backend a bit.
- Small code cleanup
- Some small profile-guided optimizations

893 Diff Diff IonutCava picture IonutCava Sun 18 Jun, 2017 17:33:07 +0000

[Ionut]
- Initial implementation of a PipelineStateObject (holds shader program, rasterizer state, etc)
- Rework PCH implementation a bit because VS2017 no longer has a /ZM option

890 Diff Diff IonutCava picture IonutCava Sun 14 May, 2017 20:54:59 +0000

[Ionut]
- Add pre-compiled header support
- Initial code for per-stage tessellation computation

882 IonutCava picture IonutCava Thu 23 Mar, 2017 16:49:48 +0000

[IonutCava]
- More work on tessellated terrain rendering: got the mesh to render properly and match the collision mesh’s layout.
- Fixed a bug with GenericDrawCommand RenderOptions
- Added a “query number of generated primitives” option to GenericDrawCommand