Nicolas Capens | 80d6f17 | 2016-05-13 19:30:12 -0400 | [diff] [blame] | 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 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 15 | #ifndef egl_Context_hpp |
| 16 | #define egl_Context_hpp |
| 17 | |
| 18 | #include "common/Object.hpp" |
Nicolas Capens | 81aa97b | 2017-06-27 17:08:08 -0400 | [diff] [blame] | 19 | #include "Renderer/Surface.hpp" |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 20 | |
| 21 | #include <EGL/egl.h> |
| 22 | #include <GLES/gl.h> |
| 23 | |
Nicolas Capens | 31c07a3 | 2017-06-13 23:44:13 -0400 | [diff] [blame] | 24 | namespace gl { class Surface; } |
| 25 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 26 | namespace egl |
| 27 | { |
Nicolas Capens | e7e70d0 | 2016-06-07 14:40:12 -0400 | [diff] [blame] | 28 | class Display; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 29 | class Image; |
| 30 | |
Nicolas Capens | 9ed48ba | 2017-05-11 11:25:00 -0400 | [diff] [blame] | 31 | class [[clang::lto_visibility_public]] Context : public gl::Object |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 32 | { |
| 33 | public: |
Nicolas Capens | 31c07a3 | 2017-06-13 23:44:13 -0400 | [diff] [blame] | 34 | virtual void makeCurrent(gl::Surface *surface) = 0; |
| 35 | virtual void bindTexImage(gl::Surface *surface) = 0; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 36 | virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0; |
| 37 | virtual Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0; |
Nicolas Capens | f6a377b | 2017-05-19 09:31:35 -0400 | [diff] [blame] | 38 | virtual EGLint getClientVersion() const = 0; |
| 39 | virtual EGLint getConfigID() const = 0; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 40 | virtual void finish() = 0; |
Nicolas Capens | 81aa97b | 2017-06-27 17:08:08 -0400 | [diff] [blame] | 41 | virtual void blit(sw::Surface *source, const sw::SliceRect &sRect, sw::Surface *dest, const sw::SliceRect &dRect) = 0; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 42 | |
Nicolas Capens | 8aca1df | 2017-06-15 14:15:30 -0700 | [diff] [blame] | 43 | Display *getDisplay() const { return display; } |
| 44 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 45 | protected: |
Nicolas Capens | 31c07a3 | 2017-06-13 23:44:13 -0400 | [diff] [blame] | 46 | Context(egl::Display *display) : display(display) {} |
Ben Clayton | 2a58238 | 2019-04-24 12:11:36 +0100 | [diff] [blame] | 47 | virtual ~Context() {} |
Nicolas Capens | e7e70d0 | 2016-06-07 14:40:12 -0400 | [diff] [blame] | 48 | |
| 49 | egl::Display *const display; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 50 | }; |
| 51 | } |
| 52 | |
| 53 | #endif // egl_Context_hpp |