Edit

kc3-lang/angle/samples/sample_util/SampleApplication.h

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2019-01-03 13:01:08
    Hash : ad398ee8
    Message : Free OSWindow and EGLWindow through helpers. This cleans up any potential problems with allocating and freeing resources in different shared objects or DLLs. Previously we were using a dynamically linked allocation function and then calling the standard delete function. Also adds a base class helper for EGLWindow. Will base the WGL Window class on this. Needed for running ANGLE tests against native drivers. Bug: angleproject:2995 Change-Id: Ic92b447649ebb32c547605c20086c07a601842f0 Reviewed-on: https://chromium-review.googlesource.com/c/1393443 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>

  • samples/sample_util/SampleApplication.h
  • //
    // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    #ifndef SAMPLE_UTIL_SAMPLE_APPLICATION_H
    #define SAMPLE_UTIL_SAMPLE_APPLICATION_H
    
    #include <stdint.h>
    #include <list>
    #include <memory>
    #include <string>
    
    #include "util/OSWindow.h"
    #include "util/Timer.h"
    #include "util/egl_loader_autogen.h"
    
    class EGLWindow;
    
    namespace angle
    {
    class Library;
    }  // namespace angle
    
    class SampleApplication
    {
      public:
        SampleApplication(std::string name,
                          int argc,
                          char **argv,
                          EGLint glesMajorVersion = 2,
                          EGLint glesMinorVersion = 0,
                          size_t width            = 1280,
                          size_t height           = 720);
        virtual ~SampleApplication();
    
        virtual bool initialize();
        virtual void destroy();
    
        virtual void step(float dt, double totalTime);
        virtual void draw();
    
        virtual void swap();
    
        OSWindow *getWindow() const;
        EGLConfig getConfig() const;
        EGLDisplay getDisplay() const;
        EGLSurface getSurface() const;
        EGLContext getContext() const;
    
        bool popEvent(Event *event);
    
        int run();
        void exit();
    
      private:
        std::string mName;
        size_t mWidth;
        size_t mHeight;
        bool mRunning;
    
        std::unique_ptr<Timer> mTimer;
        EGLWindow *mEGLWindow;
        OSWindow *mOSWindow;
    
        // Handle to the entry point binding library.
        std::unique_ptr<angle::Library> mEntryPointsLib;
    };
    
    #endif  // SAMPLE_UTIL_SAMPLE_APPLICATION_H