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
/*
Copyright (c) 2017 DIVIDE-Studio
Copyright (c) 2009 Ionut Cava

This file is part of DIVIDE Framework.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software
and associated documentation files (the "Software"), to deal in the Software
without restriction,
including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

#ifndef _RENDER_TARGET_DRAW_DESCRIPTOR_H_
#define _RENDER_TARGET_DRAW_DESCRIPTOR_H_

#include "RTAttachment.h"
#include "Platform/Video/Headers/BlendingProperties.h"

namespace Divide {

// 4 should be more than enough even for batching multiple render targets together
constexpr U8 MAX_RT_COLOUR_ATTACHMENTS = 4;

class RTDrawMask {
  public:
    RTDrawMask();

    bool isEnabled(RTAttachmentType type, U8 index) const;
    void setEnabled(RTAttachmentType type, U8 index, const bool state);

    void enableAll();
    void disableAll();

    bool operator==(const RTDrawMask& other) const;
    bool operator!=(const RTDrawMask& other) const;

  private:
    bool _disabledDepth;
    bool _disabledStencil;
    std::array<bool, MAX_RT_COLOUR_ATTACHMENTS> _disabledColours;
};

struct RTBlendState {
    bool _blendEnable = false;
    UColour _blendColour = UColour(0);
    BlendingProperties _blendProperties;

    bool operator==(const RTBlendState& other) const;
    bool operator!=(const RTBlendState& other) const;
};

class RTDrawDescriptor {
  public: 
    enum class State : U32 {
        CLEAR_COLOUR_BUFFERS = toBit(1),
        CLEAR_DEPTH_BUFFER = toBit(2),
        CHANGE_VIEWPORT = toBit(3),
        COUNT = 3
    };

  public:
    RTDrawDescriptor();

    void stateMask(U32 stateMask);
    void enableState(State state);
    void disableState(State state);
    bool isEnabledState(State state) const;

    inline RTDrawMask& drawMask() { return _drawMask; }
    inline const RTDrawMask& drawMask() const { return _drawMask; }
    inline U32 stateMask() const { return _stateMask; }

    inline RTBlendState& blendState(U8 index) { return _blendStates[index]; }
    inline const RTBlendState& blendState(U8 index) const{ return _blendStates[index]; }

    bool operator==(const RTDrawDescriptor& other) const;
    bool operator!=(const RTDrawDescriptor& other) const;

  protected:
    RTDrawMask _drawMask;
    U32 _stateMask;
    std::array<RTBlendState, MAX_RT_COLOUR_ATTACHMENTS> _blendStates;
};

}; //namespace Divide

#endif //_RENDER_TARGET_DRAW_DESCRIPTOR_H_

Commits for Divide-Framework/trunk/Source Code/Platform/Video/Buffers/RenderTarget/Headers/RTDrawDescriptor.h

Diff revisions: vs.
Revision Author Commited Message
1004 Diff Diff IonutCava picture IonutCava Wed 20 Dec, 2017 17:16:32 +0000

[Ionut]
- More GUI cleanup (added multiple GUIButton events)
- Typedef vec4<U8> and vec4<F32> to UColour and FColour respectively for easier to read code.

912 Diff Diff IonutCava picture IonutCava Sun 02 Jul, 2017 23:42:39 +0000

[Ionut]
- Add experimental Weighted Blended Order Independed Transparency (ref: http://casual-effects.blogspot.co.uk/2015/03/implemented-weighted-blended-order.html)
— Add per drawbuffer blend
— All translucent renderbin items go via the new OIT 2-step rendering: accumulation and composition
- Make sure we have proper blend enabled for text rendering
- Add a primitive form of PushConstants (unused yet. Emulated via Uniform calls)
- Fix bug with XMLParser not using case insensitive key lookups

898 Diff Diff IonutCava picture IonutCava Thu 22 Jun, 2017 22:05:34 +0000

[IonutCava]
- Use vectorImpl instead of vector in the few remaining places it wasn’t used
- Force GLIM to use the submitRenderCommand / GenericDrawCommand system
- Add basic framework for a “pushConstants” type buffer that will replace Uniform() calls
- Add some code to allow hardware query rewrite in the future

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

818 Diff Diff IonutCava picture IonutCava Mon 16 Jan, 2017 17:23:20 +0000

[IonutCava]
- Units get their bound node setup by the SGN UnitComponent and not during creation
- Profile guided optimizations

807 Diff Diff IonutCava picture IonutCava Mon 09 Jan, 2017 17:06:26 +0000

[IonutCava]
- Split PlatformDefines.h into 2. Move data type defines to PlatformDataTypes.h
- Continue to improve velocity map calculation
- Remove “destroy()” calls from most classes. Attempt to move as many classes to the RAII system.

806 Diff Diff IonutCava picture IonutCava Sun 08 Jan, 2017 22:00:48 +0000

[IonutCava]
- Finish implementing per-fragment velocity computation using a compute shader
— Further tuning still needed
- Add VS2017 build targets

765 Diff Diff IonutCava picture IonutCava Mon 22 Aug, 2016 15:48:12 +0000

[IonutCava]
- Descriptor/State cleanup part 1/3: RTDrawDescriptor refactoring

762 Diff Diff IonutCava picture IonutCava Thu 11 Aug, 2016 16:18:35 +0000

[IonutCava]
- Removed a lot of high level GFX state and merged it back on a lower level:
— depth mask is now a framebuffer specific toggle controlled by the RenderPolicy
— rasterization is now a per-buffer draw switch toggled by a rendering flag in GenericDrawCommand
- Replaced old style GL texture binding code with DSA style glBindTextures and glBindSamplers even for single textures
— completely removed the concept of a active texture unit in the GL code
- Fixed some draw policy settings that were clearing the depth buffer in the PostFX passes
- More build type flag replacement of macros
- Render pass system bug fixing
- Add option to skip occlusion culling for certain nodes

734 IonutCava picture IonutCava Tue 21 Jun, 2016 16:28:11 +0000

[IonutCava]
- Added a render target pool:
— All render targets are now allocated (and tracked) by the GFXDevice.
— Allocation routines return a slim RenderTargetHandle object that will be used later on in draw commands.

- Added a refraction render pass that will handle translucent objects that need refracted textures instead of clear transparency
— Both reflective nodes and refractive nodes are not gathered properly at this point

- All API specific objects (buffers, textures, etc) are now initialized in the GFXDevice class (see GFXDeviceObjects.cpp)
— This allowed for the slimming of the RenderAPIWrapper interface

- Improved ENABLE_GPU_VALIDATION macro utilization:
— It enabled shadow map split plane debugging
— It bypasses loading shaders from text cache