1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef egl_Context_hpp 16 #define egl_Context_hpp 17 18 #include "common/Object.hpp" 19 #include "Renderer/Surface.hpp" 20 21 #include <EGL/egl.h> 22 #undef Bool 23 24 #include <GLES/gl.h> 25 26 namespace gl { class Surface; } 27 28 namespace egl 29 { 30 class Display; 31 class Image; 32 33 class [[clang::lto_visibility_public]] Context : public gl::Object 34 { 35 public: 36 virtual void makeCurrent(gl::Surface *surface) = 0; 37 virtual void bindTexImage(gl::Surface *surface) = 0; 38 virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0; 39 virtual Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0; 40 virtual EGLint getClientVersion() const = 0; 41 virtual EGLint getConfigID() const = 0; 42 virtual void finish() = 0; 43 virtual void blit(sw::Surface *source, const sw::SliceRect &sRect, sw::Surface *dest, const sw::SliceRect &dRect) = 0; 44 getDisplay() const45 Display *getDisplay() const { return display; } 46 47 protected: Context(egl::Display * display)48 Context(egl::Display *display) : display(display) {} ~Context()49 virtual ~Context() {} 50 51 egl::Display *const display; 52 }; 53 } 54 55 #endif // egl_Context_hpp 56