Avoid dummy key methods by using pure abstract classes.
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. Work around this by making the affected classes pure
abstract and implementing them in a derived class in the respective
library responsible for creating them.
Bug swiftshader:31
Change-Id: I40046f605731eb1cc3825c1ede2d8d9b5826d0f5
Reviewed-on: https://swiftshader-review.googlesource.com/9914
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Renderer/Surface.cpp b/src/Renderer/Surface.cpp
index c7ca71a..f29aaae 100644
--- a/src/Renderer/Surface.cpp
+++ b/src/Renderer/Surface.cpp
@@ -41,7 +41,6 @@
unsigned int *Surface::palette = 0;
unsigned int Surface::paletteID = 0;
- void Surface::typeinfo() {}
void Rect::clip(int minX, int minY, int maxX, int maxY)
{
@@ -1168,6 +1167,36 @@
lock = LOCK_UNLOCKED;
}
+ class SurfaceImplementation : public Surface
+ {
+ public:
+ SurfaceImplementation(int width, int height, int depth, Format format, void *pixels, int pitch, int slice)
+ : Surface(width, height, depth, format, pixels, pitch, slice) {}
+ SurfaceImplementation(Resource *texture, int width, int height, int depth, Format format, bool lockable, bool renderTarget, int pitchP = 0)
+ : Surface(texture, width, height, depth, format, lockable, renderTarget, pitchP) {}
+ ~SurfaceImplementation() override {};
+
+ void *lockInternal(int x, int y, int z, Lock lock, Accessor client) override
+ {
+ return Surface::lockInternal(x, y, z, lock, client);
+ }
+
+ void unlockInternal() override
+ {
+ Surface::unlockInternal();
+ }
+ };
+
+ Surface *Surface::create(int width, int height, int depth, Format format, void *pixels, int pitch, int slice)
+ {
+ return new SurfaceImplementation(width, height, depth, format, pixels, pitch, slice);
+ }
+
+ Surface *Surface::create(Resource *texture, int width, int height, int depth, Format format, bool lockable, bool renderTarget, int pitchPprovided)
+ {
+ return new SurfaceImplementation(texture, width, height, depth, format, lockable, renderTarget, pitchPprovided);
+ }
+
Surface::Surface(int width, int height, int depth, Format format, void *pixels, int pitch, int slice) : lockable(true), renderTarget(false)
{
resource = new Resource(0);