Commit 6016a144 by Nicolas Capens

Make the FrameBuffer class pure abstract.

Sanitizer tools desire having the vtables of any class with non-pure virtual methods, even when none of them are called in the current linkage unit. In the case of sw::FrameBuffer, to work around this we can make the class pure abstract by making the destructor pure virtual. Note that the destructor still has a non-empty definition, since all non- default destructors need a defintion, and it will get called as part of the destructor chain. Bug swiftshader:31 Change-Id: I7601b1a725c513ff484cd34a8965636b7f21513c Reviewed-on: https://swiftshader-review.googlesource.com/9912Reviewed-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 7c0d3471
......@@ -35,7 +35,6 @@ namespace sw
FrameBuffer::Cursor FrameBuffer::cursor = {};
bool FrameBuffer::topLeftOrigin = false;
void FrameBuffer::typeinfo() {}
FrameBuffer::FrameBuffer(int width, int height, bool fullscreen, bool topLeftOrigin)
{
......
......@@ -36,12 +36,10 @@ namespace sw
class [[clang::lto_visibility_public]] FrameBuffer
{
virtual void typeinfo(); // Dummy key method (https://gcc.gnu.org/onlinedocs/gcc/Vague-Linkage.html)
public:
FrameBuffer(int width, int height, bool fullscreen, bool topLeftOrigin);
virtual ~FrameBuffer();
virtual ~FrameBuffer() = 0;
int getWidth() const;
int getHeight() const;
......
......@@ -28,7 +28,7 @@ namespace sw
public:
FrameBufferAndroid(ANativeWindow* window, int width, int height);
~FrameBufferAndroid();
~FrameBufferAndroid() override;
void flip(void *source, Format sourceFormat, size_t sourceStride) override {blit(source, 0, 0, sourceFormat, sourceStride);};
void blit(void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) override;
......
......@@ -26,7 +26,7 @@ namespace sw
public:
FrameBufferDD(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin);
virtual ~FrameBufferDD();
~FrameBufferDD() override;
void flip(void *source, Format sourceFormat, size_t sourceStride) override;
void blit(void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) override;
......
......@@ -24,8 +24,8 @@ namespace sw
public:
FrameBufferGDI(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin);
virtual ~FrameBufferGDI();
~FrameBufferGDI() override;
void flip(void *source, Format sourceFormat, size_t sourceStride) override;
void blit(void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) override;
......
......@@ -31,7 +31,7 @@ namespace sw
public:
FrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin);
virtual ~FrameBufferWin();
~FrameBufferWin() override;
void flip(void *source, Format sourceFormat, size_t sourceStride) override = 0;
void blit(void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) override = 0;
......
......@@ -33,7 +33,7 @@ namespace sw
public:
FrameBufferX11(Display *display, Window window, int width, int height);
~FrameBufferX11();
~FrameBufferX11() override;
void flip(void *source, Format sourceFormat, size_t sourceStride) override {blit(source, 0, 0, sourceFormat, sourceStride);};
void blit(void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) override;
......
......@@ -18,7 +18,6 @@
namespace sw
{
void FrameBuffer::typeinfo() {}
void Surface::typeinfo() {}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment