Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
NoneWrapper.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_NONE_WRAPPER_H_
34#define DVD_NONE_WRAPPER_H_
35
37
39
40namespace Divide {
41
42class NONE_API final : public RenderAPIWrapper {
43 public:
44 NONE_API(GFXDevice& context) noexcept;
45
46 protected:
47 void idle(bool fast) noexcept override;
48
49 [[nodiscard]] bool drawToWindow( DisplayWindow& window ) override;
50 void onRenderThreadLoopStart() override;
51 void onRenderThreadLoopEnd() override;
52 void prepareFlushWindow( DisplayWindow& window ) override;
53 void flushWindow( DisplayWindow& window ) override;
54 [[nodiscard]] bool frameStarted() override;
55 [[nodiscard]] bool frameEnded() override;
56
57 ErrorCode initRenderingAPI(I32 argc, char** argv, Configuration& config) noexcept override;
58 void closeRenderingAPI() noexcept override;
59 void preFlushCommandBuffer( Handle<GFX::CommandBuffer> commandBuffer) override;
60 void flushCommand( GFX::CommandBase* cmd ) noexcept override;
61 void postFlushCommandBuffer( Handle<GFX::CommandBuffer> commandBuffer) noexcept override;
62 bool setViewportInternal(const Rect<I32>& newViewport) noexcept override;
63 bool setScissorInternal(const Rect<I32>& newScissor) noexcept override;
64 void onThreadCreated(const std::thread::id& threadID, bool isMainRenderThread ) noexcept override;
65 void initDescriptorSets() override;
66
67 [[nodiscard]] bool bindShaderResources( const DescriptorSetEntries& descriptorSetEntries ) override;
68
69 [[nodiscard]] RenderTarget_uptr newRT( const RenderTargetDescriptor& descriptor ) const override;
70 [[nodiscard]] GenericVertexData_ptr newGVD( U32 ringBufferLength, std::string_view name ) const override;
71 [[nodiscard]] ShaderBuffer_uptr newSB( const ShaderBufferDescriptor& descriptor ) const override;
72
73private:
75 SDL_Renderer* _renderer{ nullptr };
76 SDL_Surface* _background{ nullptr };
77 SDL_Texture* _texture{ nullptr };
78};
79
80}; // namespace Divide
81
82#endif //DVD_NONE_WRAPPER_H_
char * argv[]
Definition: main.cpp:8
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
Definition: GFXDevice.h:215
SDL_Texture * _texture
Definition: NoneWrapper.h:77
SDL_Surface * _background
Definition: NoneWrapper.h:76
ShaderBuffer_uptr newSB(const ShaderBufferDescriptor &descriptor) const override
void closeRenderingAPI() noexcept override
GFXDevice & _context
Definition: NoneWrapper.h:74
void postFlushCommandBuffer(Handle< GFX::CommandBuffer > commandBuffer) noexcept override
void flushWindow(DisplayWindow &window) override
Definition: NoneWrapper.cpp:40
void onRenderThreadLoopEnd() override
Definition: NoneWrapper.cpp:31
RenderTarget_uptr newRT(const RenderTargetDescriptor &descriptor) const override
void initDescriptorSets() override
SDL_Renderer * _renderer
Definition: NoneWrapper.h:75
bool frameStarted() override
Definition: NoneWrapper.cpp:77
void prepareFlushWindow(DisplayWindow &window) override
Definition: NoneWrapper.cpp:35
GenericVertexData_ptr newGVD(U32 ringBufferLength, std::string_view name) const override
bool bindShaderResources(const DescriptorSetEntries &descriptorSetEntries) override
bool drawToWindow(DisplayWindow &window) override
Definition: NoneWrapper.cpp:22
void idle(bool fast) noexcept override
Definition: NoneWrapper.cpp:18
ErrorCode initRenderingAPI(I32 argc, char **argv, Configuration &config) noexcept override
Definition: NoneWrapper.cpp:87
bool setViewportInternal(const Rect< I32 > &newViewport) noexcept override
bool frameEnded() override
Definition: NoneWrapper.cpp:82
void preFlushCommandBuffer(Handle< GFX::CommandBuffer > commandBuffer) override
void flushCommand(GFX::CommandBase *cmd) noexcept override
void onThreadCreated(const std::thread::id &threadID, bool isMainRenderThread) noexcept override
bool setScissorInternal(const Rect< I32 > &newScissor) noexcept override
void onRenderThreadLoopStart() override
Definition: NoneWrapper.cpp:27
Renderer Programming Interface.
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
std::array< DescriptorSetEntry, to_base(DescriptorSetUsage::COUNT)> DescriptorSetEntries
int32_t I32
uint32_t U32