@@ -95,25 +95,22 @@ namespace love
9595
9696 enum Feature
9797 {
98- FEATURE_MULTI_RENDER_TARGET_FORMATS ,
98+ FEATURE_MULTI_RENDER_TARGET_FORMATS , // Deprecated
9999 FEATURE_CLAMP_ZERO ,
100100 FEATURE_CLAMP_ONE ,
101- FEATURE_BLEND_MINMAX ,
102- FEATURE_LIGHTEN , // Deprecated
103- FEATURE_FULL_NPOT ,
104- FEATURE_PIXEL_SHADER_HIGHP ,
105- FEATURE_SHADER_DERIVATIVES ,
106- FEATURE_GLSL3 ,
101+ FEATURE_LIGHTEN , // Deprecated
102+ FEATURE_FULL_NPOT , // Deprecated
103+ FEATURE_PIXEL_SHADER_HIGHP , // Deprecated
104+ FEATURE_SHADER_DERIVATIVES , // Deprecated
105+ FEATURE_GLSL3 , // Deprecated
107106 FEATURE_GLSL4 ,
108- FEATURE_INSTANCING ,
107+ FEATURE_INSTANCING , // Deprecated
109108 FEATURE_TEXEL_BUFFER ,
110- FEATURE_INDEX_BUFFER_32BIT ,
111- FEATURE_COPY_BUFFER ,
112- FEATURE_COPY_BUFFER_TO_TEXTURE ,
113109 FEATURE_COPY_TEXTURE_TO_BUFFER ,
114- FEATURE_COPY_RENDER_TARGET_TO_BUFFER ,
115- FEATURE_MIPMAP_RANGE ,
116110 FEATURE_INDIRECT_DRAW ,
111+ FEATURE_VERTEX_WRITE ,
112+ FEATURE_PIXEL_WRITE ,
113+ FEATURE_IMAGE_ATOMICS ,
117114 FEATURE_MAX_ENUM
118115 };
119116
@@ -280,6 +277,29 @@ namespace love
280277 }
281278 };
282279
280+ struct BackbufferSettings
281+ {
282+ int width = 0 ;
283+ int height = 0 ;
284+ int pixelWidth = 0 ;
285+ int pixelHeight = 0 ;
286+ bool stencil = false ;
287+ bool depth = false ;
288+ int msaa = 0 ;
289+
290+ bool operator ==(const BackbufferSettings& other) const
291+ {
292+ return width == other.width && height == other.height && pixelWidth == other.pixelWidth &&
293+ pixelHeight == other.pixelHeight && stencil == other.stencil && depth == other.depth &&
294+ msaa == other.msaa ;
295+ }
296+
297+ bool operator !=(const BackbufferSettings& other) const
298+ {
299+ return !(operator ==(other));
300+ }
301+ };
302+
283303 struct RenderTargets
284304 {
285305 std::vector<RenderTarget> colors;
@@ -329,8 +349,8 @@ namespace love
329349
330350 float pointSize = 1 .0f ;
331351
332- bool scissor = false ;
333- Rect scissorRect = Rect ();
352+ bool scissor = false ;
353+ FRect scissorRect = FRect ();
334354
335355 StencilState stencil;
336356
@@ -420,17 +440,17 @@ namespace love
420440 this ->states .back ().defaultSamplerState = state;
421441 }
422442
423- virtual void setScissor (const Rect & scissor) = 0;
443+ virtual void setScissor (const FRect & scissor) = 0;
424444
425445 virtual void setScissor () = 0;
426446
427447 void setShader ();
428448
429449 void setShader (ShaderBase* shader);
430450
431- void intersectScissor (const Rect & scissor);
451+ void intersectScissor (const FRect & scissor);
432452
433- bool getScissor (Rect & scissor) const ;
453+ bool getScissor (FRect & scissor) const ;
434454
435455 void setProjection (const Matrix4& matrix);
436456
@@ -680,10 +700,6 @@ namespace love
680700 this ->pixelScaleStack .back () = 1.0 ;
681701 }
682702
683- void validateStencilState (const StencilState& state) const ;
684-
685- void validateDepthState (bool depthWrite) const ;
686-
687703 int getWidth () const ;
688704
689705 int getHeight () const ;
@@ -701,6 +717,8 @@ namespace love
701717 this ->deviceProjectionMatrix = projection;
702718 }
703719
720+ // virtual void backbufferChanged(const BackbufferSettings& settings) = 0;
721+
704722 void backbufferChanged (int width, int height, double pixelWidth, double pixelHeight);
705723
706724 const Matrix4& getDeviceProjection () const
@@ -839,11 +857,50 @@ namespace love
839857 { " all" , STACK_ALL },
840858 { " transform" , STACK_TRANSFORM }
841859 );
860+
861+ STRINGMAP_DECLARE (Features, Feature,
862+ { " multicanvasformats" , FEATURE_MULTI_RENDER_TARGET_FORMATS },
863+ { " clampzero" , FEATURE_CLAMP_ZERO },
864+ { " clampone" , FEATURE_CLAMP_ONE },
865+ { " lighten" , FEATURE_LIGHTEN },
866+ { " fullnpot" , FEATURE_FULL_NPOT },
867+ { " pixelshaderhighp" , FEATURE_PIXEL_SHADER_HIGHP },
868+ { " shaderderivatives" , FEATURE_SHADER_DERIVATIVES },
869+ { " glsl3" , FEATURE_GLSL3 },
870+ { " glsl4" , FEATURE_GLSL4 },
871+ { " instancing" , FEATURE_INSTANCING },
872+ { " texelbuffer" , FEATURE_TEXEL_BUFFER },
873+ { " copytexturetobuffer" , FEATURE_COPY_TEXTURE_TO_BUFFER },
874+ { " indirectdraw" , FEATURE_INDIRECT_DRAW },
875+ { " vertexwrite" , FEATURE_VERTEX_WRITE },
876+ { " pixelwrite" , FEATURE_PIXEL_WRITE }
877+ );
878+
879+ STRINGMAP_DECLARE (SystemLimits, SystemLimit,
880+ { " pointsize" , LIMIT_POINT_SIZE },
881+ { " texturesize" , LIMIT_TEXTURE_SIZE },
882+ { " texturelayers" , LIMIT_TEXTURE_LAYERS },
883+ { " volumetexturesize" , LIMIT_VOLUME_TEXTURE_SIZE },
884+ { " cubetexturesize" , LIMIT_CUBE_TEXTURE_SIZE },
885+ { " texelbuffersize" , LIMIT_TEXEL_BUFFER_SIZE },
886+ { " shaderstoragebuffersize" , LIMIT_SHADER_STORAGE_BUFFER_SIZE },
887+ { " threadgroupsx" , LIMIT_THREADGROUPS_X },
888+ { " threadgroupsy" , LIMIT_THREADGROUPS_Y },
889+ { " threadgroupsz" , LIMIT_THREADGROUPS_Z },
890+ { " multicanvas" , LIMIT_RENDER_TARGETS },
891+ { " texturemsaa" , LIMIT_TEXTURE_MSAA },
892+ { " anisotropy" , LIMIT_ANISOTROPY },
893+ );
842894 // clang-format on
843895
844896 protected:
845897 int calculateEllipsePoints (float a, float b) const ;
846898
899+ void validateStencilState (const StencilState& state) const ;
900+
901+ void validateDepthState (bool depthWrite) const ;
902+
903+ BackbufferSettings backbufferSettings;
847904 bool created;
848905 bool active;
849906
0 commit comments