Move Canvas:getMSAA to Texture:getMSAA.

This commit is contained in:
Alex Szpakowski
2020-02-03 19:26:11 -04:00
parent 323f86f31e
commit fc0d60a96d
7 changed files with 24 additions and 17 deletions
+1 -5
View File
@@ -35,6 +35,7 @@ Canvas::Canvas(const Settings &settings)
renderTarget = true; renderTarget = true;
sRGB = false; sRGB = false;
requestedMSAA = settings.msaa;
width = settings.width; width = settings.width;
height = settings.height; height = settings.height;
@@ -106,11 +107,6 @@ Canvas::MipmapMode Canvas::getMipmapMode() const
return settings.mipmaps; return settings.mipmaps;
} }
int Canvas::getRequestedMSAA() const
{
return settings.msaa;
}
love::image::ImageData *Canvas::newImageData(love::image::Image *module, int slice, int mipmap, const Rect &r) love::image::ImageData *Canvas::newImageData(love::image::Image *module, int slice, int mipmap, const Rect &r)
{ {
if (!isReadable()) if (!isReadable())
-4
View File
@@ -78,13 +78,9 @@ public:
virtual ~Canvas(); virtual ~Canvas();
MipmapMode getMipmapMode() const; MipmapMode getMipmapMode() const;
int getRequestedMSAA() const;
virtual love::image::ImageData *newImageData(love::image::Image *module, int slice, int mipmap, const Rect &rect); virtual love::image::ImageData *newImageData(love::image::Image *module, int slice, int mipmap, const Rect &rect);
virtual int getMSAA() const = 0;
virtual ptrdiff_t getRenderTargetHandle() const = 0;
static bool getConstant(const char *in, MipmapMode &out); static bool getConstant(const char *in, MipmapMode &out);
static bool getConstant(MipmapMode in, const char *&out); static bool getConstant(MipmapMode in, const char *&out);
static std::vector<std::string> getConstants(MipmapMode); static std::vector<std::string> getConstants(MipmapMode);
+6
View File
@@ -172,6 +172,7 @@ Texture::Texture(TextureType texType)
, mipmapCount(1) , mipmapCount(1)
, pixelWidth(0) , pixelWidth(0)
, pixelHeight(0) , pixelHeight(0)
, requestedMSAA(1)
, samplerState() , samplerState()
, graphicsMemorySize(0) , graphicsMemorySize(0)
{ {
@@ -397,6 +398,11 @@ float Texture::getDPIScale() const
return (float) pixelHeight / (float) height; return (float) pixelHeight / (float) height;
} }
int Texture::getRequestedMSAA() const
{
return requestedMSAA;
}
void Texture::setSamplerState(const SamplerState &s) void Texture::setSamplerState(const SamplerState &s)
{ {
if (s.depthSampleMode.hasValue && (!readable || !isPixelFormatDepthStencil(format))) if (s.depthSampleMode.hasValue && (!readable || !isPixelFormatDepthStencil(format)))
+7
View File
@@ -181,6 +181,8 @@ public:
void drawLayer(Graphics *gfx, int layer, const Matrix4 &m); void drawLayer(Graphics *gfx, int layer, const Matrix4 &m);
void drawLayer(Graphics *gfx, int layer, Quad *quad, const Matrix4 &m); void drawLayer(Graphics *gfx, int layer, Quad *quad, const Matrix4 &m);
virtual ptrdiff_t getRenderTargetHandle() const = 0;
TextureType getTextureType() const; TextureType getTextureType() const;
PixelFormat getPixelFormat() const; PixelFormat getPixelFormat() const;
@@ -203,6 +205,9 @@ public:
float getDPIScale() const; float getDPIScale() const;
int getRequestedMSAA() const;
virtual int getMSAA() const = 0;
virtual void setSamplerState(const SamplerState &s); virtual void setSamplerState(const SamplerState &s);
const SamplerState &getSamplerState() const; const SamplerState &getSamplerState() const;
@@ -242,6 +247,8 @@ protected:
int pixelWidth; int pixelWidth;
int pixelHeight; int pixelHeight;
int requestedMSAA;
SamplerState samplerState; SamplerState samplerState;
StrongRef<Quad> quad; StrongRef<Quad> quad;
+2
View File
@@ -48,7 +48,9 @@ public:
void unloadVolatile() override; void unloadVolatile() override;
ptrdiff_t getHandle() const override; ptrdiff_t getHandle() const override;
ptrdiff_t getRenderTargetHandle() const override { return 0; }
int getMSAA() const override { return 1; }
void setSamplerState(const SamplerState &s) override; void setSamplerState(const SamplerState &s) override;
void generateMipmaps() override; void generateMipmaps() override;
-8
View File
@@ -31,13 +31,6 @@ Canvas *luax_checkcanvas(lua_State *L, int idx)
return luax_checktype<Canvas>(L, idx); return luax_checktype<Canvas>(L, idx);
} }
int w_Canvas_getMSAA(lua_State *L)
{
Canvas *canvas = luax_checkcanvas(L, 1);
lua_pushinteger(L, canvas->getMSAA());
return 1;
}
int w_Canvas_renderTo(lua_State *L) int w_Canvas_renderTo(lua_State *L)
{ {
Graphics::RenderTarget rt(luax_checkcanvas(L, 1)); Graphics::RenderTarget rt(luax_checkcanvas(L, 1));
@@ -135,7 +128,6 @@ int w_Canvas_getMipmapMode(lua_State *L)
static const luaL_Reg w_Canvas_functions[] = static const luaL_Reg w_Canvas_functions[] =
{ {
{ "getMSAA", w_Canvas_getMSAA },
{ "renderTo", w_Canvas_renderTo }, { "renderTo", w_Canvas_renderTo },
{ "newImageData", w_Canvas_newImageData }, { "newImageData", w_Canvas_newImageData },
{ "generateMipmaps", w_Canvas_generateMipmaps }, { "generateMipmaps", w_Canvas_generateMipmaps },
+8
View File
@@ -143,6 +143,13 @@ int w_Texture_isCompressed(lua_State *L)
return 1; return 1;
} }
int w_Texture_getMSAA(lua_State *L)
{
Texture *t = luax_checktexture(L, 1);
lua_pushinteger(L, t->getMSAA());
return 1;
}
int w_Texture_setFilter(lua_State *L) int w_Texture_setFilter(lua_State *L)
{ {
Texture *t = luax_checktexture(L, 1); Texture *t = luax_checktexture(L, 1);
@@ -330,6 +337,7 @@ const luaL_Reg w_Texture_functions[] =
{ "getDPIScale", w_Texture_getDPIScale }, { "getDPIScale", w_Texture_getDPIScale },
{ "isFormatLinear", w_Texture_isFormatLinear }, { "isFormatLinear", w_Texture_isFormatLinear },
{ "isCompressed", w_Texture_isCompressed }, { "isCompressed", w_Texture_isCompressed },
{ "getMSAA", w_Texture_getMSAA },
{ "setFilter", w_Texture_setFilter }, { "setFilter", w_Texture_setFilter },
{ "getFilter", w_Texture_getFilter }, { "getFilter", w_Texture_getFilter },
{ "setMipmapFilter", w_Texture_setMipmapFilter }, { "setMipmapFilter", w_Texture_setMipmapFilter },