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
/*
   Copyright (c) 2018 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_API_H_
#define _RENDER_API_H_

#include "CommandBuffer.h"
#include "Platform/Video/Buffers/RenderTarget/Headers/RenderTarget.h"

namespace std {
    class thread::id;
};

namespace CEGUI {
    class Texture;
};

namespace Divide {

enum class ErrorCode;

template <typename T>
class vec4;

class Configuration;
class DisplayWindow;
struct TextElementBatch;

FWD_DECLARE_MANAGED_CLASS(ShaderProgram);

struct VideoModes {
    // Video resolution
    I32 Width, Height;
    // Red bits per pixel
    I32 RedBits;
    // Green bits per pixel
    I32 GreenBits;
    // Blue bits per pixel
    I32 BlueBits;
};

typedef std::array<bool, to_base(VertexAttribute::COUNT)> AttribFlags;

struct GFXConfig {
    bool _enableDebugMsgGroups = true;
};
/// Renderer Programming Interface
class NOINITVTABLE RenderAPIWrapper : private NonCopyable {
   protected:
    friend class GFXDevice;
    /*Application display frame*/
    /// Clear buffers, set default states, etc
    virtual void beginFrame() = 0;
    /// Clear shaders, restore active texture units, etc
    virtual void endFrame() = 0;

    virtual ErrorCode initRenderingAPI(I32 argc, char** argv, Configuration& config) = 0;
    virtual void closeRenderingAPI() = 0;

    virtual void updateClipPlanes() = 0;

    // Returns the time in milliseconds that it took to render one frame
    // Queries are expensive, so this result MAY BE SEVERAL frames out of date!
    virtual U32 getFrameDurationGPU() = 0;

    virtual size_t setStateBlock(size_t stateBlockHash) = 0;

    virtual void flushCommandBuffer(GFX::CommandBuffer& commandBuffer) = 0;

    static GFXConfig& config() { return _config; }

    virtual vec2<U16> getDrawableSize(const DisplayWindow& window) const = 0;

    // The definition of a hack. Feel free to quote this. -Ionut
    /// Convert a CEGUI texture handle to something that our current rendering API can use
    virtual U32 getHandleFromCEGUITexture(const CEGUI::Texture& textureIn) const = 0;

   protected:
    virtual bool changeViewportInternal(const Rect<I32>& newViewport) = 0;
    virtual void registerCommandBuffer(const ShaderBuffer& commandBuffer) const = 0;

    static GFXConfig _config;
};

};  // namespace Divide

#endif

Commits for Divide-Framework/trunk/Source Code/Platform/Video/Headers/RenderAPIWrapper.h

Diff revisions: vs.
Revision Author Commited Message
1029 Diff Diff IonutCava picture IonutCava Tue 30 Jan, 2018 17:28:39 +0000

[Ionut]
- Update copyright notices

988 Diff Diff IonutCava picture IonutCava Thu 30 Nov, 2017 23:08:51 +0000

[Ionut]
- Add a Rect class (basic wrapper around a vec4)
- More work on MouseEvent system

981 Diff Diff IonutCava picture IonutCava Thu 23 Nov, 2017 18:24:51 +0000

[Ionut]
- More work on porting CEGUI to RTT

969 Diff Diff IonutCava picture IonutCava Mon 13 Nov, 2017 00:15:57 +0000

[Ionut]
- Further improve DisplayWindow <-> Input relationship
- Add Flip-Y 2D camera (D3D style projection)
- Fix IMGUI rendering
- Add IMGUI sample and IMWINDOW sample rendering at the same time
- Improve IMWINDOW multi-window support
— Bug: nothing rendering in child platform windows
- Add draw command to move render context from one window to another

959 Diff Diff IonutCava picture IonutCava Wed 01 Nov, 2017 15:37:22 +0000

[Ionut]
- Fixed CEGUI rendering issues and with it a huge hidden bug:
— Deleting GL objects (buffers, vao, textures, shader programs, framebuffers, sampler objects, etc) didn’t invalidate the bound object cache leading to situations suchs as the following to fail because OpenGL recycles handles:
Divide::bind(obj); glDeleteXYZ(1, &obj); glCreateXYZ(1, &obj); Divide::bind(obj);

955 Diff Diff IonutCava picture IonutCava Sun 29 Oct, 2017 20:45:04 +0000

[Ionut]
- Modify the CEGUI opengl renderer to interact with the state in GLWrapper better
- Performance optimizations

935 Diff Diff IonutCava picture IonutCava Tue 15 Aug, 2017 21:10:25 +0000

[IonutCava]
- Added debug scope (GL’s debug group) commands
- More bug fixes and optimizations

933 Diff Diff IonutCava picture IonutCava Tue 15 Aug, 2017 00:02:05 +0000

[Ionut]
- CommandBuffer Part 2/3: code compiles and splash screen renders and application doesn’t crash (still has drawing issues)

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

928 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