1 // 2 // Copyright 2018 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // NativeBufferImageSiblingAndroid.cpp: Implements the NativeBufferImageSiblingAndroid class 8 9 #include "libANGLE/renderer/gl/egl/android/NativeBufferImageSiblingAndroid.h" 10 11 #include "common/android_util.h" 12 13 namespace rx 14 { NativeBufferImageSiblingAndroid(EGLClientBuffer buffer)15NativeBufferImageSiblingAndroid::NativeBufferImageSiblingAndroid(EGLClientBuffer buffer) 16 : mBuffer(buffer), mFormat(GL_NONE) 17 {} 18 ~NativeBufferImageSiblingAndroid()19NativeBufferImageSiblingAndroid::~NativeBufferImageSiblingAndroid() {} 20 initialize(const egl::Display * display)21egl::Error NativeBufferImageSiblingAndroid::initialize(const egl::Display *display) 22 { 23 int pixelFormat = 0; 24 angle::android::GetANativeWindowBufferProperties( 25 angle::android::ClientBufferToANativeWindowBuffer(mBuffer), &mSize.width, &mSize.height, 26 &mSize.depth, &pixelFormat); 27 mFormat = gl::Format(angle::android::NativePixelFormatToGLInternalFormat(pixelFormat)); 28 29 return egl::NoError(); 30 } 31 getFormat() const32gl::Format NativeBufferImageSiblingAndroid::getFormat() const 33 { 34 return mFormat; 35 } 36 isRenderable(const gl::Context * context) const37bool NativeBufferImageSiblingAndroid::isRenderable(const gl::Context *context) const 38 { 39 return true; 40 } 41 isTexturable(const gl::Context * context) const42bool NativeBufferImageSiblingAndroid::isTexturable(const gl::Context *context) const 43 { 44 return true; 45 } 46 getSize() const47gl::Extents NativeBufferImageSiblingAndroid::getSize() const 48 { 49 return mSize; 50 } 51 getSamples() const52size_t NativeBufferImageSiblingAndroid::getSamples() const 53 { 54 return 0; 55 } 56 getBuffer() const57EGLClientBuffer NativeBufferImageSiblingAndroid::getBuffer() const 58 { 59 return mBuffer; 60 } 61 62 } // namespace rx 63