11#pragma once
22
33#include < 3ds/gpu/enums.h>
4+ #include < c3d/framebuffer.h>
45#include < citro3d.h>
6+ #include < cstdint>
57
68#include " common/Map.hpp"
79#include " common/config.hpp"
10+ #include " common/int.hpp"
811#include " common/pixelformat.hpp"
912
1013#include " driver/display/Framebuffer.hpp"
@@ -30,6 +33,20 @@ namespace love
3033 TEXENV_MODE_MAX_ENUM
3134 };
3235
36+ class CleanClearState
37+ {
38+ public:
39+ CleanClearState (C3D_ClearBits flags);
40+ ~CleanClearState ();
41+
42+ private:
43+ C3D_ClearBits flags;
44+ uint32_t colorWriteMask;
45+ uint32_t stencilWriteMask;
46+ bool depthWrites;
47+ bool scissor;
48+ };
49+
3350 citro3d ();
3451
3552 virtual void init () override ;
@@ -65,6 +82,36 @@ namespace love
6582
6683 virtual void present () override ;
6784
85+ void setDepthWrites (bool enabled)
86+ {
87+ this ->state .depthWritesEnabled = enabled;
88+ }
89+
90+ bool hasDepthWrites () const
91+ {
92+ return this ->state .depthWritesEnabled ;
93+ }
94+
95+ void setStencilWriteMask (uint32_t mask)
96+ {
97+ this ->state .stencilWriteMask = mask;
98+ }
99+
100+ bool getStencilWriteMask () const
101+ {
102+ return this ->state .stencilWriteMask ;
103+ }
104+
105+ void setColorWriteMask (uint32_t mask)
106+ {
107+ this ->state .colorWriteMask = mask;
108+ }
109+
110+ bool getColorWriteMask () const
111+ {
112+ return this ->state .colorWriteMask ;
113+ }
114+
68115 C3D_RenderTarget* getFramebuffer ();
69116
70117 C3D_RenderTarget* getInternalBackbuffer () const ;
@@ -111,7 +158,12 @@ namespace love
111158
112159 // clang-format off
113160
114- ENUMMAP_DECLARE (PrimitiveModes, PrimitiveType, GPU_Primitive_t,
161+ ENUMMAP_DECLARE (FilterModes, SamplerState::FilterMode, GPU_TEXTURE_FILTER_PARAM ,
162+ { SamplerState::FILTER_LINEAR , GPU_LINEAR },
163+ { SamplerState::FILTER_NEAREST , GPU_NEAREST }
164+ );
165+
166+ ENUMMAP_DECLARE (PrimitiveModes, PrimitiveType, GPU_Primitive_t,
115167 { PRIMITIVE_TRIANGLES , GPU_TRIANGLES },
116168 { PRIMITIVE_TRIANGLE_STRIP , GPU_TRIANGLE_STRIP },
117169 { PRIMITIVE_TRIANGLE_FAN , GPU_TRIANGLE_FAN }
@@ -230,6 +282,15 @@ namespace love
230282
231283 std::vector<std::function<void ()>> deferred;
232284 std::array<C3D_TexEnv, TEXENV_MODE_MAX_ENUM > environments;
285+
286+ struct
287+ {
288+ GPU_CULLMODE faceCullMode;
289+ uint32_t enabledAttribArrays;
290+ bool depthWritesEnabled = true ;
291+ uint32_t stencilWriteMask = LOVE_UINT32_MAX ;
292+ uint32_t colorWriteMask = LOVE_UINT32_MAX ;
293+ } state;
233294 };
234295
235296 extern citro3d c3d;
0 commit comments