From 38c89491e4d9a9d951ced381e08f108a43ef33b0 Mon Sep 17 00:00:00 2001 From: Mathias Agopian <> Date: Tue, 24 Mar 2009 18:34:22 -0700 Subject: Automated import from //branches/donutburger/...@140807,140807 --- libs/surfaceflinger/BootAnimation.cpp | 199 ++++------------------------------ libs/surfaceflinger/BootAnimation.h | 10 +- 2 files changed, 23 insertions(+), 186 deletions(-) diff --git a/libs/surfaceflinger/BootAnimation.cpp b/libs/surfaceflinger/BootAnimation.cpp index 2b30336..03edbf3 100644 --- a/libs/surfaceflinger/BootAnimation.cpp +++ b/libs/surfaceflinger/BootAnimation.cpp @@ -187,44 +187,20 @@ bool BootAnimation::threadLoop() { } bool BootAnimation::android() { - initTexture(&mAndroid[0], mAssets, "images/android_320x480.png"); - initTexture(&mAndroid[1], mAssets, "images/boot_robot.png"); - initTexture(&mAndroid[2], mAssets, "images/boot_robot_glow.png"); - - // erase screen - glDisable(GL_SCISSOR_TEST); - glBindTexture(GL_TEXTURE_2D, mAndroid[0].name); + initTexture(&mAndroid[0], mAssets, "images/android-logo-mask.png"); + initTexture(&mAndroid[1], mAssets, "images/android-logo-shine.png"); // clear screen + glDisable(GL_DITHER); + glDisable(GL_SCISSOR_TEST); glClear(GL_COLOR_BUFFER_BIT); eglSwapBuffers(mDisplay, mSurface); // wait ~1s - usleep(800000); - - // fade in - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - const int steps = 8; - for (int i = 1; i < steps; i++) { - float fade = i / float(steps); - glColor4f(1, 1, 1, fade * fade); - glClear(GL_COLOR_BUFFER_BIT); - glDrawTexiOES(0, 0, 0, mAndroid[0].w, mAndroid[0].h); - eglSwapBuffers(mDisplay, mSurface); - } - - // draw last frame - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glDisable(GL_BLEND); - glDrawTexiOES(0, 0, 0, mAndroid[0].w, mAndroid[0].h); - eglSwapBuffers(mDisplay, mSurface); - // update rect for the robot - const int x = mWidth - mAndroid[1].w - 33; - const int y = (mHeight - mAndroid[1].h) / 2 - 1; - const Rect updateRect(x, y, x + mAndroid[1].w, y + mAndroid[1].h); + const GLint xc = (mWidth - mAndroid[0].w) / 2; + const GLint yc = (mHeight - mAndroid[0].h) / 2; + const Rect updateRect(xc, yc, xc + mAndroid[0].w, yc + mAndroid[0].h); // draw and update only what we need mNativeWindowSurface->setSwapRectangle(updateRect.left, @@ -234,166 +210,31 @@ bool BootAnimation::android() { glScissor(updateRect.left, mHeight - updateRect.bottom, updateRect.width(), updateRect.height()); + // Blend state + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + const nsecs_t startTime = systemTime(); do { - // glow speed and shape - nsecs_t time = systemTime() - startTime; - float t = ((4.0f / (360.0f * us2ns(16667))) * time); - t = t - floorf(t); - const float fade = 0.5f + 0.5f * sinf(t * 2 * M_PI); + double time = systemTime() - startTime; + float t = 4.0f * float(time / us2ns(16667)) / mAndroid[1].w; + GLint offset = (1 - (t - floorf(t))) * mAndroid[1].w; + GLint x = xc - offset; - // fade the glow in and out glDisable(GL_BLEND); - glBindTexture(GL_TEXTURE_2D, mAndroid[2].name); - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glColor4f(fade, fade, fade, fade); - glDrawTexiOES(updateRect.left, mHeight - updateRect.bottom, 0, - updateRect.width(), updateRect.height()); - - // draw the robot - glEnable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, mAndroid[1].name); - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glDrawTexiOES(updateRect.left, mHeight - updateRect.bottom, 0, - updateRect.width(), updateRect.height()); + glDrawTexiOES(x, yc, 0, mAndroid[1].w, mAndroid[1].h); + glDrawTexiOES(x + mAndroid[1].w, yc, 0, mAndroid[1].w, mAndroid[1].h); - // make sure sleep a lot to not take too much CPU away from - // the boot process. With this "glow" animation there is no - // visible difference. - usleep(16667 * 4); + glEnable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, mAndroid[0].name); + glDrawTexiOES(xc, yc, 0, mAndroid[0].w, mAndroid[0].h); eglSwapBuffers(mDisplay, mSurface); } while (!exitPending()); glDeleteTextures(1, &mAndroid[0].name); glDeleteTextures(1, &mAndroid[1].name); - glDeleteTextures(1, &mAndroid[2].name); - return false; -} - -bool BootAnimation::cylon() { - // initialize the textures... - initTexture(&mLeftTrail, mAssets, "images/cylon_left.png"); - initTexture(&mRightTrail, mAssets, "images/cylon_right.png"); - initTexture(&mBrightSpot, mAssets, "images/cylon_dot.png"); - - int w = mWidth; - int h = mHeight; - - const Point c(w / 2, h / 2); - const GLint amplitude = 60; - const int scx = c.x - amplitude - mBrightSpot.w / 2; - const int scy = c.y - mBrightSpot.h / 2; - const int scw = amplitude * 2 + mBrightSpot.w; - const int sch = mBrightSpot.h; - const Rect updateRect(scx, h - scy - sch, scx + scw, h - scy); - - // erase screen - glDisable(GL_SCISSOR_TEST); - glClear(GL_COLOR_BUFFER_BIT); - - eglSwapBuffers(mDisplay, mSurface); - - glClear(GL_COLOR_BUFFER_BIT); - - mNativeWindowSurface->setSwapRectangle(updateRect.left, - updateRect.top, updateRect.width(), updateRect.height()); - - glEnable(GL_SCISSOR_TEST); - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - // clear the screen to white - Point p; - float t = 0; - float alpha = 1.0f; - const nsecs_t startTime = systemTime(); - nsecs_t fadeTime = 0; - - do { - // Set scissor in interesting area - glScissor(scx, scy, scw, sch); - - // erase screen - glClear(GL_COLOR_BUFFER_BIT); - - // compute wave - const float a = (t * 2 * M_PI) - M_PI / 2; - const float sn = sinf(a); - const float cs = cosf(a); - GLint x = GLint(amplitude * sn); - float derivative = cs; - - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - if (derivative > 0) { - // vanishing trail... - p.x = (-amplitude + c.x) - mBrightSpot.w / 2; - p.y = c.y - mLeftTrail.h / 2; - float fade = 2.0f * (0.5f - t); - //fade *= fade; - glColor4f(fade, fade, fade, fade); - glBindTexture(GL_TEXTURE_2D, mLeftTrail.name); - glDrawTexiOES(p.x, p.y, 0, mLeftTrail.w, mLeftTrail.h); - - // trail... - p.x = (x + c.x) - (mRightTrail.w + mBrightSpot.w / 2) + 16; - p.y = c.y - mRightTrail.h / 2; - fade = t < 0.25f ? t * 4.0f : 1.0f; - fade *= fade; - glColor4f(fade, fade, fade, fade); - glBindTexture(GL_TEXTURE_2D, mRightTrail.name); - glDrawTexiOES(p.x, p.y, 0, mRightTrail.w, mRightTrail.h); - } else { - // vanishing trail.. - p.x = (amplitude + c.x) - (mRightTrail.w + mBrightSpot.w / 2) + 16; - p.y = c.y - mRightTrail.h / 2; - float fade = 2.0f * (0.5f - (t - 0.5f)); - //fade *= fade; - glColor4f(fade, fade, fade, fade); - glBindTexture(GL_TEXTURE_2D, mRightTrail.name); - glDrawTexiOES(p.x, p.y, 0, mRightTrail.w, mRightTrail.h); - - // trail... - p.x = (x + c.x) - mBrightSpot.w / 2; - p.y = c.y - mLeftTrail.h / 2; - fade = t < 0.5f + 0.25f ? (t - 0.5f) * 4.0f : 1.0f; - fade *= fade; - glColor4f(fade, fade, fade, fade); - glBindTexture(GL_TEXTURE_2D, mLeftTrail.name); - glDrawTexiOES(p.x, p.y, 0, mLeftTrail.w, mLeftTrail.h); - } - - const Point p(x + c.x - mBrightSpot.w / 2, c.y - mBrightSpot.h / 2); - glBindTexture(GL_TEXTURE_2D, mBrightSpot.name); - glColor4f(1, 0.5, 0.5, 1); - glDrawTexiOES(p.x, p.y, 0, mBrightSpot.w, mBrightSpot.h); - - // update animation - nsecs_t time = systemTime() - startTime; - t = ((4.0f / (360.0f * us2ns(16667))) * time); - t = t - floorf(t); - - eglSwapBuffers(mDisplay, mSurface); - - if (exitPending()) { - if (fadeTime == 0) { - fadeTime = time; - } - time -= fadeTime; - alpha = 1.0f - ((float(time) * 6.0f) / float(s2ns(1))); - - session()->openTransaction(); - mFlingerSurface->setAlpha(alpha * alpha); - session()->closeTransaction(); - } - } while (alpha > 0); - - // cleanup - glFinish(); - glDeleteTextures(1, &mLeftTrail.name); - glDeleteTextures(1, &mRightTrail.name); - glDeleteTextures(1, &mBrightSpot.name); return false; } diff --git a/libs/surfaceflinger/BootAnimation.h b/libs/surfaceflinger/BootAnimation.h index b20cea0..3fb6670 100644 --- a/libs/surfaceflinger/BootAnimation.h +++ b/libs/surfaceflinger/BootAnimation.h @@ -62,16 +62,12 @@ private: status_t initTexture(Texture* texture, AssetManager& asset, const char* name); bool android(); - bool cylon(); sp mSession; AssetManager mAssets; - Texture mLeftTrail; - Texture mRightTrail; - Texture mBrightSpot; - Texture mAndroid[3]; - int mWidth; - int mHeight; + Texture mAndroid[2]; + int mWidth; + int mHeight; EGLDisplay mDisplay; EGLDisplay mContext; EGLDisplay mSurface; -- cgit v1.1 From 78b877e7e673bc248a878e4513f978b2eb82e1c0 Mon Sep 17 00:00:00 2001 From: Jason Sams <> Date: Tue, 24 Mar 2009 20:21:36 -0700 Subject: Automated import from //branches/donutburger/...@141469,141469 --- camera/libcameraservice/Android.mk | 3 ++- camera/libcameraservice/CameraService.cpp | 30 ++++++++++++++++++++++++++++++ camera/libcameraservice/CameraService.h | 5 +++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/camera/libcameraservice/Android.mk b/camera/libcameraservice/Android.mk index 2dfe659..96cc512 100644 --- a/camera/libcameraservice/Android.mk +++ b/camera/libcameraservice/Android.mk @@ -42,7 +42,8 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES:= \ libui \ libutils \ - libcutils + libcutils \ + libmedia LOCAL_MODULE:= libcameraservice diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 15e3b21..851b213 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -28,6 +28,8 @@ #include #include +#include +#include #include "CameraService.h" namespace android { @@ -151,6 +153,19 @@ void CameraService::removeClient(const sp& cameraClient) } } +static sp newMediaPlayer(const char *file) +{ + sp mp = new MediaPlayer(); + if (mp->setDataSource(file) == NO_ERROR) { + mp->setAudioStreamType(AudioSystem::ALARM); + mp->prepare(); + } else { + mp.clear(); + LOGE("Failed to load CameraService sounds."); + } + return mp; +} + CameraService::Client::Client(const sp& cameraService, const sp& cameraClient, pid_t clientPid) { @@ -161,6 +176,9 @@ CameraService::Client::Client(const sp& cameraService, mHardware = openCameraHardware(); mUseOverlay = mHardware->useOverlay(); + mMediaPlayerClick = newMediaPlayer("/system/media/audio/ui/camera_click.ogg"); + mMediaPlayerBeep = newMediaPlayer("/system/media/audio/ui/VideoRecord.ogg"); + // Callback is disabled by default mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; LOGD("Client X constructor"); @@ -265,6 +283,9 @@ CameraService::Client::~Client() #endif } + mMediaPlayerBeep.clear(); + mMediaPlayerClick.clear(); + // make sure we tear down the hardware mClientPid = IPCThreadState::self()->getCallingPid(); disconnect(); @@ -464,6 +485,9 @@ status_t CameraService::Client::startPreview() status_t CameraService::Client::startRecording() { + if (mMediaPlayerBeep.get() != NULL) { + mMediaPlayerBeep->start(); + } return startCameraMode(CAMERA_RECORDING_MODE); } @@ -502,6 +526,9 @@ void CameraService::Client::stopRecording() return; } + if (mMediaPlayerBeep.get() != NULL) { + mMediaPlayerBeep->start(); + } mHardware->stopRecording(); LOGV("stopRecording(), hardware stopped OK"); mPreviewBuffer.clear(); @@ -684,6 +711,9 @@ status_t CameraService::Client::takePicture() return INVALID_OPERATION; } + if (mMediaPlayerClick.get() != NULL) { + mMediaPlayerClick->start(); + } return mHardware->takePicture(shutterCallback, yuvPictureCallback, jpegPictureCallback, diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h index d9b7927..6752f26 100644 --- a/camera/libcameraservice/CameraService.h +++ b/camera/libcameraservice/CameraService.h @@ -27,6 +27,8 @@ class android::MemoryHeapBase; namespace android { +class MediaPlayer; + // ---------------------------------------------------------------------------- #define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) @@ -178,6 +180,9 @@ private: sp mPreviewBuffer; int mPreviewCallbackFlag; + sp mMediaPlayerClick; + sp mMediaPlayerBeep; + // these are immutable once the object is created, // they don't need to be protected by a lock sp mCameraClient; -- cgit v1.1 From 3df5e433a2bbdec20af735fe7fd928bef8ed6ad8 Mon Sep 17 00:00:00 2001 From: Mathias Agopian <> Date: Tue, 24 Mar 2009 20:25:29 -0700 Subject: Automated import from //branches/donutburger/...@141502,141502 --- libs/surfaceflinger/LayerOrientationAnim.cpp | 187 ++++++++++++--------------- libs/surfaceflinger/LayerOrientationAnim.h | 3 +- libs/surfaceflinger/SurfaceFlinger.cpp | 3 +- libs/surfaceflinger/SurfaceFlinger.h | 2 + libs/surfaceflinger/Transform.cpp | 19 +++ libs/surfaceflinger/Transform.h | 4 +- 6 files changed, 113 insertions(+), 105 deletions(-) diff --git a/libs/surfaceflinger/LayerOrientationAnim.cpp b/libs/surfaceflinger/LayerOrientationAnim.cpp index 2b72d7c..5fec325 100644 --- a/libs/surfaceflinger/LayerOrientationAnim.cpp +++ b/libs/surfaceflinger/LayerOrientationAnim.cpp @@ -55,6 +55,7 @@ LayerOrientationAnim::LayerOrientationAnim( mOrientationCompleted = false; mFirstRedraw = false; mLastNormalizedTime = 0; + mLastAngle = 0; mLastScale = 0; mNeedsBlending = false; } @@ -94,10 +95,6 @@ void LayerOrientationAnim::validateVisibility(const Transform&) transparentRegionScreen.clear(); mTransformed = true; mCanUseCopyBit = false; - copybit_device_t* copybit = mFlinger->getBlitEngine(); - if (copybit) { - mCanUseCopyBit = true; - } } void LayerOrientationAnim::onOrientationCompleted() @@ -109,35 +106,33 @@ void LayerOrientationAnim::onOrientationCompleted() mFlinger->invalidateLayerVisibility(this); } +const float ROTATION = M_PI * 0.5f; +const float ROTATION_FACTOR = 1.0f; // 1.0 or 2.0 +const float DURATION = ms2ns(200); +const float BOUNCES_PER_SECOND = 1.618f; +const float BOUNCES_AMPLITUDE = (5.0f/180.f) * M_PI; + void LayerOrientationAnim::onDraw(const Region& clip) const { // Animation... - const float MIN_SCALE = 0.5f; - const float DURATION = ms2ns(200); - const float BOUNCES_PER_SECOND = 1.618f; - const float BOUNCES_AMPLITUDE = 1.0f/32.0f; + // FIXME: works only for portrait framebuffers + const Point size(getPhysicalSize()); + const float TARGET_SCALE = size.x * (1.0f / size.y); + const nsecs_t now = systemTime(); - float scale, alpha; + float angle, scale, alpha; if (mOrientationCompleted) { if (mFirstRedraw) { - mFirstRedraw = false; - // make a copy of what's on screen copybit_image_t image; mBitmapIn.getBitmapSurface(&image); const DisplayHardware& hw(graphicPlane(0).displayHardware()); hw.copyBackToImage(image); - - // and erase the screen for this round - glDisable(GL_BLEND); - glDisable(GL_DITHER); - glDisable(GL_SCISSOR_TEST); - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT); // FIXME: code below is gross + mFirstRedraw = false; mNeedsBlending = false; LayerOrientationAnim* self(const_cast(this)); mFlinger->invalidateLayerVisibility(self); @@ -148,36 +143,39 @@ void LayerOrientationAnim::onDraw(const Region& clip) const const float normalizedTime = (float(now - mFinishTime) / duration); if (normalizedTime <= 1.0f) { const float squaredTime = normalizedTime*normalizedTime; + angle = (ROTATION*ROTATION_FACTOR - mLastAngle)*squaredTime + mLastAngle; scale = (1.0f - mLastScale)*squaredTime + mLastScale; - alpha = (1.0f - normalizedTime); - alpha *= alpha; - alpha *= alpha; + alpha = normalizedTime; } else { mAnim->onAnimationFinished(); + angle = ROTATION; + alpha = 1.0f; scale = 1.0f; - alpha = 0.0f; } } else { const float normalizedTime = float(now - mStartTime) / DURATION; if (normalizedTime <= 1.0f) { mLastNormalizedTime = normalizedTime; const float squaredTime = normalizedTime*normalizedTime; - scale = (MIN_SCALE-1.0f)*squaredTime + 1.0f; - alpha = 1.0f; + angle = ROTATION * squaredTime; + scale = (TARGET_SCALE - 1.0f)*squaredTime + 1.0f; + alpha = 0; } else { mLastNormalizedTime = 1.0f; const float to_seconds = DURATION / seconds(1); const float phi = BOUNCES_PER_SECOND * - (((normalizedTime - 1.0f) * to_seconds)*M_PI*2); - scale = MIN_SCALE + BOUNCES_AMPLITUDE * (1.0f - cosf(phi)); - alpha = 1.0f; + (((normalizedTime - 1.0f) * to_seconds)*M_PI*2); + angle = ROTATION + BOUNCES_AMPLITUDE * sinf(phi); + scale = TARGET_SCALE; + alpha = 0; } + mLastAngle = angle; mLastScale = scale; } - drawScaled(scale, alpha); + drawScaled(angle, scale, alpha); } -void LayerOrientationAnim::drawScaled(float f, float alpha) const +void LayerOrientationAnim::drawScaled(float f, float s, float alpha) const { copybit_image_t dst; const GraphicPlane& plane(graphicPlane(0)); @@ -187,98 +185,83 @@ void LayerOrientationAnim::drawScaled(float f, float alpha) const // clear screen // TODO: with update on demand, we may be able // to not erase the screen at all during the animation - if (!mOrientationCompleted) { - glDisable(GL_BLEND); - glDisable(GL_DITHER); - glDisable(GL_SCISSOR_TEST); - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT); - } + glDisable(GL_BLEND); + glDisable(GL_DITHER); + glDisable(GL_SCISSOR_TEST); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT); - const int w = dst.w*f; - const int h = dst.h*f; - const int xc = uint32_t(dst.w-w)/2; - const int yc = uint32_t(dst.h-h)/2; - const copybit_rect_t drect = { xc, yc, xc+w, yc+h }; + const int w = dst.w; + const int h = dst.h; copybit_image_t src; mBitmap.getBitmapSurface(&src); const copybit_rect_t srect = { 0, 0, src.w, src.h }; - int err = NO_ERROR; - const int can_use_copybit = canUseCopybit(); - if (can_use_copybit) { - copybit_device_t* copybit = mFlinger->getBlitEngine(); - copybit->set_parameter(copybit, COPYBIT_TRANSFORM, 0); - copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_ENABLE); - - if (alpha < 1.0f) { - copybit_image_t srcIn; - mBitmapIn.getBitmapSurface(&srcIn); - region_iterator it(Region(Rect( drect.l, drect.t, drect.r, drect.b ))); - copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 0xFF); - err = copybit->stretch(copybit, &dst, &srcIn, &drect, &srect, &it); - } - if (!err && alpha > 0.0f) { - region_iterator it(Region(Rect( drect.l, drect.t, drect.r, drect.b ))); - copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, int(alpha*255)); - err = copybit->stretch(copybit, &dst, &src, &drect, &srect, &it); - } - LOGE_IF(err != NO_ERROR, "copybit failed (%s)", strerror(err)); + GGLSurface t; + t.version = sizeof(GGLSurface); + t.width = src.w; + t.height = src.h; + t.stride = src.w; + t.vstride= src.h; + t.format = src.format; + t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); + + const int targetOrientation = plane.getOrientation(); + if (!targetOrientation) { + f = -f; + } + + Transform tr; + tr.set(f, w*0.5f, h*0.5f); + tr.scale(s, w*0.5f, h*0.5f); + + // FIXME: we should not access mVertices and mDrawingState like that, + // but since we control the animation, we know it's going to work okay. + // eventually we'd need a more formal way of doing things like this. + LayerOrientationAnim& self(const_cast(*this)); + tr.transform(self.mVertices[0], 0, 0); + tr.transform(self.mVertices[1], 0, src.h); + tr.transform(self.mVertices[2], src.w, src.h); + tr.transform(self.mVertices[3], src.w, 0); + + if (!(mFlags & DisplayHardware::SLOW_CONFIG)) { + // Too slow to do this in software + self.mDrawingState.flags |= ISurfaceComposer::eLayerFilter; } - if (!can_use_copybit || err) { - GGLSurface t; - t.version = sizeof(GGLSurface); - t.width = src.w; - t.height = src.h; - t.stride = src.w; - t.vstride= src.h; - t.format = src.format; - t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); - Transform tr; - tr.set(f,0,0,f); - tr.set(xc, yc); - - // FIXME: we should not access mVertices and mDrawingState like that, - // but since we control the animation, we know it's going to work okay. - // eventually we'd need a more formal way of doing things like this. - LayerOrientationAnim& self(const_cast(*this)); + if (UNLIKELY(mTextureName == -1LU)) { + mTextureName = createTexture(); + GLuint w=0, h=0; + const Region dirty(Rect(t.width, t.height)); + loadTexture(dirty, mTextureName, t, w, h); + } + self.mDrawingState.alpha = 255; //-int(alpha*255); + const Region clip(Rect( srect.l, srect.t, srect.r, srect.b )); + drawWithOpenGL(clip, mTextureName, t); + + if (alpha > 0) { + const float sign = (!targetOrientation) ? 1.0f : -1.0f; + tr.set(f + sign*(M_PI * 0.5f * ROTATION_FACTOR), w*0.5f, h*0.5f); + tr.scale(s, w*0.5f, h*0.5f); tr.transform(self.mVertices[0], 0, 0); tr.transform(self.mVertices[1], 0, src.h); tr.transform(self.mVertices[2], src.w, src.h); tr.transform(self.mVertices[3], src.w, 0); - if (!(mFlags & DisplayHardware::SLOW_CONFIG)) { - // Too slow to do this in software - self.mDrawingState.flags |= ISurfaceComposer::eLayerFilter; - } - - if (alpha < 1.0f) { - copybit_image_t src; - mBitmapIn.getBitmapSurface(&src); - t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); - if (UNLIKELY(mTextureNameIn == -1LU)) { - mTextureNameIn = createTexture(); - GLuint w=0, h=0; - const Region dirty(Rect(t.width, t.height)); - loadTexture(dirty, mTextureNameIn, t, w, h); - } - self.mDrawingState.alpha = 255; - const Region clip(Rect( drect.l, drect.t, drect.r, drect.b )); - drawWithOpenGL(clip, mTextureName, t); - } + copybit_image_t src; + mBitmapIn.getBitmapSurface(&src); t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); - if (UNLIKELY(mTextureName == -1LU)) { - mTextureName = createTexture(); + if (UNLIKELY(mTextureNameIn == -1LU)) { + mTextureNameIn = createTexture(); GLuint w=0, h=0; const Region dirty(Rect(t.width, t.height)); - loadTexture(dirty, mTextureName, t, w, h); + loadTexture(dirty, mTextureNameIn, t, w, h); } self.mDrawingState.alpha = int(alpha*255); - const Region clip(Rect( drect.l, drect.t, drect.r, drect.b )); - drawWithOpenGL(clip, mTextureName, t); + const Region clip(Rect( srect.l, srect.t, srect.r, srect.b )); + drawWithOpenGL(clip, mTextureNameIn, t); } } diff --git a/libs/surfaceflinger/LayerOrientationAnim.h b/libs/surfaceflinger/LayerOrientationAnim.h index 7367685..b527c7e 100644 --- a/libs/surfaceflinger/LayerOrientationAnim.h +++ b/libs/surfaceflinger/LayerOrientationAnim.h @@ -52,7 +52,7 @@ public: virtual bool needsBlending() const; virtual bool isSecure() const { return false; } private: - void drawScaled(float scale, float alpha) const; + void drawScaled(float angle, float scale, float alpha) const; OrientationAnimation* mAnim; LayerBitmap mBitmap; @@ -62,6 +62,7 @@ private: bool mOrientationCompleted; mutable bool mFirstRedraw; mutable float mLastNormalizedTime; + mutable float mLastAngle; mutable float mLastScale; mutable GLuint mTextureName; mutable GLuint mTextureNameIn; diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index d915a84..8499b67 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -1804,6 +1804,7 @@ status_t GraphicPlane::setOrientation(int orientation) if (orientation == ISurfaceComposer::eOrientationDefault) { // make sure the default orientation is optimal mOrientationTransform.reset(); + mOrientation = orientation; mGlobalTransform = mTransform; return NO_ERROR; } @@ -1824,7 +1825,7 @@ status_t GraphicPlane::setOrientation(int orientation) GraphicPlane::orientationToTransfrom(orientation, w, h, &mOrientationTransform); } - + mOrientation = orientation; mGlobalTransform = mOrientationTransform * mTransform; return NO_ERROR; } diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h index f7d7764..3c10481 100644 --- a/libs/surfaceflinger/SurfaceFlinger.h +++ b/libs/surfaceflinger/SurfaceFlinger.h @@ -122,6 +122,7 @@ public: void setDisplayHardware(DisplayHardware *); void setTransform(const Transform& tr); status_t setOrientation(int orientation); + int getOrientation() const { return mOrientation; } const DisplayHardware& displayHardware() const; const Transform& transform() const; @@ -133,6 +134,7 @@ private: Transform mTransform; Transform mOrientationTransform; Transform mGlobalTransform; + int mOrientation; }; // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/Transform.cpp b/libs/surfaceflinger/Transform.cpp index bec7a64..e8b0f45 100644 --- a/libs/surfaceflinger/Transform.cpp +++ b/libs/surfaceflinger/Transform.cpp @@ -103,6 +103,25 @@ void Transform::set( float xx, float xy, mType |= 0x80000000; } +void Transform::set(float radian, float x, float y) +{ + float r00 = cosf(radian); float r01 = -sinf(radian); + float r10 = sinf(radian); float r11 = cosf(radian); + mTransform.set(SkMatrix::kMScaleX, SkFloatToScalar(r00)); + mTransform.set(SkMatrix::kMSkewX, SkFloatToScalar(r01)); + mTransform.set(SkMatrix::kMSkewY, SkFloatToScalar(r10)); + mTransform.set(SkMatrix::kMScaleY, SkFloatToScalar(r11)); + mTransform.set(SkMatrix::kMTransX, SkIntToScalar(x - r00*x - r01*y)); + mTransform.set(SkMatrix::kMTransY, SkIntToScalar(y - r10*x - r11*y)); + mType |= 0x80000000 | SkMatrix::kTranslate_Mask; +} + +void Transform::scale(float s, float x, float y) +{ + mTransform.postScale(s, s, x, y); + mType |= 0x80000000; +} + void Transform::set(int tx, int ty) { if (tx | ty) { diff --git a/libs/surfaceflinger/Transform.h b/libs/surfaceflinger/Transform.h index 0b4835e..4c4528e 100644 --- a/libs/surfaceflinger/Transform.h +++ b/libs/surfaceflinger/Transform.h @@ -60,7 +60,9 @@ public: void reset(); void set(float xx, float xy, float yx, float yy); void set(int tx, int ty); - + void set(float radian, float x, float y); + void scale(float s, float x, float y); + Rect makeBounds(int w, int h) const; void transform(GLfixed* point, int x, int y) const; Region transform(const Region& reg) const; -- cgit v1.1 From 9e431ace328b4c61ca163fc59eed8ca5e51f58c8 Mon Sep 17 00:00:00 2001 From: Jason Sams <> Date: Tue, 24 Mar 2009 20:36:57 -0700 Subject: Automated import from //branches/donutburger/...@141598,141598 --- camera/libcameraservice/CameraService.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 851b213..c5c95b0 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -283,8 +283,14 @@ CameraService::Client::~Client() #endif } - mMediaPlayerBeep.clear(); - mMediaPlayerClick.clear(); + if (mMediaPlayerBeep.get() != NULL) { + mMediaPlayerBeep->disconnect(); + mMediaPlayerBeep.clear(); + } + if (mMediaPlayerClick.get() != NULL) { + mMediaPlayerClick->disconnect(); + mMediaPlayerClick.clear(); + } // make sure we tear down the hardware mClientPid = IPCThreadState::self()->getCallingPid(); @@ -711,9 +717,6 @@ status_t CameraService::Client::takePicture() return INVALID_OPERATION; } - if (mMediaPlayerClick.get() != NULL) { - mMediaPlayerClick->start(); - } return mHardware->takePicture(shutterCallback, yuvPictureCallback, jpegPictureCallback, @@ -751,6 +754,10 @@ void CameraService::Client::shutterCallback(void *user) client->mSurface->registerBuffers(buffers); } + + if (client->mMediaPlayerClick.get() != NULL) { + client->mMediaPlayerClick->start(); + } } // picture callback - raw image ready -- cgit v1.1 From aab44b8cca4d51704669c345477fca84c235720a Mon Sep 17 00:00:00 2001 From: Wu-cheng Li <> Date: Tue, 24 Mar 2009 20:39:09 -0700 Subject: Automated import from //branches/donutburger/...@141614,141614 --- camera/libcameraservice/CameraService.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index c5c95b0..6a6a811 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -731,6 +731,11 @@ void CameraService::Client::shutterCallback(void *user) return; } + // Play shutter sound. + if (client->mMediaPlayerClick.get() != NULL) { + client->mMediaPlayerClick->start(); + } + // Screen goes black after the buffer is unregistered. if (client->mSurface != 0 && !client->mUseOverlay) { client->mSurface->unregisterBuffers(); @@ -754,10 +759,6 @@ void CameraService::Client::shutterCallback(void *user) client->mSurface->registerBuffers(buffers); } - - if (client->mMediaPlayerClick.get() != NULL) { - client->mMediaPlayerClick->start(); - } } // picture callback - raw image ready -- cgit v1.1 From a26e6060f3483da9793cc871ea6ff1565a809648 Mon Sep 17 00:00:00 2001 From: Andreas Huber <> Date: Tue, 24 Mar 2009 20:47:19 -0700 Subject: Automated import from //branches/donutburger/...@141711,141711 --- camera/libcameraservice/CameraService.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 6a6a811..7e5fdbe 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -492,6 +492,7 @@ status_t CameraService::Client::startPreview() status_t CameraService::Client::startRecording() { if (mMediaPlayerBeep.get() != NULL) { + mMediaPlayerBeep->seekTo(0); mMediaPlayerBeep->start(); } return startCameraMode(CAMERA_RECORDING_MODE); @@ -533,6 +534,7 @@ void CameraService::Client::stopRecording() } if (mMediaPlayerBeep.get() != NULL) { + mMediaPlayerBeep->seekTo(0); mMediaPlayerBeep->start(); } mHardware->stopRecording(); @@ -733,6 +735,7 @@ void CameraService::Client::shutterCallback(void *user) // Play shutter sound. if (client->mMediaPlayerClick.get() != NULL) { + client->mMediaPlayerClick->seekTo(0); client->mMediaPlayerClick->start(); } -- cgit v1.1 From c8f10f8374f7acac8329767a5e49c7a019989b91 Mon Sep 17 00:00:00 2001 From: Niko Catania <> Date: Tue, 24 Mar 2009 20:53:55 -0700 Subject: Automated import from //branches/donutburger/...@141782,141782 --- camera/libcameraservice/CameraHardwareStub.cpp | 2 +- camera/libcameraservice/FakeCamera.cpp | 30 ++++++++++++++++++++++++-- camera/libcameraservice/FakeCamera.h | 21 +++++++++++++++--- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/camera/libcameraservice/CameraHardwareStub.cpp b/camera/libcameraservice/CameraHardwareStub.cpp index 0f1ae8e..a7af57c 100644 --- a/camera/libcameraservice/CameraHardwareStub.cpp +++ b/camera/libcameraservice/CameraHardwareStub.cpp @@ -314,7 +314,7 @@ status_t CameraHardwareStub::dump(int fd, const Vector& args) const String8 result; AutoMutex lock(&mLock); if (mFakeCamera != 0) { - mFakeCamera->dump(fd, args); + mFakeCamera->dump(fd); mParameters.dump(fd, args); snprintf(buffer, 255, " preview frame(%d), size (%d), running(%s)\n", mCurrentPreviewFrame, mPreviewFrameSize, mPreviewRunning?"true": "false"); result.append(buffer); diff --git a/camera/libcameraservice/FakeCamera.cpp b/camera/libcameraservice/FakeCamera.cpp index 3592eab..3daf47d 100644 --- a/camera/libcameraservice/FakeCamera.cpp +++ b/camera/libcameraservice/FakeCamera.cpp @@ -1,12 +1,39 @@ +/* +** +** Copyright 2008, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + #define LOG_TAG "FakeCamera" #include #include #include +#include + #include "FakeCamera.h" + namespace android { +// TODO: All this rgb to yuv should probably be in a util class. + +// TODO: I think something is wrong in this class because the shadow is kBlue +// and the square color should alternate between kRed and kGreen. However on the +// emulator screen these are all shades of gray. Y seems ok but the U and V are +// probably not. + static int tables_initialized = 0; uint8_t *gYTable, *gCbTable, *gCrTable; @@ -389,7 +416,7 @@ void FakeCamera::drawCheckerboard(uint16_t *dst, int size) } -status_t FakeCamera::dump(int fd, const Vector& args) +void FakeCamera::dump(int fd) const { const size_t SIZE = 256; char buffer[SIZE]; @@ -397,7 +424,6 @@ status_t FakeCamera::dump(int fd, const Vector& args) snprintf(buffer, 255, " width x height (%d x %d), counter (%d), check x-y coordinate(%d, %d)\n", mWidth, mHeight, mCounter, mCheckX, mCheckY); result.append(buffer); ::write(fd, result.string(), result.size()); - return NO_ERROR; } diff --git a/camera/libcameraservice/FakeCamera.h b/camera/libcameraservice/FakeCamera.h index 77c994c..da9e944 100644 --- a/camera/libcameraservice/FakeCamera.h +++ b/camera/libcameraservice/FakeCamera.h @@ -18,21 +18,36 @@ #ifndef ANDROID_HARDWARE_FAKECAMERA_H #define ANDROID_HARDWARE_FAKECAMERA_H -#include +#include namespace android { +/* + * FakeCamera is used in the CameraHardwareStub to provide a fake video feed + * when the system does not have a camera in hardware. + * The fake video is a moving black and white checkerboard background with a + * bouncing gray square in the foreground. + * This class is not thread-safe. + * + * TODO: Since the major methods provides a raw/uncompressed video feed, rename + * this class to RawVideoSource. + */ + class FakeCamera { public: FakeCamera(int width, int height); ~FakeCamera(); void setSize(int width, int height); - void getNextFrameAsRgb565(uint16_t *buffer); void getNextFrameAsYuv422(uint8_t *buffer); - status_t dump(int fd, const Vector& args); + // Write to the fd a string representing the current state. + void dump(int fd) const; private: + // TODO: remove the uint16_t buffer param everywhere since it is a field of + // this class. + void getNextFrameAsRgb565(uint16_t *buffer); + void drawSquare(uint16_t *buffer, int x, int y, int size, int color, int shadow); void drawCheckerboard(uint16_t *buffer, int size); -- cgit v1.1 From 44426618172ab6605fd0d1eb1459cd2b3c8069df Mon Sep 17 00:00:00 2001 From: Andy McFadden <> Date: Tue, 24 Mar 2009 21:16:04 -0700 Subject: Automated import from //branches/donutburger/...@141992,141992 --- camera/libcameraservice/FakeCamera.h | 1 + 1 file changed, 1 insertion(+) diff --git a/camera/libcameraservice/FakeCamera.h b/camera/libcameraservice/FakeCamera.h index da9e944..f7f8803 100644 --- a/camera/libcameraservice/FakeCamera.h +++ b/camera/libcameraservice/FakeCamera.h @@ -19,6 +19,7 @@ #define ANDROID_HARDWARE_FAKECAMERA_H #include +#include namespace android { -- cgit v1.1 From 6219dd7d3a685725e1f8e0fad94e6aa64492ca82 Mon Sep 17 00:00:00 2001 From: Mathias Agopian <> Date: Tue, 24 Mar 2009 22:42:15 -0700 Subject: Automated import from //branches/donutburger/...@142430,142430 --- libs/surfaceflinger/BootAnimation.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/surfaceflinger/BootAnimation.cpp b/libs/surfaceflinger/BootAnimation.cpp index 03edbf3..db40385 100644 --- a/libs/surfaceflinger/BootAnimation.cpp +++ b/libs/surfaceflinger/BootAnimation.cpp @@ -164,9 +164,7 @@ status_t BootAnimation::readyToRun() { // initialize GL glShadeModel(GL_FLAT); - glEnable(GL_DITHER); glEnable(GL_TEXTURE_2D); - glEnable(GL_SCISSOR_TEST); glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); return NO_ERROR; @@ -196,8 +194,6 @@ bool BootAnimation::android() { glClear(GL_COLOR_BUFFER_BIT); eglSwapBuffers(mDisplay, mSurface); - // wait ~1s - const GLint xc = (mWidth - mAndroid[0].w) / 2; const GLint yc = (mHeight - mAndroid[0].h) / 2; const Rect updateRect(xc, yc, xc + mAndroid[0].w, yc + mAndroid[0].h); @@ -216,7 +212,8 @@ bool BootAnimation::android() { const nsecs_t startTime = systemTime(); do { - double time = systemTime() - startTime; + nsecs_t now = systemTime(); + double time = now - startTime; float t = 4.0f * float(time / us2ns(16667)) / mAndroid[1].w; GLint offset = (1 - (t - floorf(t))) * mAndroid[1].w; GLint x = xc - offset; @@ -231,6 +228,11 @@ bool BootAnimation::android() { glDrawTexiOES(xc, yc, 0, mAndroid[0].w, mAndroid[0].h); eglSwapBuffers(mDisplay, mSurface); + + // 12fps: don't animate too fast to preserve CPU + const nsecs_t sleepTime = 83333 - ns2us(systemTime() - now); + if (sleepTime > 0) + usleep(sleepTime); } while (!exitPending()); glDeleteTextures(1, &mAndroid[0].name); -- cgit v1.1 From 74c770be33d41f129334de97ce4d0db141312d02 Mon Sep 17 00:00:00 2001 From: Mathias Agopian <> Date: Tue, 24 Mar 2009 22:43:22 -0700 Subject: Automated import from //branches/donutburger/...@142446,142446 --- libs/surfaceflinger/LayerOrientationAnim.cpp | 187 +++++++++++++++------------ libs/surfaceflinger/LayerOrientationAnim.h | 3 +- libs/surfaceflinger/SurfaceFlinger.cpp | 3 +- libs/surfaceflinger/SurfaceFlinger.h | 2 - libs/surfaceflinger/Transform.cpp | 19 --- libs/surfaceflinger/Transform.h | 4 +- 6 files changed, 105 insertions(+), 113 deletions(-) diff --git a/libs/surfaceflinger/LayerOrientationAnim.cpp b/libs/surfaceflinger/LayerOrientationAnim.cpp index 5fec325..2b72d7c 100644 --- a/libs/surfaceflinger/LayerOrientationAnim.cpp +++ b/libs/surfaceflinger/LayerOrientationAnim.cpp @@ -55,7 +55,6 @@ LayerOrientationAnim::LayerOrientationAnim( mOrientationCompleted = false; mFirstRedraw = false; mLastNormalizedTime = 0; - mLastAngle = 0; mLastScale = 0; mNeedsBlending = false; } @@ -95,6 +94,10 @@ void LayerOrientationAnim::validateVisibility(const Transform&) transparentRegionScreen.clear(); mTransformed = true; mCanUseCopyBit = false; + copybit_device_t* copybit = mFlinger->getBlitEngine(); + if (copybit) { + mCanUseCopyBit = true; + } } void LayerOrientationAnim::onOrientationCompleted() @@ -106,33 +109,35 @@ void LayerOrientationAnim::onOrientationCompleted() mFlinger->invalidateLayerVisibility(this); } -const float ROTATION = M_PI * 0.5f; -const float ROTATION_FACTOR = 1.0f; // 1.0 or 2.0 -const float DURATION = ms2ns(200); -const float BOUNCES_PER_SECOND = 1.618f; -const float BOUNCES_AMPLITUDE = (5.0f/180.f) * M_PI; - void LayerOrientationAnim::onDraw(const Region& clip) const { // Animation... + const float MIN_SCALE = 0.5f; + const float DURATION = ms2ns(200); + const float BOUNCES_PER_SECOND = 1.618f; + const float BOUNCES_AMPLITUDE = 1.0f/32.0f; - // FIXME: works only for portrait framebuffers - const Point size(getPhysicalSize()); - const float TARGET_SCALE = size.x * (1.0f / size.y); - const nsecs_t now = systemTime(); - float angle, scale, alpha; + float scale, alpha; if (mOrientationCompleted) { if (mFirstRedraw) { + mFirstRedraw = false; + // make a copy of what's on screen copybit_image_t image; mBitmapIn.getBitmapSurface(&image); const DisplayHardware& hw(graphicPlane(0).displayHardware()); hw.copyBackToImage(image); + + // and erase the screen for this round + glDisable(GL_BLEND); + glDisable(GL_DITHER); + glDisable(GL_SCISSOR_TEST); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT); // FIXME: code below is gross - mFirstRedraw = false; mNeedsBlending = false; LayerOrientationAnim* self(const_cast(this)); mFlinger->invalidateLayerVisibility(self); @@ -143,39 +148,36 @@ void LayerOrientationAnim::onDraw(const Region& clip) const const float normalizedTime = (float(now - mFinishTime) / duration); if (normalizedTime <= 1.0f) { const float squaredTime = normalizedTime*normalizedTime; - angle = (ROTATION*ROTATION_FACTOR - mLastAngle)*squaredTime + mLastAngle; scale = (1.0f - mLastScale)*squaredTime + mLastScale; - alpha = normalizedTime; + alpha = (1.0f - normalizedTime); + alpha *= alpha; + alpha *= alpha; } else { mAnim->onAnimationFinished(); - angle = ROTATION; - alpha = 1.0f; scale = 1.0f; + alpha = 0.0f; } } else { const float normalizedTime = float(now - mStartTime) / DURATION; if (normalizedTime <= 1.0f) { mLastNormalizedTime = normalizedTime; const float squaredTime = normalizedTime*normalizedTime; - angle = ROTATION * squaredTime; - scale = (TARGET_SCALE - 1.0f)*squaredTime + 1.0f; - alpha = 0; + scale = (MIN_SCALE-1.0f)*squaredTime + 1.0f; + alpha = 1.0f; } else { mLastNormalizedTime = 1.0f; const float to_seconds = DURATION / seconds(1); const float phi = BOUNCES_PER_SECOND * - (((normalizedTime - 1.0f) * to_seconds)*M_PI*2); - angle = ROTATION + BOUNCES_AMPLITUDE * sinf(phi); - scale = TARGET_SCALE; - alpha = 0; + (((normalizedTime - 1.0f) * to_seconds)*M_PI*2); + scale = MIN_SCALE + BOUNCES_AMPLITUDE * (1.0f - cosf(phi)); + alpha = 1.0f; } - mLastAngle = angle; mLastScale = scale; } - drawScaled(angle, scale, alpha); + drawScaled(scale, alpha); } -void LayerOrientationAnim::drawScaled(float f, float s, float alpha) const +void LayerOrientationAnim::drawScaled(float f, float alpha) const { copybit_image_t dst; const GraphicPlane& plane(graphicPlane(0)); @@ -185,83 +187,98 @@ void LayerOrientationAnim::drawScaled(float f, float s, float alpha) const // clear screen // TODO: with update on demand, we may be able // to not erase the screen at all during the animation - glDisable(GL_BLEND); - glDisable(GL_DITHER); - glDisable(GL_SCISSOR_TEST); - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT); + if (!mOrientationCompleted) { + glDisable(GL_BLEND); + glDisable(GL_DITHER); + glDisable(GL_SCISSOR_TEST); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT); + } - const int w = dst.w; - const int h = dst.h; + const int w = dst.w*f; + const int h = dst.h*f; + const int xc = uint32_t(dst.w-w)/2; + const int yc = uint32_t(dst.h-h)/2; + const copybit_rect_t drect = { xc, yc, xc+w, yc+h }; copybit_image_t src; mBitmap.getBitmapSurface(&src); const copybit_rect_t srect = { 0, 0, src.w, src.h }; + int err = NO_ERROR; + const int can_use_copybit = canUseCopybit(); + if (can_use_copybit) { + copybit_device_t* copybit = mFlinger->getBlitEngine(); + copybit->set_parameter(copybit, COPYBIT_TRANSFORM, 0); + copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_ENABLE); + + if (alpha < 1.0f) { + copybit_image_t srcIn; + mBitmapIn.getBitmapSurface(&srcIn); + region_iterator it(Region(Rect( drect.l, drect.t, drect.r, drect.b ))); + copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 0xFF); + err = copybit->stretch(copybit, &dst, &srcIn, &drect, &srect, &it); + } - GGLSurface t; - t.version = sizeof(GGLSurface); - t.width = src.w; - t.height = src.h; - t.stride = src.w; - t.vstride= src.h; - t.format = src.format; - t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); - - const int targetOrientation = plane.getOrientation(); - if (!targetOrientation) { - f = -f; - } - - Transform tr; - tr.set(f, w*0.5f, h*0.5f); - tr.scale(s, w*0.5f, h*0.5f); - - // FIXME: we should not access mVertices and mDrawingState like that, - // but since we control the animation, we know it's going to work okay. - // eventually we'd need a more formal way of doing things like this. - LayerOrientationAnim& self(const_cast(*this)); - tr.transform(self.mVertices[0], 0, 0); - tr.transform(self.mVertices[1], 0, src.h); - tr.transform(self.mVertices[2], src.w, src.h); - tr.transform(self.mVertices[3], src.w, 0); - - if (!(mFlags & DisplayHardware::SLOW_CONFIG)) { - // Too slow to do this in software - self.mDrawingState.flags |= ISurfaceComposer::eLayerFilter; + if (!err && alpha > 0.0f) { + region_iterator it(Region(Rect( drect.l, drect.t, drect.r, drect.b ))); + copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, int(alpha*255)); + err = copybit->stretch(copybit, &dst, &src, &drect, &srect, &it); + } + LOGE_IF(err != NO_ERROR, "copybit failed (%s)", strerror(err)); } + if (!can_use_copybit || err) { + GGLSurface t; + t.version = sizeof(GGLSurface); + t.width = src.w; + t.height = src.h; + t.stride = src.w; + t.vstride= src.h; + t.format = src.format; + t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); - if (UNLIKELY(mTextureName == -1LU)) { - mTextureName = createTexture(); - GLuint w=0, h=0; - const Region dirty(Rect(t.width, t.height)); - loadTexture(dirty, mTextureName, t, w, h); - } - self.mDrawingState.alpha = 255; //-int(alpha*255); - const Region clip(Rect( srect.l, srect.t, srect.r, srect.b )); - drawWithOpenGL(clip, mTextureName, t); - - if (alpha > 0) { - const float sign = (!targetOrientation) ? 1.0f : -1.0f; - tr.set(f + sign*(M_PI * 0.5f * ROTATION_FACTOR), w*0.5f, h*0.5f); - tr.scale(s, w*0.5f, h*0.5f); + Transform tr; + tr.set(f,0,0,f); + tr.set(xc, yc); + + // FIXME: we should not access mVertices and mDrawingState like that, + // but since we control the animation, we know it's going to work okay. + // eventually we'd need a more formal way of doing things like this. + LayerOrientationAnim& self(const_cast(*this)); tr.transform(self.mVertices[0], 0, 0); tr.transform(self.mVertices[1], 0, src.h); tr.transform(self.mVertices[2], src.w, src.h); tr.transform(self.mVertices[3], src.w, 0); + if (!(mFlags & DisplayHardware::SLOW_CONFIG)) { + // Too slow to do this in software + self.mDrawingState.flags |= ISurfaceComposer::eLayerFilter; + } + + if (alpha < 1.0f) { + copybit_image_t src; + mBitmapIn.getBitmapSurface(&src); + t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); + if (UNLIKELY(mTextureNameIn == -1LU)) { + mTextureNameIn = createTexture(); + GLuint w=0, h=0; + const Region dirty(Rect(t.width, t.height)); + loadTexture(dirty, mTextureNameIn, t, w, h); + } + self.mDrawingState.alpha = 255; + const Region clip(Rect( drect.l, drect.t, drect.r, drect.b )); + drawWithOpenGL(clip, mTextureName, t); + } - copybit_image_t src; - mBitmapIn.getBitmapSurface(&src); t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); - if (UNLIKELY(mTextureNameIn == -1LU)) { - mTextureNameIn = createTexture(); + if (UNLIKELY(mTextureName == -1LU)) { + mTextureName = createTexture(); GLuint w=0, h=0; const Region dirty(Rect(t.width, t.height)); - loadTexture(dirty, mTextureNameIn, t, w, h); + loadTexture(dirty, mTextureName, t, w, h); } self.mDrawingState.alpha = int(alpha*255); - const Region clip(Rect( srect.l, srect.t, srect.r, srect.b )); - drawWithOpenGL(clip, mTextureNameIn, t); + const Region clip(Rect( drect.l, drect.t, drect.r, drect.b )); + drawWithOpenGL(clip, mTextureName, t); } } diff --git a/libs/surfaceflinger/LayerOrientationAnim.h b/libs/surfaceflinger/LayerOrientationAnim.h index b527c7e..7367685 100644 --- a/libs/surfaceflinger/LayerOrientationAnim.h +++ b/libs/surfaceflinger/LayerOrientationAnim.h @@ -52,7 +52,7 @@ public: virtual bool needsBlending() const; virtual bool isSecure() const { return false; } private: - void drawScaled(float angle, float scale, float alpha) const; + void drawScaled(float scale, float alpha) const; OrientationAnimation* mAnim; LayerBitmap mBitmap; @@ -62,7 +62,6 @@ private: bool mOrientationCompleted; mutable bool mFirstRedraw; mutable float mLastNormalizedTime; - mutable float mLastAngle; mutable float mLastScale; mutable GLuint mTextureName; mutable GLuint mTextureNameIn; diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index 8499b67..d915a84 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -1804,7 +1804,6 @@ status_t GraphicPlane::setOrientation(int orientation) if (orientation == ISurfaceComposer::eOrientationDefault) { // make sure the default orientation is optimal mOrientationTransform.reset(); - mOrientation = orientation; mGlobalTransform = mTransform; return NO_ERROR; } @@ -1825,7 +1824,7 @@ status_t GraphicPlane::setOrientation(int orientation) GraphicPlane::orientationToTransfrom(orientation, w, h, &mOrientationTransform); } - mOrientation = orientation; + mGlobalTransform = mOrientationTransform * mTransform; return NO_ERROR; } diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h index 3c10481..f7d7764 100644 --- a/libs/surfaceflinger/SurfaceFlinger.h +++ b/libs/surfaceflinger/SurfaceFlinger.h @@ -122,7 +122,6 @@ public: void setDisplayHardware(DisplayHardware *); void setTransform(const Transform& tr); status_t setOrientation(int orientation); - int getOrientation() const { return mOrientation; } const DisplayHardware& displayHardware() const; const Transform& transform() const; @@ -134,7 +133,6 @@ private: Transform mTransform; Transform mOrientationTransform; Transform mGlobalTransform; - int mOrientation; }; // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/Transform.cpp b/libs/surfaceflinger/Transform.cpp index e8b0f45..bec7a64 100644 --- a/libs/surfaceflinger/Transform.cpp +++ b/libs/surfaceflinger/Transform.cpp @@ -103,25 +103,6 @@ void Transform::set( float xx, float xy, mType |= 0x80000000; } -void Transform::set(float radian, float x, float y) -{ - float r00 = cosf(radian); float r01 = -sinf(radian); - float r10 = sinf(radian); float r11 = cosf(radian); - mTransform.set(SkMatrix::kMScaleX, SkFloatToScalar(r00)); - mTransform.set(SkMatrix::kMSkewX, SkFloatToScalar(r01)); - mTransform.set(SkMatrix::kMSkewY, SkFloatToScalar(r10)); - mTransform.set(SkMatrix::kMScaleY, SkFloatToScalar(r11)); - mTransform.set(SkMatrix::kMTransX, SkIntToScalar(x - r00*x - r01*y)); - mTransform.set(SkMatrix::kMTransY, SkIntToScalar(y - r10*x - r11*y)); - mType |= 0x80000000 | SkMatrix::kTranslate_Mask; -} - -void Transform::scale(float s, float x, float y) -{ - mTransform.postScale(s, s, x, y); - mType |= 0x80000000; -} - void Transform::set(int tx, int ty) { if (tx | ty) { diff --git a/libs/surfaceflinger/Transform.h b/libs/surfaceflinger/Transform.h index 4c4528e..0b4835e 100644 --- a/libs/surfaceflinger/Transform.h +++ b/libs/surfaceflinger/Transform.h @@ -60,9 +60,7 @@ public: void reset(); void set(float xx, float xy, float yx, float yy); void set(int tx, int ty); - void set(float radian, float x, float y); - void scale(float s, float x, float y); - + Rect makeBounds(int w, int h) const; void transform(GLfixed* point, int x, int y) const; Region transform(const Region& reg) const; -- cgit v1.1 From 87d80228cc6b8904da036d51d41252f8301e41d2 Mon Sep 17 00:00:00 2001 From: Jack Palevich <> Date: Tue, 24 Mar 2009 22:48:26 -0700 Subject: Automated import from //branches/donutburger/...@142484,142484 --- opengl/libagl/egl.cpp | 24 ++++++++++++++++++------ opengl/libs/EGL/egl.cpp | 35 ++++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 5b90bf0..3b4c041 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -1055,8 +1055,12 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); + + if (ggl_unlikely(num_config==0)) { + return setError(EGL_BAD_PARAMETER, EGL_FALSE); + } - if (ggl_unlikely(configs==0 || attrib_list==0)) { + if (ggl_unlikely(attrib_list==0)) { *num_config = 0; return EGL_TRUE; } @@ -1102,11 +1106,19 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, // return the configurations found int n=0; if (possibleMatch) { - for (int i=0 ; config_size && i0) { // n has to be 0 or 1, by construction, and we already know // which config it will return (since there can be only one). - configs[0] = MAKE_CONFIG(i, index); + if (configs) { + configs[0] = MAKE_CONFIG(i, index); + } *num_config = 1; } } @@ -798,19 +799,23 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, if (cnx->dso) { if (cnx->hooks->egl.eglChooseConfig( dp->dpys[i], attrib_list, configs, config_size, &n)) { - // now we need to convert these client EGLConfig to our - // internal EGLConfig format. This is done in O(n log n). - for (int j=0 ; j( - dp->configs[i], 0, dp->numConfigs[i]-1, configs[j]); - if (index >= 0) { - configs[j] = MAKE_CONFIG(i, index); - } else { - return setError(EGL_BAD_CONFIG, EGL_FALSE); + if (configs) { + // now we need to convert these client EGLConfig to our + // internal EGLConfig format. This is done in O(n log n). + for (int j=0 ; j( + dp->configs[i], 0, dp->numConfigs[i]-1, configs[j]); + if (index >= 0) { + if (configs) { + configs[j] = MAKE_CONFIG(i, index); + } + } else { + return setError(EGL_BAD_CONFIG, EGL_FALSE); + } } + configs += n; + config_size -= n; } - configs += n; - config_size -= n; *num_config += n; res = EGL_TRUE; } -- cgit v1.1 From c1992a6f7551e22f14bb3fb92f1bd0b074cdac32 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Wed, 25 Mar 2009 17:24:35 -0700 Subject: Automated import from //branches/donutburger/...@142727,142727 --- libs/ui/EventHub.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp index 3b29b09..7c2fc8e 100644 --- a/libs/ui/EventHub.cpp +++ b/libs/ui/EventHub.cpp @@ -245,6 +245,7 @@ EventHub::device_t* EventHub::getDevice(int32_t deviceId) const int32_t id = deviceId & ID_MASK; if (id >= mNumDevicesById || id < 0) return NULL; device_t* dev = mDevicesById[id].device; + if (dev == NULL) return NULL; if (dev->id == deviceId) { return dev; } -- cgit v1.1 From ecbeaa0cf1cd0bf1bcb00bb25502137db5a9847f Mon Sep 17 00:00:00 2001 From: Mathias Agopian <> Date: Fri, 27 Mar 2009 15:36:09 -0700 Subject: AI 143160: am: CL 142856 new-new-new-new rotation animation. it may still change one more time. Original author: mathias Merged from: //branches/cupcake/... Automated import of CL 143160 --- libs/surfaceflinger/Android.mk | 1 + libs/surfaceflinger/LayerOrientationAnim.cpp | 152 +++++++----- libs/surfaceflinger/LayerOrientationAnim.h | 49 +++- libs/surfaceflinger/LayerOrientationAnimRotate.cpp | 274 +++++++++++++++++++++ libs/surfaceflinger/LayerOrientationAnimRotate.h | 76 ++++++ libs/surfaceflinger/OrientationAnimation.cpp | 9 +- libs/surfaceflinger/OrientationAnimation.h | 2 +- libs/surfaceflinger/SurfaceFlinger.cpp | 3 +- libs/surfaceflinger/SurfaceFlinger.h | 2 + libs/surfaceflinger/Transform.cpp | 19 ++ libs/surfaceflinger/Transform.h | 4 +- 11 files changed, 514 insertions(+), 77 deletions(-) create mode 100644 libs/surfaceflinger/LayerOrientationAnimRotate.cpp create mode 100644 libs/surfaceflinger/LayerOrientationAnimRotate.h diff --git a/libs/surfaceflinger/Android.mk b/libs/surfaceflinger/Android.mk index 496e271..2212436 100644 --- a/libs/surfaceflinger/Android.mk +++ b/libs/surfaceflinger/Android.mk @@ -16,6 +16,7 @@ LOCAL_SRC_FILES:= \ LayerBitmap.cpp \ LayerDim.cpp \ LayerOrientationAnim.cpp \ + LayerOrientationAnimRotate.cpp \ OrientationAnimation.cpp \ SurfaceFlinger.cpp \ Tokenizer.cpp \ diff --git a/libs/surfaceflinger/LayerOrientationAnim.cpp b/libs/surfaceflinger/LayerOrientationAnim.cpp index 2b72d7c..3e4035e 100644 --- a/libs/surfaceflinger/LayerOrientationAnim.cpp +++ b/libs/surfaceflinger/LayerOrientationAnim.cpp @@ -22,11 +22,13 @@ #include #include +#include #include #include +#include "BlurFilter.h" #include "LayerBase.h" #include "LayerOrientationAnim.h" #include "SurfaceFlinger.h" @@ -41,22 +43,35 @@ const char* const LayerOrientationAnim::typeID = "LayerOrientationAnim"; // --------------------------------------------------------------------------- +// Animation... +const float DURATION = ms2ns(200); +const float BOUNCES_PER_SECOND = 0.5f; +//const float BOUNCES_AMPLITUDE = 1.0f/16.0f; +const float BOUNCES_AMPLITUDE = 0; +const float DIM_TARGET = 0.40f; +//#define INTERPOLATED_TIME(_t) ((_t)*(_t)) +#define INTERPOLATED_TIME(_t) (_t) + +// --------------------------------------------------------------------------- + LayerOrientationAnim::LayerOrientationAnim( SurfaceFlinger* flinger, DisplayID display, OrientationAnimation* anim, - const LayerBitmap& bitmap, - const LayerBitmap& bitmapIn) - : LayerBase(flinger, display), mAnim(anim), - mBitmap(bitmap), mBitmapIn(bitmapIn), + const LayerBitmap& bitmapIn, + const LayerBitmap& bitmapOut) + : LayerOrientationAnimBase(flinger, display), mAnim(anim), + mBitmapIn(bitmapIn), mBitmapOut(bitmapOut), mTextureName(-1), mTextureNameIn(-1) { + // blur that texture. mStartTime = systemTime(); mFinishTime = 0; mOrientationCompleted = false; mFirstRedraw = false; mLastNormalizedTime = 0; - mLastScale = 0; mNeedsBlending = false; + mAlphaInLerp.set(1.0f, DIM_TARGET); + mAlphaOutLerp.set(0.5f, 1.0f); } LayerOrientationAnim::~LayerOrientationAnim() @@ -111,14 +126,8 @@ void LayerOrientationAnim::onOrientationCompleted() void LayerOrientationAnim::onDraw(const Region& clip) const { - // Animation... - const float MIN_SCALE = 0.5f; - const float DURATION = ms2ns(200); - const float BOUNCES_PER_SECOND = 1.618f; - const float BOUNCES_AMPLITUDE = 1.0f/32.0f; - const nsecs_t now = systemTime(); - float scale, alpha; + float alphaIn, alphaOut; if (mOrientationCompleted) { if (mFirstRedraw) { @@ -126,7 +135,7 @@ void LayerOrientationAnim::onDraw(const Region& clip) const // make a copy of what's on screen copybit_image_t image; - mBitmapIn.getBitmapSurface(&image); + mBitmapOut.getBitmapSurface(&image); const DisplayHardware& hw(graphicPlane(0).displayHardware()); hw.copyBackToImage(image); @@ -147,37 +156,40 @@ void LayerOrientationAnim::onDraw(const Region& clip) const const float duration = DURATION * mLastNormalizedTime; const float normalizedTime = (float(now - mFinishTime) / duration); if (normalizedTime <= 1.0f) { - const float squaredTime = normalizedTime*normalizedTime; - scale = (1.0f - mLastScale)*squaredTime + mLastScale; - alpha = (1.0f - normalizedTime); - alpha *= alpha; - alpha *= alpha; + const float interpolatedTime = INTERPOLATED_TIME(normalizedTime); + alphaIn = mAlphaInLerp.getOut(); + alphaOut = mAlphaOutLerp(interpolatedTime); } else { mAnim->onAnimationFinished(); - scale = 1.0f; - alpha = 0.0f; + alphaIn = mAlphaInLerp.getOut(); + alphaOut = mAlphaOutLerp.getOut(); } } else { const float normalizedTime = float(now - mStartTime) / DURATION; if (normalizedTime <= 1.0f) { mLastNormalizedTime = normalizedTime; - const float squaredTime = normalizedTime*normalizedTime; - scale = (MIN_SCALE-1.0f)*squaredTime + 1.0f; - alpha = 1.0f; + const float interpolatedTime = INTERPOLATED_TIME(normalizedTime); + alphaIn = mAlphaInLerp(interpolatedTime); + alphaOut = 0.0f; } else { mLastNormalizedTime = 1.0f; const float to_seconds = DURATION / seconds(1); - const float phi = BOUNCES_PER_SECOND * - (((normalizedTime - 1.0f) * to_seconds)*M_PI*2); - scale = MIN_SCALE + BOUNCES_AMPLITUDE * (1.0f - cosf(phi)); - alpha = 1.0f; + alphaIn = mAlphaInLerp.getOut(); + if (BOUNCES_AMPLITUDE > 0.0f) { + const float phi = BOUNCES_PER_SECOND * + (((normalizedTime - 1.0f) * to_seconds)*M_PI*2); + if (alphaIn > 1.0f) alphaIn = 1.0f; + else if (alphaIn < 0.0f) alphaIn = 0.0f; + alphaIn += BOUNCES_AMPLITUDE * (1.0f - cosf(phi)); + } + alphaOut = 0.0f; } - mLastScale = scale; + mAlphaOutLerp.setIn(alphaIn); } - drawScaled(scale, alpha); + drawScaled(1.0f, alphaIn, alphaOut); } -void LayerOrientationAnim::drawScaled(float f, float alpha) const +void LayerOrientationAnim::drawScaled(float scale, float alphaIn, float alphaOut) const { copybit_image_t dst; const GraphicPlane& plane(graphicPlane(0)); @@ -188,22 +200,30 @@ void LayerOrientationAnim::drawScaled(float f, float alpha) const // TODO: with update on demand, we may be able // to not erase the screen at all during the animation if (!mOrientationCompleted) { - glDisable(GL_BLEND); - glDisable(GL_DITHER); - glDisable(GL_SCISSOR_TEST); - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT); + if (scale==1.0f && (alphaIn>=1.0f || alphaOut>=1.0f)) { + // we don't need to erase the screen in that case + } else { + glDisable(GL_BLEND); + glDisable(GL_DITHER); + glDisable(GL_SCISSOR_TEST); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT); + } } - const int w = dst.w*f; - const int h = dst.h*f; + copybit_image_t src; + mBitmapIn.getBitmapSurface(&src); + + copybit_image_t srcOut; + mBitmapOut.getBitmapSurface(&srcOut); + + const int w = dst.w*scale; + const int h = dst.h*scale; const int xc = uint32_t(dst.w-w)/2; const int yc = uint32_t(dst.h-h)/2; const copybit_rect_t drect = { xc, yc, xc+w, yc+h }; - - copybit_image_t src; - mBitmap.getBitmapSurface(&src); const copybit_rect_t srect = { 0, 0, src.w, src.h }; + const Region reg(Rect( drect.l, drect.t, drect.r, drect.b )); int err = NO_ERROR; const int can_use_copybit = canUseCopybit(); @@ -211,19 +231,19 @@ void LayerOrientationAnim::drawScaled(float f, float alpha) const copybit_device_t* copybit = mFlinger->getBlitEngine(); copybit->set_parameter(copybit, COPYBIT_TRANSFORM, 0); copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_ENABLE); - - if (alpha < 1.0f) { - copybit_image_t srcIn; - mBitmapIn.getBitmapSurface(&srcIn); - region_iterator it(Region(Rect( drect.l, drect.t, drect.r, drect.b ))); - copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 0xFF); - err = copybit->stretch(copybit, &dst, &srcIn, &drect, &srect, &it); + + if (alphaIn > 0) { + region_iterator it(reg); + copybit->set_parameter(copybit, COPYBIT_BLUR, COPYBIT_ENABLE); + copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, int(alphaIn*255)); + err = copybit->stretch(copybit, &dst, &src, &drect, &srect, &it); } - if (!err && alpha > 0.0f) { - region_iterator it(Region(Rect( drect.l, drect.t, drect.r, drect.b ))); - copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, int(alpha*255)); - err = copybit->stretch(copybit, &dst, &src, &drect, &srect, &it); + if (!err && alphaOut > 0.0f) { + region_iterator it(reg); + copybit->set_parameter(copybit, COPYBIT_BLUR, COPYBIT_DISABLE); + copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, int(alphaOut*255)); + err = copybit->stretch(copybit, &dst, &srcOut, &drect, &srect, &it); } LOGE_IF(err != NO_ERROR, "copybit failed (%s)", strerror(err)); } @@ -238,7 +258,7 @@ void LayerOrientationAnim::drawScaled(float f, float alpha) const t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); Transform tr; - tr.set(f,0,0,f); + tr.set(scale,0,0,scale); tr.set(xc, yc); // FIXME: we should not access mVertices and mDrawingState like that, @@ -254,9 +274,7 @@ void LayerOrientationAnim::drawScaled(float f, float alpha) const self.mDrawingState.flags |= ISurfaceComposer::eLayerFilter; } - if (alpha < 1.0f) { - copybit_image_t src; - mBitmapIn.getBitmapSurface(&src); + if (alphaIn > 0.0f) { t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); if (UNLIKELY(mTextureNameIn == -1LU)) { mTextureNameIn = createTexture(); @@ -264,21 +282,21 @@ void LayerOrientationAnim::drawScaled(float f, float alpha) const const Region dirty(Rect(t.width, t.height)); loadTexture(dirty, mTextureNameIn, t, w, h); } - self.mDrawingState.alpha = 255; - const Region clip(Rect( drect.l, drect.t, drect.r, drect.b )); - drawWithOpenGL(clip, mTextureName, t); + self.mDrawingState.alpha = int(alphaIn*255); + drawWithOpenGL(reg, mTextureNameIn, t); } - t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); - if (UNLIKELY(mTextureName == -1LU)) { - mTextureName = createTexture(); - GLuint w=0, h=0; - const Region dirty(Rect(t.width, t.height)); - loadTexture(dirty, mTextureName, t, w, h); + if (alphaOut > 0.0f) { + t.data = (GGLubyte*)(intptr_t(srcOut.base) + srcOut.offset); + if (UNLIKELY(mTextureName == -1LU)) { + mTextureName = createTexture(); + GLuint w=0, h=0; + const Region dirty(Rect(t.width, t.height)); + loadTexture(dirty, mTextureName, t, w, h); + } + self.mDrawingState.alpha = int(alphaOut*255); + drawWithOpenGL(reg, mTextureName, t); } - self.mDrawingState.alpha = int(alpha*255); - const Region clip(Rect( drect.l, drect.t, drect.r, drect.b )); - drawWithOpenGL(clip, mTextureName, t); } } diff --git a/libs/surfaceflinger/LayerOrientationAnim.h b/libs/surfaceflinger/LayerOrientationAnim.h index 7367685..365c6ae 100644 --- a/libs/surfaceflinger/LayerOrientationAnim.h +++ b/libs/surfaceflinger/LayerOrientationAnim.h @@ -30,7 +30,19 @@ namespace android { // --------------------------------------------------------------------------- class OrientationAnimation; -class LayerOrientationAnim : public LayerBase + +class LayerOrientationAnimBase : public LayerBase +{ +public: + LayerOrientationAnimBase(SurfaceFlinger* flinger, DisplayID display) + : LayerBase(flinger, display) { + } + virtual void onOrientationCompleted() = 0; +}; + +// --------------------------------------------------------------------------- + +class LayerOrientationAnim : public LayerOrientationAnimBase { public: static const uint32_t typeInfo; @@ -40,8 +52,8 @@ public: LayerOrientationAnim(SurfaceFlinger* flinger, DisplayID display, OrientationAnimation* anim, - const LayerBitmap& zoomOut, - const LayerBitmap& zoomIn); + const LayerBitmap& bitmapIn, + const LayerBitmap& bitmapOut); virtual ~LayerOrientationAnim(); void onOrientationCompleted(); @@ -52,20 +64,45 @@ public: virtual bool needsBlending() const; virtual bool isSecure() const { return false; } private: - void drawScaled(float scale, float alpha) const; + void drawScaled(float scale, float alphaIn, float alphaOut) const; + class Lerp { + float in; + float outMinusIn; + public: + Lerp() : in(0), outMinusIn(0) { } + Lerp(float in, float out) : in(in), outMinusIn(out-in) { } + float getIn() const { return in; }; + float getOut() const { return in + outMinusIn; } + void set(float in, float out) { + this->in = in; + this->outMinusIn = out-in; + } + void setIn(float in) { + this->in = in; + } + void setOut(float out) { + this->outMinusIn = out - this->in; + } + float operator()(float t) const { + return outMinusIn*t + in; + } + }; + OrientationAnimation* mAnim; - LayerBitmap mBitmap; LayerBitmap mBitmapIn; + LayerBitmap mBitmapOut; nsecs_t mStartTime; nsecs_t mFinishTime; bool mOrientationCompleted; mutable bool mFirstRedraw; mutable float mLastNormalizedTime; - mutable float mLastScale; mutable GLuint mTextureName; mutable GLuint mTextureNameIn; mutable bool mNeedsBlending; + + mutable Lerp mAlphaInLerp; + mutable Lerp mAlphaOutLerp; }; // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/LayerOrientationAnimRotate.cpp b/libs/surfaceflinger/LayerOrientationAnimRotate.cpp new file mode 100644 index 0000000..12d5d80 --- /dev/null +++ b/libs/surfaceflinger/LayerOrientationAnimRotate.cpp @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "SurfaceFlinger" + +#include +#include +#include + +#include +#include + +#include + +#include + +#include "LayerBase.h" +#include "LayerOrientationAnim.h" +#include "LayerOrientationAnimRotate.h" +#include "SurfaceFlinger.h" +#include "DisplayHardware/DisplayHardware.h" +#include "OrientationAnimation.h" + +namespace android { +// --------------------------------------------------------------------------- + +const uint32_t LayerOrientationAnimRotate::typeInfo = LayerBase::typeInfo | 0x100; +const char* const LayerOrientationAnimRotate::typeID = "LayerOrientationAnimRotate"; + +// --------------------------------------------------------------------------- + +const float ROTATION = M_PI * 0.5f; +const float ROTATION_FACTOR = 1.0f; // 1.0 or 2.0 +const float DURATION = ms2ns(200); +const float BOUNCES_PER_SECOND = 0.8; +const float BOUNCES_AMPLITUDE = (5.0f/180.f) * M_PI; + +LayerOrientationAnimRotate::LayerOrientationAnimRotate( + SurfaceFlinger* flinger, DisplayID display, + OrientationAnimation* anim, + const LayerBitmap& bitmap, + const LayerBitmap& bitmapIn) + : LayerOrientationAnimBase(flinger, display), mAnim(anim), + mBitmap(bitmap), mBitmapIn(bitmapIn), + mTextureName(-1), mTextureNameIn(-1) +{ + mStartTime = systemTime(); + mFinishTime = 0; + mOrientationCompleted = false; + mFirstRedraw = false; + mLastNormalizedTime = 0; + mLastAngle = 0; + mLastScale = 0; + mNeedsBlending = false; +} + +LayerOrientationAnimRotate::~LayerOrientationAnimRotate() +{ + if (mTextureName != -1U) { + LayerBase::deletedTextures.add(mTextureName); + } + if (mTextureNameIn != -1U) { + LayerBase::deletedTextures.add(mTextureNameIn); + } +} + +bool LayerOrientationAnimRotate::needsBlending() const +{ + return mNeedsBlending; +} + +Point LayerOrientationAnimRotate::getPhysicalSize() const +{ + const GraphicPlane& plane(graphicPlane(0)); + const DisplayHardware& hw(plane.displayHardware()); + return Point(hw.getWidth(), hw.getHeight()); +} + +void LayerOrientationAnimRotate::validateVisibility(const Transform&) +{ + const Layer::State& s(drawingState()); + const Transform tr(s.transform); + const Point size(getPhysicalSize()); + uint32_t w = size.x; + uint32_t h = size.y; + mTransformedBounds = tr.makeBounds(w, h); + mLeft = tr.tx(); + mTop = tr.ty(); + transparentRegionScreen.clear(); + mTransformed = true; + mCanUseCopyBit = false; +} + +void LayerOrientationAnimRotate::onOrientationCompleted() +{ + mFinishTime = systemTime(); + mOrientationCompleted = true; + mFirstRedraw = true; + mNeedsBlending = true; + mFlinger->invalidateLayerVisibility(this); +} + +void LayerOrientationAnimRotate::onDraw(const Region& clip) const +{ + // Animation... + + // FIXME: works only for portrait framebuffers + const Point size(getPhysicalSize()); + const float TARGET_SCALE = size.x * (1.0f / size.y); + + const nsecs_t now = systemTime(); + float angle, scale, alpha; + + if (mOrientationCompleted) { + if (mFirstRedraw) { + // make a copy of what's on screen + copybit_image_t image; + mBitmapIn.getBitmapSurface(&image); + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + hw.copyBackToImage(image); + + // FIXME: code below is gross + mFirstRedraw = false; + mNeedsBlending = false; + LayerOrientationAnimRotate* self(const_cast(this)); + mFlinger->invalidateLayerVisibility(self); + } + + // make sure pick-up where we left off + const float duration = DURATION * mLastNormalizedTime; + const float normalizedTime = (float(now - mFinishTime) / duration); + if (normalizedTime <= 1.0f) { + const float squaredTime = normalizedTime*normalizedTime; + angle = (ROTATION*ROTATION_FACTOR - mLastAngle)*squaredTime + mLastAngle; + scale = (1.0f - mLastScale)*squaredTime + mLastScale; + alpha = normalizedTime; + } else { + mAnim->onAnimationFinished(); + angle = ROTATION; + alpha = 1.0f; + scale = 1.0f; + } + } else { + const float normalizedTime = float(now - mStartTime) / DURATION; + if (normalizedTime <= 1.0f) { + mLastNormalizedTime = normalizedTime; + const float squaredTime = normalizedTime*normalizedTime; + angle = ROTATION * squaredTime; + scale = (TARGET_SCALE - 1.0f)*squaredTime + 1.0f; + alpha = 0; + } else { + mLastNormalizedTime = 1.0f; + angle = ROTATION; + if (BOUNCES_AMPLITUDE) { + const float to_seconds = DURATION / seconds(1); + const float phi = BOUNCES_PER_SECOND * + (((normalizedTime - 1.0f) * to_seconds)*M_PI*2); + angle += BOUNCES_AMPLITUDE * sinf(phi); + } + scale = TARGET_SCALE; + alpha = 0; + } + mLastAngle = angle; + mLastScale = scale; + } + drawScaled(angle, scale, alpha); +} + +void LayerOrientationAnimRotate::drawScaled(float f, float s, float alpha) const +{ + copybit_image_t dst; + const GraphicPlane& plane(graphicPlane(0)); + const DisplayHardware& hw(plane.displayHardware()); + hw.getDisplaySurface(&dst); + + // clear screen + // TODO: with update on demand, we may be able + // to not erase the screen at all during the animation + glDisable(GL_BLEND); + glDisable(GL_DITHER); + glDisable(GL_SCISSOR_TEST); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT); + + const int w = dst.w; + const int h = dst.h; + + copybit_image_t src; + mBitmap.getBitmapSurface(&src); + const copybit_rect_t srect = { 0, 0, src.w, src.h }; + + + GGLSurface t; + t.version = sizeof(GGLSurface); + t.width = src.w; + t.height = src.h; + t.stride = src.w; + t.vstride= src.h; + t.format = src.format; + t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); + + const int targetOrientation = plane.getOrientation(); + if (!targetOrientation) { + f = -f; + } + + Transform tr; + tr.set(f, w*0.5f, h*0.5f); + tr.scale(s, w*0.5f, h*0.5f); + + // FIXME: we should not access mVertices and mDrawingState like that, + // but since we control the animation, we know it's going to work okay. + // eventually we'd need a more formal way of doing things like this. + LayerOrientationAnimRotate& self(const_cast(*this)); + tr.transform(self.mVertices[0], 0, 0); + tr.transform(self.mVertices[1], 0, src.h); + tr.transform(self.mVertices[2], src.w, src.h); + tr.transform(self.mVertices[3], src.w, 0); + + if (!(mFlags & DisplayHardware::SLOW_CONFIG)) { + // Too slow to do this in software + self.mDrawingState.flags |= ISurfaceComposer::eLayerFilter; + } + + if (UNLIKELY(mTextureName == -1LU)) { + mTextureName = createTexture(); + GLuint w=0, h=0; + const Region dirty(Rect(t.width, t.height)); + loadTexture(dirty, mTextureName, t, w, h); + } + self.mDrawingState.alpha = 255; //-int(alpha*255); + const Region clip(Rect( srect.l, srect.t, srect.r, srect.b )); + drawWithOpenGL(clip, mTextureName, t); + + if (alpha > 0) { + const float sign = (!targetOrientation) ? 1.0f : -1.0f; + tr.set(f + sign*(M_PI * 0.5f * ROTATION_FACTOR), w*0.5f, h*0.5f); + tr.scale(s, w*0.5f, h*0.5f); + tr.transform(self.mVertices[0], 0, 0); + tr.transform(self.mVertices[1], 0, src.h); + tr.transform(self.mVertices[2], src.w, src.h); + tr.transform(self.mVertices[3], src.w, 0); + + copybit_image_t src; + mBitmapIn.getBitmapSurface(&src); + t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); + if (UNLIKELY(mTextureNameIn == -1LU)) { + mTextureNameIn = createTexture(); + GLuint w=0, h=0; + const Region dirty(Rect(t.width, t.height)); + loadTexture(dirty, mTextureNameIn, t, w, h); + } + self.mDrawingState.alpha = int(alpha*255); + const Region clip(Rect( srect.l, srect.t, srect.r, srect.b )); + drawWithOpenGL(clip, mTextureNameIn, t); + } +} + +// --------------------------------------------------------------------------- + +}; // namespace android diff --git a/libs/surfaceflinger/LayerOrientationAnimRotate.h b/libs/surfaceflinger/LayerOrientationAnimRotate.h new file mode 100644 index 0000000..5ca5780 --- /dev/null +++ b/libs/surfaceflinger/LayerOrientationAnimRotate.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_LAYER_ORIENTATION_ANIM_ROTATE_H +#define ANDROID_LAYER_ORIENTATION_ANIM_ROTATE_H + +#include +#include +#include +#include + +#include "LayerBase.h" +#include "LayerBitmap.h" + +namespace android { + +// --------------------------------------------------------------------------- +class OrientationAnimation; + +class LayerOrientationAnimRotate : public LayerOrientationAnimBase +{ +public: + static const uint32_t typeInfo; + static const char* const typeID; + virtual char const* getTypeID() const { return typeID; } + virtual uint32_t getTypeInfo() const { return typeInfo; } + + LayerOrientationAnimRotate(SurfaceFlinger* flinger, DisplayID display, + OrientationAnimation* anim, + const LayerBitmap& zoomOut, + const LayerBitmap& zoomIn); + virtual ~LayerOrientationAnimRotate(); + + void onOrientationCompleted(); + + virtual void onDraw(const Region& clip) const; + virtual Point getPhysicalSize() const; + virtual void validateVisibility(const Transform& globalTransform); + virtual bool needsBlending() const; + virtual bool isSecure() const { return false; } +private: + void drawScaled(float angle, float scale, float alpha) const; + + OrientationAnimation* mAnim; + LayerBitmap mBitmap; + LayerBitmap mBitmapIn; + nsecs_t mStartTime; + nsecs_t mFinishTime; + bool mOrientationCompleted; + mutable bool mFirstRedraw; + mutable float mLastNormalizedTime; + mutable float mLastAngle; + mutable float mLastScale; + mutable GLuint mTextureName; + mutable GLuint mTextureNameIn; + mutable bool mNeedsBlending; +}; + +// --------------------------------------------------------------------------- + +}; // namespace android + +#endif // ANDROID_LAYER_ORIENTATION_ANIM_ROTATE_H diff --git a/libs/surfaceflinger/OrientationAnimation.cpp b/libs/surfaceflinger/OrientationAnimation.cpp index f6f1326..e59688e 100644 --- a/libs/surfaceflinger/OrientationAnimation.cpp +++ b/libs/surfaceflinger/OrientationAnimation.cpp @@ -21,6 +21,7 @@ #include #include "LayerOrientationAnim.h" +#include "LayerOrientationAnimRotate.h" #include "OrientationAnimation.h" #include "SurfaceFlinger.h" #include "VRamHeap.h" @@ -112,8 +113,14 @@ bool OrientationAnimation::prepare() bitmap.getBitmapSurface(&front); hw.copyFrontToImage(front); - LayerOrientationAnim* l = new LayerOrientationAnim( + LayerOrientationAnimBase* l; + + l = new LayerOrientationAnim( mFlinger.get(), 0, this, bitmap, bitmapIn); + + //l = new LayerOrientationAnimRotate( + // mFlinger.get(), 0, this, bitmap, bitmapIn); + l->initStates(w, h, 0); l->setLayer(INT_MAX-1); mFlinger->addLayer(l); diff --git a/libs/surfaceflinger/OrientationAnimation.h b/libs/surfaceflinger/OrientationAnimation.h index ba33fce..b170dcb 100644 --- a/libs/surfaceflinger/OrientationAnimation.h +++ b/libs/surfaceflinger/OrientationAnimation.h @@ -62,7 +62,7 @@ private: sp mFlinger; sp mTemporaryDealer; - LayerOrientationAnim* mLayerOrientationAnim; + LayerOrientationAnimBase* mLayerOrientationAnim; int mState; }; diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index d915a84..8499b67 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -1804,6 +1804,7 @@ status_t GraphicPlane::setOrientation(int orientation) if (orientation == ISurfaceComposer::eOrientationDefault) { // make sure the default orientation is optimal mOrientationTransform.reset(); + mOrientation = orientation; mGlobalTransform = mTransform; return NO_ERROR; } @@ -1824,7 +1825,7 @@ status_t GraphicPlane::setOrientation(int orientation) GraphicPlane::orientationToTransfrom(orientation, w, h, &mOrientationTransform); } - + mOrientation = orientation; mGlobalTransform = mOrientationTransform * mTransform; return NO_ERROR; } diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h index f7d7764..3c10481 100644 --- a/libs/surfaceflinger/SurfaceFlinger.h +++ b/libs/surfaceflinger/SurfaceFlinger.h @@ -122,6 +122,7 @@ public: void setDisplayHardware(DisplayHardware *); void setTransform(const Transform& tr); status_t setOrientation(int orientation); + int getOrientation() const { return mOrientation; } const DisplayHardware& displayHardware() const; const Transform& transform() const; @@ -133,6 +134,7 @@ private: Transform mTransform; Transform mOrientationTransform; Transform mGlobalTransform; + int mOrientation; }; // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/Transform.cpp b/libs/surfaceflinger/Transform.cpp index bec7a64..e8b0f45 100644 --- a/libs/surfaceflinger/Transform.cpp +++ b/libs/surfaceflinger/Transform.cpp @@ -103,6 +103,25 @@ void Transform::set( float xx, float xy, mType |= 0x80000000; } +void Transform::set(float radian, float x, float y) +{ + float r00 = cosf(radian); float r01 = -sinf(radian); + float r10 = sinf(radian); float r11 = cosf(radian); + mTransform.set(SkMatrix::kMScaleX, SkFloatToScalar(r00)); + mTransform.set(SkMatrix::kMSkewX, SkFloatToScalar(r01)); + mTransform.set(SkMatrix::kMSkewY, SkFloatToScalar(r10)); + mTransform.set(SkMatrix::kMScaleY, SkFloatToScalar(r11)); + mTransform.set(SkMatrix::kMTransX, SkIntToScalar(x - r00*x - r01*y)); + mTransform.set(SkMatrix::kMTransY, SkIntToScalar(y - r10*x - r11*y)); + mType |= 0x80000000 | SkMatrix::kTranslate_Mask; +} + +void Transform::scale(float s, float x, float y) +{ + mTransform.postScale(s, s, x, y); + mType |= 0x80000000; +} + void Transform::set(int tx, int ty) { if (tx | ty) { diff --git a/libs/surfaceflinger/Transform.h b/libs/surfaceflinger/Transform.h index 0b4835e..4c4528e 100644 --- a/libs/surfaceflinger/Transform.h +++ b/libs/surfaceflinger/Transform.h @@ -60,7 +60,9 @@ public: void reset(); void set(float xx, float xy, float yx, float yy); void set(int tx, int ty); - + void set(float radian, float x, float y); + void scale(float s, float x, float y); + Rect makeBounds(int w, int h) const; void transform(GLfixed* point, int x, int y) const; Region transform(const Region& reg) const; -- cgit v1.1 From 24fd77d44088011c88c55a5de459e75792bb2ecb Mon Sep 17 00:00:00 2001 From: Mathias Agopian <> Date: Fri, 27 Mar 2009 16:10:37 -0700 Subject: AI 143171: am: CL 142873 fix [1732012] Only show screen rotation animation when triggered by sensor Original author: mathias Merged from: //branches/cupcake/... Automated import of CL 143171 --- include/ui/ISurfaceComposer.h | 7 ++++++- include/ui/SurfaceComposerClient.h | 2 +- libs/surfaceflinger/OrientationAnimation.cpp | 31 ++++++++++++++-------------- libs/surfaceflinger/OrientationAnimation.h | 18 +++++++++++++--- libs/surfaceflinger/SurfaceFlinger.cpp | 9 +++++--- libs/surfaceflinger/SurfaceFlinger.h | 3 ++- libs/ui/ISurfaceComposer.cpp | 6 ++++-- libs/ui/SurfaceComposerClient.cpp | 5 +++-- 8 files changed, 52 insertions(+), 29 deletions(-) diff --git a/include/ui/ISurfaceComposer.h b/include/ui/ISurfaceComposer.h index f9eeb30..5c64b22 100644 --- a/include/ui/ISurfaceComposer.h +++ b/include/ui/ISurfaceComposer.h @@ -81,6 +81,11 @@ public: eOrientation270 = 3, eOrientationSwapMask = 0x01 }; + + // flags for setOrientation + enum { + eOrientationAnimationDisable = 0x00000001 + }; /* create connection with surface flinger, requires * ACCESS_SURFACE_FLINGER permission @@ -100,7 +105,7 @@ public: virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0; /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */ - virtual int setOrientation(DisplayID dpy, int orientation) = 0; + virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0; /* signal that we're done booting. * recquires ACCESS_SURFACE_FLINGER permission diff --git a/include/ui/SurfaceComposerClient.h b/include/ui/SurfaceComposerClient.h index 5d9222d..76a3b55 100644 --- a/include/ui/SurfaceComposerClient.h +++ b/include/ui/SurfaceComposerClient.h @@ -97,7 +97,7 @@ public: static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0); //! Set the orientation of the given display - static int setOrientation(DisplayID dpy, int orientation); + static int setOrientation(DisplayID dpy, int orientation, uint32_t flags); // Query the number of displays static ssize_t getNumberOfDisplays(); diff --git a/libs/surfaceflinger/OrientationAnimation.cpp b/libs/surfaceflinger/OrientationAnimation.cpp index e59688e..70eec8d 100644 --- a/libs/surfaceflinger/OrientationAnimation.cpp +++ b/libs/surfaceflinger/OrientationAnimation.cpp @@ -44,10 +44,14 @@ OrientationAnimation::~OrientationAnimation() { } -void OrientationAnimation::onOrientationChanged() +void OrientationAnimation::onOrientationChanged(uint32_t type) { - if (mState == DONE) - mState = PREPARE; + if (mState == DONE) { + mType = type; + if (!(type & ISurfaceComposer::eOrientationAnimationDisable)) { + mState = PREPARE; + } + } } void OrientationAnimation::onAnimationFinished() @@ -82,14 +86,7 @@ bool OrientationAnimation::run_impl() bool OrientationAnimation::done() { - if (mFlinger->isFrozen()) { - // we are not allowed to draw, but pause a bit to make sure - // apps don't end up using the whole CPU, if they depend on - // surfaceflinger for synchronization. - usleep(8333); // 8.3ms ~ 120fps - return true; - } - return false; + return done_impl(); } bool OrientationAnimation::prepare() @@ -115,11 +112,13 @@ bool OrientationAnimation::prepare() LayerOrientationAnimBase* l; - l = new LayerOrientationAnim( - mFlinger.get(), 0, this, bitmap, bitmapIn); - - //l = new LayerOrientationAnimRotate( - // mFlinger.get(), 0, this, bitmap, bitmapIn); + if (mType & 0x80) { + l = new LayerOrientationAnimRotate( + mFlinger.get(), 0, this, bitmap, bitmapIn); + } else { + l = new LayerOrientationAnim( + mFlinger.get(), 0, this, bitmap, bitmapIn); + } l->initStates(w, h, 0); l->setLayer(INT_MAX-1); diff --git a/libs/surfaceflinger/OrientationAnimation.h b/libs/surfaceflinger/OrientationAnimation.h index b170dcb..cafa38d 100644 --- a/libs/surfaceflinger/OrientationAnimation.h +++ b/libs/surfaceflinger/OrientationAnimation.h @@ -36,11 +36,11 @@ public: OrientationAnimation(const sp& flinger); virtual ~OrientationAnimation(); - void onOrientationChanged(); + void onOrientationChanged(uint32_t type); void onAnimationFinished(); inline bool run() { if (LIKELY(mState == DONE)) - return false; + return done_impl(); return run_impl(); } @@ -54,7 +54,18 @@ private: }; bool run_impl(); - bool done(); + inline bool done_impl() { + if (mFlinger->isFrozen()) { + // we are not allowed to draw, but pause a bit to make sure + // apps don't end up using the whole CPU, if they depend on + // surfaceflinger for synchronization. + usleep(8333); // 8.3ms ~ 120fps + return true; + } + return false; + } + + bool done(); bool prepare(); bool phase1(); bool phase2(); @@ -64,6 +75,7 @@ private: sp mTemporaryDealer; LayerOrientationAnimBase* mLayerOrientationAnim; int mState; + uint32_t mType; }; // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index 8499b67..de64f55 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -655,6 +655,7 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags) const int dpy = 0; const int orientation = mCurrentState.orientation; + const uint32_t type = mCurrentState.orientationType; GraphicPlane& plane(graphicPlane(dpy)); plane.setOrientation(orientation); @@ -673,8 +674,8 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags) mVisibleRegionsDirty = true; mDirtyRegion.set(hw.bounds()); - - mOrientationAnimation->onOrientationChanged(); + mFreezeDisplayTime = 0; + mOrientationAnimation->onOrientationChanged(type); } if (mCurrentState.freezeDisplay != mDrawingState.freezeDisplay) { @@ -1201,7 +1202,8 @@ status_t SurfaceFlinger::unfreezeDisplay(DisplayID dpy, uint32_t flags) return NO_ERROR; } -int SurfaceFlinger::setOrientation(DisplayID dpy, int orientation) +int SurfaceFlinger::setOrientation(DisplayID dpy, + int orientation, uint32_t flags) { if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) return BAD_VALUE; @@ -1209,6 +1211,7 @@ int SurfaceFlinger::setOrientation(DisplayID dpy, int orientation) Mutex::Autolock _l(mStateLock); if (mCurrentState.orientation != orientation) { if (uint32_t(orientation)<=eOrientation270 || orientation==42) { + mCurrentState.orientationType = flags; mCurrentState.orientation = orientation; setTransactionFlags(eTransactionNeeded); mTransactionCV.wait(mStateLock); diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h index 3c10481..e023182 100644 --- a/libs/surfaceflinger/SurfaceFlinger.h +++ b/libs/surfaceflinger/SurfaceFlinger.h @@ -167,7 +167,7 @@ public: virtual void closeGlobalTransaction(); virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags); virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags); - virtual int setOrientation(DisplayID dpy, int orientation); + virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags); virtual void signal() const; virtual status_t requestGPU(const sp& callback, gpu_info_t* gpu); @@ -244,6 +244,7 @@ private: } LayerVector layersSortedByZ; uint8_t orientation; + uint8_t orientationType; uint8_t freezeDisplay; }; diff --git a/libs/ui/ISurfaceComposer.cpp b/libs/ui/ISurfaceComposer.cpp index 0fea6f9..76597e1 100644 --- a/libs/ui/ISurfaceComposer.cpp +++ b/libs/ui/ISurfaceComposer.cpp @@ -96,12 +96,13 @@ public: return reply.readInt32(); } - virtual int setOrientation(DisplayID dpy, int orientation) + virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); data.writeInt32(dpy); data.writeInt32(orientation); + data.writeInt32(flags); remote()->transact(BnSurfaceComposer::SET_ORIENTATION, data, &reply); return reply.readInt32(); } @@ -184,7 +185,8 @@ status_t BnSurfaceComposer::onTransact( case SET_ORIENTATION: { DisplayID dpy = data.readInt32(); int orientation = data.readInt32(); - reply->writeInt32( setOrientation(dpy, orientation) ); + uint32_t flags = data.readInt32(); + reply->writeInt32( setOrientation(dpy, orientation, flags) ); } break; case FREEZE_DISPLAY: { DisplayID dpy = data.readInt32(); diff --git a/libs/ui/SurfaceComposerClient.cpp b/libs/ui/SurfaceComposerClient.cpp index 9354a7a..fe803ff 100644 --- a/libs/ui/SurfaceComposerClient.cpp +++ b/libs/ui/SurfaceComposerClient.cpp @@ -813,10 +813,11 @@ status_t SurfaceComposerClient::unfreezeDisplay(DisplayID dpy, uint32_t flags) return sm->unfreezeDisplay(dpy, flags); } -int SurfaceComposerClient::setOrientation(DisplayID dpy, int orientation) +int SurfaceComposerClient::setOrientation(DisplayID dpy, + int orientation, uint32_t flags) { const sp& sm(_get_surface_manager()); - return sm->setOrientation(dpy, orientation); + return sm->setOrientation(dpy, orientation, flags); } status_t SurfaceComposerClient::openTransaction() -- cgit v1.1 From 816c5e2314c8dc241c962efaed6a57c0e20f7330 Mon Sep 17 00:00:00 2001 From: Mathias Agopian <> Date: Fri, 27 Mar 2009 16:13:24 -0700 Subject: AI 143172: am: CL 142875 [1732012] for some reason these files didn't go through in the preview check-in. Original author: mathias Merged from: //branches/cupcake/... Automated import of CL 143172 --- libs/surfaceflinger/LayerOrientationAnimRotate.cpp | 14 +++++++------- libs/surfaceflinger/LayerOrientationAnimRotate.h | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/surfaceflinger/LayerOrientationAnimRotate.cpp b/libs/surfaceflinger/LayerOrientationAnimRotate.cpp index 12d5d80..89ffb19 100644 --- a/libs/surfaceflinger/LayerOrientationAnimRotate.cpp +++ b/libs/surfaceflinger/LayerOrientationAnimRotate.cpp @@ -65,6 +65,8 @@ LayerOrientationAnimRotate::LayerOrientationAnimRotate( mLastAngle = 0; mLastScale = 0; mNeedsBlending = false; + const GraphicPlane& plane(graphicPlane(0)); + mOriginalTargetOrientation = plane.getOrientation(); } LayerOrientationAnimRotate::~LayerOrientationAnimRotate() @@ -117,10 +119,6 @@ void LayerOrientationAnimRotate::onDraw(const Region& clip) const { // Animation... - // FIXME: works only for portrait framebuffers - const Point size(getPhysicalSize()); - const float TARGET_SCALE = size.x * (1.0f / size.y); - const nsecs_t now = systemTime(); float angle, scale, alpha; @@ -154,6 +152,9 @@ void LayerOrientationAnimRotate::onDraw(const Region& clip) const scale = 1.0f; } } else { + // FIXME: works only for portrait framebuffers + const Point size(getPhysicalSize()); + const float TARGET_SCALE = size.x * (1.0f / size.y); const float normalizedTime = float(now - mStartTime) / DURATION; if (normalizedTime <= 1.0f) { mLastNormalizedTime = normalizedTime; @@ -212,8 +213,7 @@ void LayerOrientationAnimRotate::drawScaled(float f, float s, float alpha) const t.format = src.format; t.data = (GGLubyte*)(intptr_t(src.base) + src.offset); - const int targetOrientation = plane.getOrientation(); - if (!targetOrientation) { + if (!mOriginalTargetOrientation) { f = -f; } @@ -246,7 +246,7 @@ void LayerOrientationAnimRotate::drawScaled(float f, float s, float alpha) const drawWithOpenGL(clip, mTextureName, t); if (alpha > 0) { - const float sign = (!targetOrientation) ? 1.0f : -1.0f; + const float sign = (!mOriginalTargetOrientation) ? 1.0f : -1.0f; tr.set(f + sign*(M_PI * 0.5f * ROTATION_FACTOR), w*0.5f, h*0.5f); tr.scale(s, w*0.5f, h*0.5f); tr.transform(self.mVertices[0], 0, 0); diff --git a/libs/surfaceflinger/LayerOrientationAnimRotate.h b/libs/surfaceflinger/LayerOrientationAnimRotate.h index 5ca5780..5fbbd42 100644 --- a/libs/surfaceflinger/LayerOrientationAnimRotate.h +++ b/libs/surfaceflinger/LayerOrientationAnimRotate.h @@ -60,6 +60,7 @@ private: nsecs_t mStartTime; nsecs_t mFinishTime; bool mOrientationCompleted; + int mOriginalTargetOrientation; mutable bool mFirstRedraw; mutable float mLastNormalizedTime; mutable float mLastAngle; -- cgit v1.1 From cbcb00eb7302a166411c0b87e6a9ed70298f65b2 Mon Sep 17 00:00:00 2001 From: Eric Laurent <> Date: Fri, 27 Mar 2009 16:27:16 -0700 Subject: AI 143177: am: CL 142889 Fix issue #1736153 Camera shutter sound can be muted by new AlarmClock setting. Current implementation of Camera service plays the camera shutter sound over the ALARM stream so that it cannot be muted by silent mode in order to comply to some country specific requirement. A recent change made it possible for the user to mute the ALARM stream thus making this stream not suitable any more for the camera shutter sound. The fix consists in creating a new stream type only accessible by native code and that cannot be muted and use it to play camera sounds. Original author: elaurent Merged from: //branches/cupcake/... Automated import of CL 143177 --- camera/libcameraservice/CameraService.cpp | 10 +++++++++- libs/audioflinger/AudioFlinger.cpp | 9 ++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 7e5fdbe..cb8ab58 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -32,6 +32,8 @@ #include #include "CameraService.h" +#include + namespace android { extern "C" { @@ -157,7 +159,13 @@ static sp newMediaPlayer(const char *file) { sp mp = new MediaPlayer(); if (mp->setDataSource(file) == NO_ERROR) { - mp->setAudioStreamType(AudioSystem::ALARM); + char value[PROPERTY_VALUE_MAX]; + property_get("ro.camera.sound.forced", value, "0"); + if (atoi(value)) { + mp->setAudioStreamType(AudioSystem::ENFORCED_AUDIBLE); + } else { + mp->setAudioStreamType(AudioSystem::SYSTEM); + } mp->prepare(); } else { mp.clear(); diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index 9ba7f90..b9ecdd8 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -243,7 +243,8 @@ bool AudioFlinger::streamForcedToSpeaker(int streamType) // AudioSystem::routedToA2dpOutput(streamType) == false return (streamType == AudioSystem::RING || streamType == AudioSystem::ALARM || - streamType == AudioSystem::NOTIFICATION); + streamType == AudioSystem::NOTIFICATION || + streamType == AudioSystem::ENFORCED_AUDIBLE); } status_t AudioFlinger::dumpClients(int fd, const Vector& args) @@ -645,7 +646,8 @@ status_t AudioFlinger::setStreamVolume(int stream, float value) return PERMISSION_DENIED; } - if (uint32_t(stream) >= AudioSystem::NUM_STREAM_TYPES) { + if (uint32_t(stream) >= AudioSystem::NUM_STREAM_TYPES || + uint32_t(stream) == AudioSystem::ENFORCED_AUDIBLE) { return BAD_VALUE; } @@ -680,7 +682,8 @@ status_t AudioFlinger::setStreamMute(int stream, bool muted) return PERMISSION_DENIED; } - if (uint32_t(stream) >= AudioSystem::NUM_STREAM_TYPES) { + if (uint32_t(stream) >= AudioSystem::NUM_STREAM_TYPES || + uint32_t(stream) == AudioSystem::ENFORCED_AUDIBLE) { return BAD_VALUE; } -- cgit v1.1 From 34c594bde98a3fa8491b22deaed0493f5183c738 Mon Sep 17 00:00:00 2001 From: Eric Laurent <> Date: Tue, 31 Mar 2009 14:33:34 -0700 Subject: AI 143775: am: CL 143620 Attempt for fixing crash in AudioFlinger::MixerThread::dumpTracks() seen in bug report for issue 1747119. AudioFlinger::MixerThread::dumpTracks() was reading mTracks[] vector instead of mActiveTracks[] when dumping active tracks. Original author: elaurent Merged from: //branches/cupcake/... Automated import of CL 143775 --- libs/audioflinger/AudioFlinger.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index b9ecdd8..d11e13a 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -941,13 +941,10 @@ status_t AudioFlinger::MixerThread::dumpTracks(int fd, const Vector& a result.append(buffer); result.append(" Name Clien Typ Fmt Chn Buf S M F SRate LeftV RighV Serv User\n"); for (size_t i = 0; i < mTracks.size(); ++i) { - wp wTrack = mTracks[i]; - if (wTrack != 0) { - sp track = wTrack.promote(); - if (track != 0) { - track->dump(buffer, SIZE); - result.append(buffer); - } + sp track = mTracks[i]; + if (track != 0) { + track->dump(buffer, SIZE); + result.append(buffer); } } @@ -955,7 +952,7 @@ status_t AudioFlinger::MixerThread::dumpTracks(int fd, const Vector& a result.append(buffer); result.append(" Name Clien Typ Fmt Chn Buf S M F SRate LeftV RighV Serv User\n"); for (size_t i = 0; i < mActiveTracks.size(); ++i) { - wp wTrack = mTracks[i]; + wp wTrack = mActiveTracks[i]; if (wTrack != 0) { sp track = wTrack.promote(); if (track != 0) { -- cgit v1.1 From 819aa237a578c365481f44a380d8301926fca10c Mon Sep 17 00:00:00 2001 From: Nick Pelly <> Date: Thu, 2 Apr 2009 01:21:13 -0700 Subject: AI 144151: am: CL 144150 Fix heap corruption. Take mutex in close(), and skip write path after turning bluetooth off. Original author: npelly Merged from: //branches/cupcake/... Automated import of CL 144151 --- libs/audioflinger/A2dpAudioInterface.cpp | 50 +++++++++++++++++++++++++------- libs/audioflinger/A2dpAudioInterface.h | 5 +++- 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/libs/audioflinger/A2dpAudioInterface.cpp index 2974e32..b6d5078 100644 --- a/libs/audioflinger/A2dpAudioInterface.cpp +++ b/libs/audioflinger/A2dpAudioInterface.cpp @@ -92,16 +92,15 @@ status_t A2dpAudioInterface::getMicMute(bool* state) status_t A2dpAudioInterface::setParameter(const char *key, const char *value) { LOGD("setParameter %s,%s\n", key, value); - + if (!key || !value) return -EINVAL; - - if (strcmp(key, "a2dp_sink_address") == 0) { + + if (strcmp(key, "a2dp_sink_address") == 0) { return mOutput->setAddress(value); } - if (strcmp(key, "bluetooth_enabled") == 0 && - strcmp(value, "false") == 0) { - return mOutput->close(); + if (strcmp(key, "bluetooth_enabled") == 0) { + mOutput->setBluetoothEnabled(strcmp(value, "true") == 0); } return 0; @@ -130,7 +129,10 @@ status_t A2dpAudioInterface::dump(int fd, const Vector& args) // ---------------------------------------------------------------------------- A2dpAudioInterface::A2dpAudioStreamOut::A2dpAudioStreamOut() : - mFd(-1), mStandby(true), mStartCount(0), mRetryCount(0), mData(NULL) + mFd(-1), mStandby(true), mStartCount(0), mRetryCount(0), mData(NULL), + // assume BT enabled to start, this is safe because its only the + // enabled->disabled transition we are worried about + mBluetoothEnabled(true) { // use any address by default strcpy(mA2dpAddress, "00:00:00:00:00:00"); @@ -162,14 +164,21 @@ A2dpAudioInterface::A2dpAudioStreamOut::~A2dpAudioStreamOut() } ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t bytes) -{ +{ Mutex::Autolock lock(mLock); size_t remaining = bytes; - status_t status = init(); + status_t status = -1; + + if (!mBluetoothEnabled) { + LOGW("A2dpAudioStreamOut::write(), but bluetooth disabled"); + goto Error; + } + + status = init(); if (status < 0) goto Error; - + while (remaining > 0) { status = a2dp_write(mData, buffer, remaining); if (status <= 0) { @@ -181,7 +190,7 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t } mStandby = false; - + return bytes; Error: @@ -235,8 +244,27 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setAddress(const char* address) return NO_ERROR; } +status_t A2dpAudioInterface::A2dpAudioStreamOut::setBluetoothEnabled(bool enabled) +{ + LOGD("setBluetoothEnabled %d", enabled); + + Mutex::Autolock lock(mLock); + + mBluetoothEnabled = enabled; + if (!enabled) { + return close_l(); + } + return NO_ERROR; +} + status_t A2dpAudioInterface::A2dpAudioStreamOut::close() { + Mutex::Autolock lock(mLock); + return close_l(); +} + +status_t A2dpAudioInterface::A2dpAudioStreamOut::close_l() +{ if (mData) { a2dp_cleanup(mData); mData = NULL; diff --git a/libs/audioflinger/A2dpAudioInterface.h b/libs/audioflinger/A2dpAudioInterface.h index 99614dc..7901a8c 100644 --- a/libs/audioflinger/A2dpAudioInterface.h +++ b/libs/audioflinger/A2dpAudioInterface.h @@ -88,7 +88,9 @@ private: friend class A2dpAudioInterface; status_t init(); status_t close(); - status_t setAddress(const char* address); + status_t close_l(); + status_t setAddress(const char* address); + status_t setBluetoothEnabled(bool enabled); private: int mFd; @@ -98,6 +100,7 @@ private: char mA2dpAddress[20]; void* mData; Mutex mLock; + bool mBluetoothEnabled; }; A2dpAudioStreamOut* mOutput; -- cgit v1.1 From c8938682271b09f8a07144c206de02383d67398c Mon Sep 17 00:00:00 2001 From: Jack Palevich <> Date: Thu, 2 Apr 2009 13:38:26 -0700 Subject: AI 144282: Tweak this tool to work with the current directory structure. Also leave the "generated" directory around if it contains files that need to be checked in. Automated import of CL 144282 --- opengl/tools/glgen/gen | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen index 1c49861..c060040 100755 --- a/opengl/tools/glgen/gen +++ b/opengl/tools/glgen/gen @@ -31,13 +31,15 @@ cp -r out/com generated cp -r out/javax generated rm -rf out +KEEP_GENERATED=0 # com_google_android_gles_jni_GLImpl.cpp -if cmp ../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp generated/C/com_google_android_gles_jni_GLImpl.cpp ; then +if cmp ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp generated/C/com_google_android_gles_jni_GLImpl.cpp ; then echo com_google_android_gles_jni_GLImpl.cpp unchanged else -echo Please edit ../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp -echo Please cp generated/C/com_google_android_gles_jni_GLImpl.cpp ../../../frameworks/base/core/jni +echo Please p4 edit ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp +echo Please cp generated/C/com_google_android_gles_jni_GLImpl.cpp ../../../../../frameworks/base/core/jni +KEEP_GENERATED=1 fi # GLImpl.java @@ -46,6 +48,7 @@ echo GLImpl.java unchanged else echo Please edit ../../java/com/google/android/gles_jni/GLImpl.java echo Please cp generated/com/google/android/gles_jni/GLImpl.java ../../java/com/google/android/gles_jni +KEEP_GENERATED=1 fi # GL.java @@ -54,6 +57,7 @@ echo GL.java unchanged else echo Please edit ../../java/javax/microedition/khronos/opengles/GL.java echo Please cp generated/javax/microedition/khronos/opengles/GL.java ../../java/javax/microedition/khronos/opengles/GL.java +KEEP_GENERATED=1 fi # GL10.java @@ -62,6 +66,7 @@ echo GL10.java unchanged else echo Please edit ../../java/javax/microedition/khronos/opengles/GL10.java echo Please cp generated/javax/microedition/khronos/opengles/GL10.java ../../java/javax/microedition/khronos/opengles/GL10.java +KEEP_GENERATED=1 fi # GL10Ext.java @@ -70,6 +75,7 @@ echo GL10Ext.java unchanged else echo Please edit ../../java/javax/microedition/khronos/opengles/GL10Ext.java echo Please cp generated/javax/microedition/khronos/opengles/GL10Ext.java ../../java/javax/microedition/khronos/opengles/GL10Ext.java +KEEP_GENERATED=1 fi # GL11.java @@ -78,6 +84,7 @@ echo GL11.java unchanged else echo Please edit ../../java/javax/microedition/khronos/opengles/GL11.java echo Please cp generated/javax/microedition/khronos/opengles/GL11.java ../../java/javax/microedition/khronos/opengles/GL11.java +KEEP_GENERATED=1 fi # GL11Ext.java @@ -86,6 +93,7 @@ echo GL11Ext.java unchanged else echo Please edit ../../java/javax/microedition/khronos/opengles/GL11Ext.java echo Please cp generated/javax/microedition/khronos/opengles/GL11Ext.java ../../java/javax/microedition/khronos/opengles/GL11Ext.java +KEEP_GENERATED=1 fi # GL11ExtensionPack.java @@ -94,6 +102,9 @@ echo GL11ExtensionPack.java unchanged else echo Please edit ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java echo Please cp generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java +KEEP_GENERATED=1 fi +if [ $KEEP_GENERATED == "0" ] ; then rm -rf generated +fi -- cgit v1.1 -- cgit v1.1 From bc0caf802e5eb08b6565bbe3a535cb2fca826d8b Mon Sep 17 00:00:00 2001 From: Andy Stadler <> Date: Fri, 10 Apr 2009 16:24:47 -0700 Subject: AI 145778: Manual merge changes 145382-145384 from cupcake. Automated import of CL 145778 --- include/ui/KeycodeLabels.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/ui/KeycodeLabels.h b/include/ui/KeycodeLabels.h index efa6d2b..571e47b 100644 --- a/include/ui/KeycodeLabels.h +++ b/include/ui/KeycodeLabels.h @@ -107,12 +107,12 @@ static const KeycodeLabel KEYCODES[] = { { "MENU", 82 }, { "NOTIFICATION", 83 }, { "SEARCH", 84 }, - { "PLAYPAUSE", 85 }, - { "STOP", 86 }, - { "NEXTSONG", 87 }, - { "PREVIOUSSONG", 88 }, - { "REWIND", 89 }, - { "FORWARD", 90 }, + { "MEDIA_PLAY_PAUSE", 85 }, + { "MEDIA_STOP", 86 }, + { "MEDIA_NEXT", 87 }, + { "MEDIA_PREVIOUS", 88 }, + { "MEDIA_REWIND", 89 }, + { "MEDIA_FAST_FORWARD", 90 }, { "MUTE", 91 }, // NOTE: If you add a new keycode here you must also add it to: -- cgit v1.1 From 6cbca50b6a438151a6c5f4dbdccc7057c19b73fa Mon Sep 17 00:00:00 2001 From: Jack Palevich Date: Mon, 13 Apr 2009 16:22:25 -0700 Subject: Clean up trivial Eclipse warnings and fix whitespace. Added @Override to overridden methods. Removed unused imports. Converted tabs to spaces. Removed \r characters from end-of-lines. Add .gitignore file to ignore the .class files that are generated when the "gen" script is run. --- opengl/tools/glgen/src/.gitignore | 1 + opengl/tools/glgen/src/CFunc.java | 311 +++++++++++++-------------- opengl/tools/glgen/src/CType.java | 173 +++++++-------- opengl/tools/glgen/src/CodeEmitter.java | 16 +- opengl/tools/glgen/src/GenerateGL.java | 332 +++++++++++++++-------------- opengl/tools/glgen/src/JFunc.java | 297 +++++++++++++------------- opengl/tools/glgen/src/JType.java | 279 ++++++++++++------------ opengl/tools/glgen/src/JniCodeEmitter.java | 88 ++++---- 8 files changed, 753 insertions(+), 744 deletions(-) create mode 100644 opengl/tools/glgen/src/.gitignore diff --git a/opengl/tools/glgen/src/.gitignore b/opengl/tools/glgen/src/.gitignore new file mode 100644 index 0000000..6b468b6 --- /dev/null +++ b/opengl/tools/glgen/src/.gitignore @@ -0,0 +1 @@ +*.class diff --git a/opengl/tools/glgen/src/CFunc.java b/opengl/tools/glgen/src/CFunc.java index 0794f41..a89e1c5 100644 --- a/opengl/tools/glgen/src/CFunc.java +++ b/opengl/tools/glgen/src/CFunc.java @@ -1,155 +1,156 @@ - -import java.util.*; - -public class CFunc { - - String original; - - CType ftype; - String fname; - - List argNames = new ArrayList(); - List argTypes = new ArrayList(); - - boolean hasPointerArg = false; - boolean hasTypedPointerArg = false; - - public CFunc(String original) { - this.original = original; - } - - public String getOriginal() { - return original; - } - - public void setName(String fname) { - this.fname = fname; - } - - public String getName() { - return fname; - } - - public void setType(CType ftype) { - this.ftype = ftype; - } - - public CType getType() { - return ftype; - } - - public void addArgument(String argName, CType argType) { - argNames.add(argName); - argTypes.add(argType); - - if (argType.isPointer()) { - hasPointerArg = true; - } - if (argType.isTypedPointer()) { - hasTypedPointerArg = true; - } - } - - public int getNumArgs() { - return argNames.size(); - } - - public int getArgIndex(String name) { - int len = argNames.size(); - for (int i = 0; i < len; i++) { - if (name.equals(argNames.get(i))) { - return i; - } - } - return -1; - } - - public String getArgName(int index) { - return argNames.get(index); - } - - public CType getArgType(int index) { - return argTypes.get(index); - } - - public boolean hasPointerArg() { - return hasPointerArg; - } - - public boolean hasTypedPointerArg() { - return hasTypedPointerArg; - } - - public String toString() { - String s = "Function " + fname + " returns " + ftype + ": "; - for (int i = 0; i < argNames.size(); i++) { - if (i > 0) { - s += ", "; - } - s += argTypes.get(i) + " " + argNames.get(i); - } - return s; - } - - public static CFunc parseCFunc(String s) { - CFunc cfunc = new CFunc(s); - String[] tokens = s.split("\\s"); - - int i = 0; - CType ftype = new CType(); - String ftypeName = tokens[i++]; - if (ftypeName.equals("const")) { - ftype.setIsConst(true); - ftypeName = tokens[i++]; - } - ftype.setBaseType(ftypeName); - - String fname = tokens[i++]; - if (fname.equals("*")) { - ftype.setIsPointer(true); - fname = tokens[i++]; - } - - cfunc.setName(fname); - cfunc.setType(ftype); - - while (i < tokens.length) { - String tok = tokens[i++]; - - if (tok.equals("(")) { - continue; - } - if (tok.equals(")")) { - break; - } - - CType argType = new CType(); - - String argTypeName = tok; - String argName = ""; - - if (argTypeName.equals("const")) { - argType.setIsConst(true); - argTypeName = tokens[i++]; - } - argType.setBaseType(argTypeName); - - if (argTypeName.equals("void")) { - break; - } - - argName = tokens[i++]; - if (argName.startsWith("*")) { - argType.setIsPointer(true); - argName = argName.substring(1, argName.length()); - } - if (argName.endsWith(",")) { - argName = argName.substring(0, argName.length() - 1); - } - - cfunc.addArgument(argName, argType); - } - - return cfunc; - } -} + +import java.util.*; + +public class CFunc { + + String original; + + CType ftype; + String fname; + + List argNames = new ArrayList(); + List argTypes = new ArrayList(); + + boolean hasPointerArg = false; + boolean hasTypedPointerArg = false; + + public CFunc(String original) { + this.original = original; + } + + public String getOriginal() { + return original; + } + + public void setName(String fname) { + this.fname = fname; + } + + public String getName() { + return fname; + } + + public void setType(CType ftype) { + this.ftype = ftype; + } + + public CType getType() { + return ftype; + } + + public void addArgument(String argName, CType argType) { + argNames.add(argName); + argTypes.add(argType); + + if (argType.isPointer()) { + hasPointerArg = true; + } + if (argType.isTypedPointer()) { + hasTypedPointerArg = true; + } + } + + public int getNumArgs() { + return argNames.size(); + } + + public int getArgIndex(String name) { + int len = argNames.size(); + for (int i = 0; i < len; i++) { + if (name.equals(argNames.get(i))) { + return i; + } + } + return -1; + } + + public String getArgName(int index) { + return argNames.get(index); + } + + public CType getArgType(int index) { + return argTypes.get(index); + } + + public boolean hasPointerArg() { + return hasPointerArg; + } + + public boolean hasTypedPointerArg() { + return hasTypedPointerArg; + } + + @Override + public String toString() { + String s = "Function " + fname + " returns " + ftype + ": "; + for (int i = 0; i < argNames.size(); i++) { + if (i > 0) { + s += ", "; + } + s += argTypes.get(i) + " " + argNames.get(i); + } + return s; + } + + public static CFunc parseCFunc(String s) { + CFunc cfunc = new CFunc(s); + String[] tokens = s.split("\\s"); + + int i = 0; + CType ftype = new CType(); + String ftypeName = tokens[i++]; + if (ftypeName.equals("const")) { + ftype.setIsConst(true); + ftypeName = tokens[i++]; + } + ftype.setBaseType(ftypeName); + + String fname = tokens[i++]; + if (fname.equals("*")) { + ftype.setIsPointer(true); + fname = tokens[i++]; + } + + cfunc.setName(fname); + cfunc.setType(ftype); + + while (i < tokens.length) { + String tok = tokens[i++]; + + if (tok.equals("(")) { + continue; + } + if (tok.equals(")")) { + break; + } + + CType argType = new CType(); + + String argTypeName = tok; + String argName = ""; + + if (argTypeName.equals("const")) { + argType.setIsConst(true); + argTypeName = tokens[i++]; + } + argType.setBaseType(argTypeName); + + if (argTypeName.equals("void")) { + break; + } + + argName = tokens[i++]; + if (argName.startsWith("*")) { + argType.setIsPointer(true); + argName = argName.substring(1, argName.length()); + } + if (argName.endsWith(",")) { + argName = argName.substring(0, argName.length() - 1); + } + + cfunc.addArgument(argName, argType); + } + + return cfunc; + } +} diff --git a/opengl/tools/glgen/src/CType.java b/opengl/tools/glgen/src/CType.java index 331ec62..826c90d 100644 --- a/opengl/tools/glgen/src/CType.java +++ b/opengl/tools/glgen/src/CType.java @@ -1,85 +1,88 @@ - -public class CType { - - String baseType; - boolean isConst; - boolean isPointer; - - public CType() { - } - - public CType(String baseType) { - setBaseType(baseType); - } - - public CType(String baseType, boolean isConst, boolean isPointer) { - setBaseType(baseType); - setIsConst(isConst); - setIsPointer(isPointer); - } - - public String getDeclaration() { - return baseType + (isPointer ? " *" : ""); - } - - public void setIsConst(boolean isConst) { - this.isConst = isConst; - } - - public boolean isConst() { - return isConst; - } - - public void setIsPointer(boolean isPointer) { - this.isPointer = isPointer; - } - - public boolean isPointer() { - return isPointer; - } - - boolean isVoid() { - String baseType = getBaseType(); - return baseType.equals("GLvoid") || - baseType.equals("void"); - } - - public boolean isTypedPointer() { - return isPointer() && !isVoid(); - } - - public void setBaseType(String baseType) { - this.baseType = baseType; - } - - public String getBaseType() { - return baseType; - } - - public String toString() { - String s = ""; - if (isConst()) { - s += "const "; - } - s += baseType; - if (isPointer()) { - s += "*"; - } - - return s; - } - - public int hashCode() { - return baseType.hashCode() ^ (isPointer ? 2 : 0) ^ (isConst ? 1 : 0); - } - - public boolean equals(Object o) { - if (o != null && o instanceof CType) { - CType c = (CType)o; - return baseType.equals(c.baseType) && - isPointer() == c.isPointer() && - isConst() == c.isConst(); - } - return false; - } -} + +public class CType { + + String baseType; + boolean isConst; + boolean isPointer; + + public CType() { + } + + public CType(String baseType) { + setBaseType(baseType); + } + + public CType(String baseType, boolean isConst, boolean isPointer) { + setBaseType(baseType); + setIsConst(isConst); + setIsPointer(isPointer); + } + + public String getDeclaration() { + return baseType + (isPointer ? " *" : ""); + } + + public void setIsConst(boolean isConst) { + this.isConst = isConst; + } + + public boolean isConst() { + return isConst; + } + + public void setIsPointer(boolean isPointer) { + this.isPointer = isPointer; + } + + public boolean isPointer() { + return isPointer; + } + + boolean isVoid() { + String baseType = getBaseType(); + return baseType.equals("GLvoid") || + baseType.equals("void"); + } + + public boolean isTypedPointer() { + return isPointer() && !isVoid(); + } + + public void setBaseType(String baseType) { + this.baseType = baseType; + } + + public String getBaseType() { + return baseType; + } + + @Override + public String toString() { + String s = ""; + if (isConst()) { + s += "const "; + } + s += baseType; + if (isPointer()) { + s += "*"; + } + + return s; + } + + @Override + public int hashCode() { + return baseType.hashCode() ^ (isPointer ? 2 : 0) ^ (isConst ? 1 : 0); + } + + @Override + public boolean equals(Object o) { + if (o != null && o instanceof CType) { + CType c = (CType)o; + return baseType.equals(c.baseType) && + isPointer() == c.isPointer() && + isConst() == c.isConst(); + } + return false; + } +} diff --git a/opengl/tools/glgen/src/CodeEmitter.java b/opengl/tools/glgen/src/CodeEmitter.java index 3e9b90a..ebb9727 100644 --- a/opengl/tools/glgen/src/CodeEmitter.java +++ b/opengl/tools/glgen/src/CodeEmitter.java @@ -1,8 +1,8 @@ - -public interface CodeEmitter { - - void setVersion(int version, boolean ext, boolean pack); - void emitCode(CFunc cfunc, String original); - void addNativeRegistration(String fname); - void emitNativeRegistration(); -} + +public interface CodeEmitter { + + void setVersion(int version, boolean ext, boolean pack); + void emitCode(CFunc cfunc, String original); + void addNativeRegistration(String fname); + void emitNativeRegistration(); +} diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java index 657ee6e..afe1bb6 100644 --- a/opengl/tools/glgen/src/GenerateGL.java +++ b/opengl/tools/glgen/src/GenerateGL.java @@ -1,164 +1,168 @@ - -import java.io.*; -import java.util.*; - -public class GenerateGL { - - static void copy(String filename, PrintStream out) throws IOException { - BufferedReader br = new BufferedReader(new FileReader(filename)); - String s; - while ((s = br.readLine()) != null) { - out.println(s); - } - } - - private static void emit(int version, boolean ext, boolean pack, - CodeEmitter emitter, - BufferedReader specReader, - PrintStream glStream, - PrintStream glImplStream, - PrintStream cStream) throws Exception { - String s = null; - int counter = 0; - while ((s = specReader.readLine()) != null) { - if (s.trim().startsWith("//")) { - continue; - } - - CFunc cfunc = CFunc.parseCFunc(s); - - String fname = cfunc.getName(); - File f = new File("stubs/" + fname + - ".java-1" + version + "-if"); - if (f.exists()) { - System.out.println("Special-casing function " + fname); - copy("stubs/" + fname + - ".java-1" + version + "-if", glStream); - copy("stubs/" + fname + ".java-impl", glImplStream); - copy("stubs/" + fname + ".cpp", cStream); - - // Register native function names - // This should be improved to require fewer discrete files - String filename = "stubs/" + fname + ".nativeReg"; - BufferedReader br = - new BufferedReader(new FileReader(filename)); - String nfunc; - while ((nfunc = br.readLine()) != null) { - emitter.addNativeRegistration(nfunc); - } - } else { - emitter.setVersion(version, ext, pack); - emitter.emitCode(cfunc, s); - } - } - } - - public static void main(String[] args) throws Exception { - String classPathName = "com/google/android/gles_jni/GLImpl"; - boolean useContextPointer = true; - - int aidx = 0; - while (args[aidx].charAt(0) == '-') { - switch (args[aidx].charAt(1)) { - case 'c': - useContextPointer = false; - break; - - default: - System.err.println("Unknown flag: " + args[aidx]); - System.exit(1); - } - - aidx++; - } - - System.out.println("useContextPointer = " + useContextPointer); - - BufferedReader spec10Reader = - new BufferedReader(new FileReader(args[aidx++])); - BufferedReader spec10ExtReader = - new BufferedReader(new FileReader(args[aidx++])); - BufferedReader spec11Reader = - new BufferedReader(new FileReader(args[aidx++])); - BufferedReader spec11ExtReader = - new BufferedReader(new FileReader(args[aidx++])); - BufferedReader spec11ExtPackReader = - new BufferedReader(new FileReader(args[aidx++])); - BufferedReader checksReader = - new BufferedReader(new FileReader(args[aidx++])); - - String gl10Filename = "javax/microedition/khronos/opengles/GL10.java"; - String gl10ExtFilename = - "javax/microedition/khronos/opengles/GL10Ext.java"; - String gl11Filename = "javax/microedition/khronos/opengles/GL11.java"; - String gl11ExtFilename = - "javax/microedition/khronos/opengles/GL11Ext.java"; - String gl11ExtPackFilename = - "javax/microedition/khronos/opengles/GL11ExtensionPack.java"; - String glImplFilename = "com/google/android/gles_jni/GLImpl.java"; - String cFilename = "com_google_android_gles_jni_GLImpl.cpp"; - - PrintStream gl10Stream = - new PrintStream(new FileOutputStream("out/" + gl10Filename)); - PrintStream gl10ExtStream = - new PrintStream(new FileOutputStream("out/" + gl10ExtFilename)); - PrintStream gl11Stream = - new PrintStream(new FileOutputStream("out/" + gl11Filename)); - PrintStream gl11ExtStream = - new PrintStream(new FileOutputStream("out/" + gl11ExtFilename)); - PrintStream gl11ExtPackStream = - new PrintStream(new FileOutputStream("out/" + gl11ExtPackFilename)); - PrintStream glImplStream = - new PrintStream(new FileOutputStream("out/" + glImplFilename)); - PrintStream cStream = - new PrintStream(new FileOutputStream("out/" + cFilename)); - - ParameterChecker checker = new ParameterChecker(checksReader); - - CodeEmitter emitter = - new JniCodeEmitter(classPathName, - checker, - gl10Stream, gl10ExtStream, - gl11Stream, gl11ExtStream, gl11ExtPackStream, - glImplStream, cStream, - useContextPointer); - - gl10Stream.println("/* //device/java/android/" + gl10Filename); - gl10ExtStream.println("/* //device/java/android/" + gl10ExtFilename); - gl11Stream.println("/* //device/java/android/" + gl11Filename); - gl11ExtStream.println("/* //device/java/android/" + gl11ExtFilename); - gl11ExtPackStream.println("/* //device/java/android/" + - gl11ExtPackFilename); - glImplStream.println("/* //device/java/android/" + glImplFilename); - cStream.println("/* //device/libs/android_runtime/" + cFilename); - - copy("stubs/GL10Header.java-if", gl10Stream); - copy("stubs/GL10ExtHeader.java-if", gl10ExtStream); - copy("stubs/GL11Header.java-if", gl11Stream); - copy("stubs/GL11ExtHeader.java-if", gl11ExtStream); - copy("stubs/GL11ExtensionPackHeader.java-if", gl11ExtPackStream); - copy("stubs/GLImplHeader.java-impl", glImplStream); - copy("stubs/GLCHeader.cpp", cStream); - - emit(0, false, false, - emitter, spec10Reader, gl10Stream, glImplStream, cStream); - emit(0, true, false, - emitter, spec10ExtReader, gl10ExtStream, glImplStream, cStream); - emit(1, false, false, - emitter, spec11Reader, gl11Stream, glImplStream, cStream); - emit(1, true, false, - emitter, spec11ExtReader, gl11ExtStream, glImplStream, cStream); - emit(1, true, true, - emitter, spec11ExtPackReader, gl11ExtPackStream, glImplStream, - cStream); - - emitter.emitNativeRegistration(); - - gl10Stream.println("}"); - gl10ExtStream.println("}"); - gl11Stream.println("}"); - gl11ExtStream.println("}"); - gl11ExtPackStream.println("}"); - glImplStream.println("}"); - } -} + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintStream; + +public class GenerateGL { + + static void copy(String filename, PrintStream out) throws IOException { + BufferedReader br = new BufferedReader(new FileReader(filename)); + String s; + while ((s = br.readLine()) != null) { + out.println(s); + } + } + + private static void emit(int version, boolean ext, boolean pack, + CodeEmitter emitter, + BufferedReader specReader, + PrintStream glStream, + PrintStream glImplStream, + PrintStream cStream) throws Exception { + String s = null; + int counter = 0; + while ((s = specReader.readLine()) != null) { + if (s.trim().startsWith("//")) { + continue; + } + + CFunc cfunc = CFunc.parseCFunc(s); + + String fname = cfunc.getName(); + File f = new File("stubs/" + fname + + ".java-1" + version + "-if"); + if (f.exists()) { + System.out.println("Special-casing function " + fname); + copy("stubs/" + fname + + ".java-1" + version + "-if", glStream); + copy("stubs/" + fname + ".java-impl", glImplStream); + copy("stubs/" + fname + ".cpp", cStream); + + // Register native function names + // This should be improved to require fewer discrete files + String filename = "stubs/" + fname + ".nativeReg"; + BufferedReader br = + new BufferedReader(new FileReader(filename)); + String nfunc; + while ((nfunc = br.readLine()) != null) { + emitter.addNativeRegistration(nfunc); + } + } else { + emitter.setVersion(version, ext, pack); + emitter.emitCode(cfunc, s); + } + } + } + + public static void main(String[] args) throws Exception { + String classPathName = "com/google/android/gles_jni/GLImpl"; + boolean useContextPointer = true; + + int aidx = 0; + while (args[aidx].charAt(0) == '-') { + switch (args[aidx].charAt(1)) { + case 'c': + useContextPointer = false; + break; + + default: + System.err.println("Unknown flag: " + args[aidx]); + System.exit(1); + } + + aidx++; + } + + System.out.println("useContextPointer = " + useContextPointer); + + BufferedReader spec10Reader = + new BufferedReader(new FileReader(args[aidx++])); + BufferedReader spec10ExtReader = + new BufferedReader(new FileReader(args[aidx++])); + BufferedReader spec11Reader = + new BufferedReader(new FileReader(args[aidx++])); + BufferedReader spec11ExtReader = + new BufferedReader(new FileReader(args[aidx++])); + BufferedReader spec11ExtPackReader = + new BufferedReader(new FileReader(args[aidx++])); + BufferedReader checksReader = + new BufferedReader(new FileReader(args[aidx++])); + + String gl10Filename = "javax/microedition/khronos/opengles/GL10.java"; + String gl10ExtFilename = + "javax/microedition/khronos/opengles/GL10Ext.java"; + String gl11Filename = "javax/microedition/khronos/opengles/GL11.java"; + String gl11ExtFilename = + "javax/microedition/khronos/opengles/GL11Ext.java"; + String gl11ExtPackFilename = + "javax/microedition/khronos/opengles/GL11ExtensionPack.java"; + String glImplFilename = "com/google/android/gles_jni/GLImpl.java"; + String cFilename = "com_google_android_gles_jni_GLImpl.cpp"; + + PrintStream gl10Stream = + new PrintStream(new FileOutputStream("out/" + gl10Filename)); + PrintStream gl10ExtStream = + new PrintStream(new FileOutputStream("out/" + gl10ExtFilename)); + PrintStream gl11Stream = + new PrintStream(new FileOutputStream("out/" + gl11Filename)); + PrintStream gl11ExtStream = + new PrintStream(new FileOutputStream("out/" + gl11ExtFilename)); + PrintStream gl11ExtPackStream = + new PrintStream(new FileOutputStream("out/" + gl11ExtPackFilename)); + PrintStream glImplStream = + new PrintStream(new FileOutputStream("out/" + glImplFilename)); + PrintStream cStream = + new PrintStream(new FileOutputStream("out/" + cFilename)); + + ParameterChecker checker = new ParameterChecker(checksReader); + + CodeEmitter emitter = + new JniCodeEmitter(classPathName, + checker, + gl10Stream, gl10ExtStream, + gl11Stream, gl11ExtStream, gl11ExtPackStream, + glImplStream, cStream, + useContextPointer); + + gl10Stream.println("/* //device/java/android/" + gl10Filename); + gl10ExtStream.println("/* //device/java/android/" + gl10ExtFilename); + gl11Stream.println("/* //device/java/android/" + gl11Filename); + gl11ExtStream.println("/* //device/java/android/" + gl11ExtFilename); + gl11ExtPackStream.println("/* //device/java/android/" + + gl11ExtPackFilename); + glImplStream.println("/* //device/java/android/" + glImplFilename); + cStream.println("/* //device/libs/android_runtime/" + cFilename); + + copy("stubs/GL10Header.java-if", gl10Stream); + copy("stubs/GL10ExtHeader.java-if", gl10ExtStream); + copy("stubs/GL11Header.java-if", gl11Stream); + copy("stubs/GL11ExtHeader.java-if", gl11ExtStream); + copy("stubs/GL11ExtensionPackHeader.java-if", gl11ExtPackStream); + copy("stubs/GLImplHeader.java-impl", glImplStream); + copy("stubs/GLCHeader.cpp", cStream); + + emit(0, false, false, + emitter, spec10Reader, gl10Stream, glImplStream, cStream); + emit(0, true, false, + emitter, spec10ExtReader, gl10ExtStream, glImplStream, cStream); + emit(1, false, false, + emitter, spec11Reader, gl11Stream, glImplStream, cStream); + emit(1, true, false, + emitter, spec11ExtReader, gl11ExtStream, glImplStream, cStream); + emit(1, true, true, + emitter, spec11ExtPackReader, gl11ExtPackStream, glImplStream, + cStream); + + emitter.emitNativeRegistration(); + + gl10Stream.println("}"); + gl10ExtStream.println("}"); + gl11Stream.println("}"); + gl11ExtStream.println("}"); + gl11ExtPackStream.println("}"); + glImplStream.println("}"); + } +} diff --git a/opengl/tools/glgen/src/JFunc.java b/opengl/tools/glgen/src/JFunc.java index 42d466c..68f717c 100644 --- a/opengl/tools/glgen/src/JFunc.java +++ b/opengl/tools/glgen/src/JFunc.java @@ -1,148 +1,149 @@ - -import java.util.ArrayList; -import java.util.List; - -public class JFunc { - - String className = "com.google.android.gles_jni.GL11Impl"; - - CFunc cfunc; - JType ftype; - String fname; - - List argNames = new ArrayList(); - List argTypes = new ArrayList(); - List argCIndices = new ArrayList(); - - boolean hasBufferArg = false; - boolean hasTypedBufferArg = false; - ArrayList bufferArgNames = new ArrayList(); - - public JFunc(CFunc cfunc) { - this.cfunc = cfunc; - } - - public CFunc getCFunc() { - return cfunc; - } - - public void setName(String fname) { - this.fname = fname; - } - - public String getName() { - return fname; - } - - public void setType(JType ftype) { - this.ftype = ftype; - } - - public JType getType() { - return ftype; - } - - public void setClassName(String className) { - this.className = className; - } - - public String getClassName() { - return className; - } - - public boolean hasBufferArg() { - return hasBufferArg; - } - - public boolean hasTypedBufferArg() { - return hasTypedBufferArg; - } - - public String getBufferArgName(int index) { - return bufferArgNames.get(index); - } - - public void addArgument(String argName, JType argType, int cindex) { - argNames.add(argName); - argTypes.add(argType); - argCIndices.add(new Integer(cindex)); - - if (argType.isBuffer()) { - hasBufferArg = true; - bufferArgNames.add(argName); - } - if (argType.isTypedBuffer()) { - hasTypedBufferArg = true; - bufferArgNames.add(argName); - } - } - - public int getNumArgs() { - return argNames.size(); - } - - public int getArgIndex(String name) { - int len = argNames.size(); - for (int i = 0; i < len; i++) { - if (name.equals(argNames.get(i))) { - return i; - } - } - return -1; - } - - public String getArgName(int index) { - return argNames.get(index); - } - - public JType getArgType(int index) { - return argTypes.get(index); - } - - public int getArgCIndex(int index) { - return argCIndices.get(index).intValue(); - } - - public static JFunc convert(CFunc cfunc, boolean useArray) { - JFunc jfunc = new JFunc(cfunc); - jfunc.setName(cfunc.getName()); - jfunc.setType(JType.convert(cfunc.getType(), false)); - - int numArgs = cfunc.getNumArgs(); - int numOffsets = 0; - for (int i = 0; i < numArgs; i++) { - CType cArgType = cfunc.getArgType(i); - if (cArgType.isTypedPointer() && useArray) { - ++numOffsets; - } - } - - for (int i = 0; i < numArgs; i++) { - String cArgName = cfunc.getArgName(i); - CType cArgType = cfunc.getArgType(i); - - jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i); - if (cArgType.isTypedPointer() && useArray) { - if (numOffsets > 1) { - jfunc.addArgument(cArgName + "Offset", new JType("int"), i); - } else { - jfunc.addArgument("offset", new JType("int"), i); - } - } - } - - return jfunc; - } - - public String toString() { - String s = "Function " + fname + " returns " + ftype + ": "; - for (int i = 0; i < argNames.size(); i++) { - if (i > 0) { - s += ", "; - } - s += argTypes.get(i) + " " + argNames.get(i); - } - return s; - } - -} + +import java.util.ArrayList; +import java.util.List; + +public class JFunc { + + String className = "com.google.android.gles_jni.GL11Impl"; + + CFunc cfunc; + JType ftype; + String fname; + + List argNames = new ArrayList(); + List argTypes = new ArrayList(); + List argCIndices = new ArrayList(); + + boolean hasBufferArg = false; + boolean hasTypedBufferArg = false; + ArrayList bufferArgNames = new ArrayList(); + + public JFunc(CFunc cfunc) { + this.cfunc = cfunc; + } + + public CFunc getCFunc() { + return cfunc; + } + + public void setName(String fname) { + this.fname = fname; + } + + public String getName() { + return fname; + } + + public void setType(JType ftype) { + this.ftype = ftype; + } + + public JType getType() { + return ftype; + } + + public void setClassName(String className) { + this.className = className; + } + + public String getClassName() { + return className; + } + + public boolean hasBufferArg() { + return hasBufferArg; + } + + public boolean hasTypedBufferArg() { + return hasTypedBufferArg; + } + + public String getBufferArgName(int index) { + return bufferArgNames.get(index); + } + + public void addArgument(String argName, JType argType, int cindex) { + argNames.add(argName); + argTypes.add(argType); + argCIndices.add(new Integer(cindex)); + + if (argType.isBuffer()) { + hasBufferArg = true; + bufferArgNames.add(argName); + } + if (argType.isTypedBuffer()) { + hasTypedBufferArg = true; + bufferArgNames.add(argName); + } + } + + public int getNumArgs() { + return argNames.size(); + } + + public int getArgIndex(String name) { + int len = argNames.size(); + for (int i = 0; i < len; i++) { + if (name.equals(argNames.get(i))) { + return i; + } + } + return -1; + } + + public String getArgName(int index) { + return argNames.get(index); + } + + public JType getArgType(int index) { + return argTypes.get(index); + } + + public int getArgCIndex(int index) { + return argCIndices.get(index).intValue(); + } + + public static JFunc convert(CFunc cfunc, boolean useArray) { + JFunc jfunc = new JFunc(cfunc); + jfunc.setName(cfunc.getName()); + jfunc.setType(JType.convert(cfunc.getType(), false)); + + int numArgs = cfunc.getNumArgs(); + int numOffsets = 0; + for (int i = 0; i < numArgs; i++) { + CType cArgType = cfunc.getArgType(i); + if (cArgType.isTypedPointer() && useArray) { + ++numOffsets; + } + } + + for (int i = 0; i < numArgs; i++) { + String cArgName = cfunc.getArgName(i); + CType cArgType = cfunc.getArgType(i); + + jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i); + if (cArgType.isTypedPointer() && useArray) { + if (numOffsets > 1) { + jfunc.addArgument(cArgName + "Offset", new JType("int"), i); + } else { + jfunc.addArgument("offset", new JType("int"), i); + } + } + } + + return jfunc; + } + + @Override + public String toString() { + String s = "Function " + fname + " returns " + ftype + ": "; + for (int i = 0; i < argNames.size(); i++) { + if (i > 0) { + s += ", "; + } + s += argTypes.get(i) + " " + argNames.get(i); + } + return s; + } + +} diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java index a16d440..5ad0e54 100644 --- a/opengl/tools/glgen/src/JType.java +++ b/opengl/tools/glgen/src/JType.java @@ -1,139 +1,140 @@ - -import java.util.HashMap; - -public class JType { - - String baseType; - boolean isArray; - boolean isClass; - - static HashMap typeMapping = new HashMap(); - static HashMap arrayTypeMapping = new HashMap(); - - static { - // Primitive types - typeMapping.put(new CType("GLbitfield"), new JType("int")); - typeMapping.put(new CType("GLboolean"), new JType("boolean")); - typeMapping.put(new CType("GLclampf"), new JType("float")); - typeMapping.put(new CType("GLclampx"), new JType("int")); - typeMapping.put(new CType("GLenum"), new JType("int")); - typeMapping.put(new CType("GLfloat"), new JType("float")); - typeMapping.put(new CType("GLfixed"), new JType("int")); - typeMapping.put(new CType("GLint"), new JType("int")); - typeMapping.put(new CType("GLintptr"), new JType("int")); - typeMapping.put(new CType("GLshort"), new JType("short")); - typeMapping.put(new CType("GLsizei"), new JType("int")); - typeMapping.put(new CType("GLsizeiptr"), new JType("int")); - typeMapping.put(new CType("GLubyte"), new JType("byte")); - typeMapping.put(new CType("GLuint"), new JType("int")); - typeMapping.put(new CType("void"), new JType("void")); - typeMapping.put(new CType("GLubyte", true, true), new JType("String")); - - // Untyped pointers map to untyped Buffers - typeMapping.put(new CType("GLvoid", true, true), - new JType("java.nio.Buffer", true, false)); - typeMapping.put(new CType("GLvoid", false, true), - new JType("java.nio.Buffer", true, false)); - typeMapping.put(new CType("void", false, true), - new JType("java.nio.Buffer", true, false)); - - // Typed pointers map to typed Buffers - typeMapping.put(new CType("GLboolean", false, true), - new JType("java.nio.IntBuffer", true, false)); - typeMapping.put(new CType("GLfixed", false, true), - new JType("java.nio.IntBuffer", true, false)); - typeMapping.put(new CType("GLfixed", true, true), - new JType("java.nio.IntBuffer", true, false)); - typeMapping.put(new CType("GLfloat", false, true), - new JType("java.nio.FloatBuffer", true, false)); - typeMapping.put(new CType("GLfloat", true, true), - new JType("java.nio.FloatBuffer", true, false)); - typeMapping.put(new CType("GLint", false, true), - new JType("java.nio.IntBuffer", true, false)); - typeMapping.put(new CType("GLint", true, true), - new JType("java.nio.IntBuffer", true, false)); - typeMapping.put(new CType("GLuint", false, true), - new JType("java.nio.IntBuffer", true, false)); - typeMapping.put(new CType("GLuint", true, true), - new JType("java.nio.IntBuffer", true, false)); - typeMapping.put(new CType("GLshort", true, true), - new JType("java.nio.ShortBuffer", true, false)); - - // Typed pointers map to arrays + offsets - arrayTypeMapping.put(new CType("GLboolean", false, true), - new JType("boolean", false, true)); - arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true)); - arrayTypeMapping.put(new CType("GLfloat", true, true), new JType("float", false, true)); - arrayTypeMapping.put(new CType("GLint", false, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLint", true, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLshort", true, true), new JType("short", false, true)); - arrayTypeMapping.put(new CType("GLuint", false, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true)); - } - - public JType() { - } - - public JType(String primitiveTypeName) { - this.baseType = primitiveTypeName; - this.isClass = false; - this.isArray = false; - } - - public JType(String primitiveTypeName, boolean isClass, boolean isArray) { - this.baseType = primitiveTypeName; - this.isClass = isClass; - this.isArray = isArray; - } - - public String getBaseType() { - return baseType; - } - - public String toString() { - return baseType + (isArray ? "[]" : ""); - } - - public boolean isArray() { - return isArray; - } - - public boolean isClass() { - return isClass; - } - - public boolean isPrimitive() { - return !isClass() && !isArray(); - } - - public boolean isVoid() { - return baseType.equals("void"); - } - - public boolean isBuffer() { - return baseType.indexOf("Buffer") != -1; - } - - public boolean isTypedBuffer() { - return !baseType.equals("java.nio.Buffer") && - (baseType.indexOf("Buffer") != -1); - } - - public static JType convert(CType ctype, boolean useArray) { - JType javaType = null; - if (useArray) { - javaType = arrayTypeMapping.get(ctype); - } - if (javaType == null) { - javaType = typeMapping.get(ctype); - } - if (javaType == null) { - throw new RuntimeException("Unsupported C type: " + ctype); - } - return javaType; - } -} + +import java.util.HashMap; + +public class JType { + + String baseType; + boolean isArray; + boolean isClass; + + static HashMap typeMapping = new HashMap(); + static HashMap arrayTypeMapping = new HashMap(); + + static { + // Primitive types + typeMapping.put(new CType("GLbitfield"), new JType("int")); + typeMapping.put(new CType("GLboolean"), new JType("boolean")); + typeMapping.put(new CType("GLclampf"), new JType("float")); + typeMapping.put(new CType("GLclampx"), new JType("int")); + typeMapping.put(new CType("GLenum"), new JType("int")); + typeMapping.put(new CType("GLfloat"), new JType("float")); + typeMapping.put(new CType("GLfixed"), new JType("int")); + typeMapping.put(new CType("GLint"), new JType("int")); + typeMapping.put(new CType("GLintptr"), new JType("int")); + typeMapping.put(new CType("GLshort"), new JType("short")); + typeMapping.put(new CType("GLsizei"), new JType("int")); + typeMapping.put(new CType("GLsizeiptr"), new JType("int")); + typeMapping.put(new CType("GLubyte"), new JType("byte")); + typeMapping.put(new CType("GLuint"), new JType("int")); + typeMapping.put(new CType("void"), new JType("void")); + typeMapping.put(new CType("GLubyte", true, true), new JType("String")); + + // Untyped pointers map to untyped Buffers + typeMapping.put(new CType("GLvoid", true, true), + new JType("java.nio.Buffer", true, false)); + typeMapping.put(new CType("GLvoid", false, true), + new JType("java.nio.Buffer", true, false)); + typeMapping.put(new CType("void", false, true), + new JType("java.nio.Buffer", true, false)); + + // Typed pointers map to typed Buffers + typeMapping.put(new CType("GLboolean", false, true), + new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLfixed", false, true), + new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLfixed", true, true), + new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLfloat", false, true), + new JType("java.nio.FloatBuffer", true, false)); + typeMapping.put(new CType("GLfloat", true, true), + new JType("java.nio.FloatBuffer", true, false)); + typeMapping.put(new CType("GLint", false, true), + new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLint", true, true), + new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLuint", false, true), + new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLuint", true, true), + new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLshort", true, true), + new JType("java.nio.ShortBuffer", true, false)); + + // Typed pointers map to arrays + offsets + arrayTypeMapping.put(new CType("GLboolean", false, true), + new JType("boolean", false, true)); + arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true)); + arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true)); + arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true)); + arrayTypeMapping.put(new CType("GLfloat", true, true), new JType("float", false, true)); + arrayTypeMapping.put(new CType("GLint", false, true), new JType("int", false, true)); + arrayTypeMapping.put(new CType("GLint", true, true), new JType("int", false, true)); + arrayTypeMapping.put(new CType("GLshort", true, true), new JType("short", false, true)); + arrayTypeMapping.put(new CType("GLuint", false, true), new JType("int", false, true)); + arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true)); + arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true)); + arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true)); + } + + public JType() { + } + + public JType(String primitiveTypeName) { + this.baseType = primitiveTypeName; + this.isClass = false; + this.isArray = false; + } + + public JType(String primitiveTypeName, boolean isClass, boolean isArray) { + this.baseType = primitiveTypeName; + this.isClass = isClass; + this.isArray = isArray; + } + + public String getBaseType() { + return baseType; + } + + @Override + public String toString() { + return baseType + (isArray ? "[]" : ""); + } + + public boolean isArray() { + return isArray; + } + + public boolean isClass() { + return isClass; + } + + public boolean isPrimitive() { + return !isClass() && !isArray(); + } + + public boolean isVoid() { + return baseType.equals("void"); + } + + public boolean isBuffer() { + return baseType.indexOf("Buffer") != -1; + } + + public boolean isTypedBuffer() { + return !baseType.equals("java.nio.Buffer") && + (baseType.indexOf("Buffer") != -1); + } + + public static JType convert(CType ctype, boolean useArray) { + JType javaType = null; + if (useArray) { + javaType = arrayTypeMapping.get(ctype); + } + if (javaType == null) { + javaType = typeMapping.get(ctype); + } + if (javaType == null) { + throw new RuntimeException("Unsupported C type: " + ctype); + } + return javaType; + } +} diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java index 33b9a3e..2a8bcbb 100644 --- a/opengl/tools/glgen/src/JniCodeEmitter.java +++ b/opengl/tools/glgen/src/JniCodeEmitter.java @@ -1,6 +1,4 @@ import java.io.PrintStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -24,7 +22,7 @@ public class JniCodeEmitter implements CodeEmitter { boolean mUseContextPointer = true; String mClassPathName; - + ParameterChecker mChecker; PrintStream mJava10InterfaceStream; PrintStream mJava10ExtInterfaceStream; @@ -47,7 +45,7 @@ public class JniCodeEmitter implements CodeEmitter { /** * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions - * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions + * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions * @param javaImplStream the PrintStream to which to emit the Java implementation @@ -93,7 +91,7 @@ public class JniCodeEmitter implements CodeEmitter { JFunc jfunc; String signature; boolean duplicate; - + if (cfunc.hasTypedPointerArg()) { jfunc = JFunc.convert(cfunc, true); @@ -152,7 +150,7 @@ public class JniCodeEmitter implements CodeEmitter { public void emitJavaCode(JFunc jfunc, PrintStream out) { emitFunction(jfunc, out, false, false); } - + void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray ) { boolean isVoid = jfunc.getType().isVoid(); boolean isPointerFunc = jfunc.getName().endsWith("Pointer") && @@ -167,7 +165,7 @@ public class JniCodeEmitter implements CodeEmitter { jfunc.getName() + (isPointerFunc ? "Bounds" : "" ) + "("); - + int numArgs = jfunc.getNumArgs(); for (int i = 0; i < numArgs; i++) { String argName = jfunc.getArgName(i); @@ -177,7 +175,7 @@ public class JniCodeEmitter implements CodeEmitter { String typeName = argType.getBaseType(); typeName = typeName.substring(9, typeName.length() - 6); out.println(iii + indent + "get" + typeName + "Array(" + argName + "),"); - out.print(iii + indent + "getOffset(" + argName + ")"); + out.print(iii + indent + "getOffset(" + argName + ")"); } else { out.print(iii + indent + argName); } @@ -192,7 +190,7 @@ public class JniCodeEmitter implements CodeEmitter { out.println(","); } } - + out.println(iii + ");"); } @@ -220,7 +218,7 @@ public class JniCodeEmitter implements CodeEmitter { (mUseCPlusPlus ? "" : "_env, ") + "IAEClass, " + "\"" + - (isBuffer ? + (isBuffer ? "remaining()" : "length - " + offset) + " < needed\");"); out.println(iii + indent + "goto exit;"); @@ -345,21 +343,21 @@ public class JniCodeEmitter implements CodeEmitter { if (emitExceptionCheck) { out.println(iii + indent + "_exception = 1;"); } - String exceptionClassName = "IAEClass"; - // If the "check" keyword was of the form - // "check_", use the class name in the - // exception to be thrown - int underscore = checks[index].indexOf('_'); - if (underscore >= 0) { - exceptionClassName = checks[index].substring(underscore + 1) + "Class"; - } + String exceptionClassName = "IAEClass"; + // If the "check" keyword was of the form + // "check_", use the class name in the + // exception to be thrown + int underscore = checks[index].indexOf('_'); + if (underscore >= 0) { + exceptionClassName = checks[index].substring(underscore + 1) + "Class"; + } out.println(iii + indent + (mUseCPlusPlus ? "_env" : "(*_env)") + "->ThrowNew(" + (mUseCPlusPlus ? "" : "_env, ") + - exceptionClassName + ", " + + exceptionClassName + ", " + "\"" + - (isBuffer ? + (isBuffer ? "remaining()" : "length - " + offset) + " < " + checks[index + 2] + "\");"); @@ -367,7 +365,7 @@ public class JniCodeEmitter implements CodeEmitter { out.println(iii + indent + "goto exit;"); needsExit = true; out.println(iii + "}"); - + index += 3; } else if (checks[index].equals("ifcheck")) { String[] matches = checks[index + 4].split(","); @@ -379,7 +377,7 @@ public class JniCodeEmitter implements CodeEmitter { checks[index + 3] + ") {"); } - + for (int i = 0; i < matches.length; i++) { out.println("#if defined(" + matches[i] + ")"); out.println(iii + @@ -394,7 +392,7 @@ public class JniCodeEmitter implements CodeEmitter { ";"); out.println(iii + " break;"); - + lastWasIfcheck = true; index += 5; } else if (checks[index].equals("return")) { @@ -439,7 +437,7 @@ public class JniCodeEmitter implements CodeEmitter { return false; } - + /** * Emit a function in several variants: * @@ -478,12 +476,12 @@ public class JniCodeEmitter implements CodeEmitter { jfunc.getName() + "("); } - + int numArgs = jfunc.getNumArgs(); for (int i = 0; i < numArgs; i++) { String argName = jfunc.getArgName(i); JType argType = jfunc.getArgType(i); - + out.print(indent + indent + argType + " " + argName); if (i == numArgs - 1) { if (isPointerFunc && nativeDecl) { @@ -568,7 +566,7 @@ public class JniCodeEmitter implements CodeEmitter { } else if (jType.isArray()) { jniName = "["; } - + String baseType = jType.getBaseType(); if (baseType.equals("int")) { jniName += "I"; @@ -604,7 +602,7 @@ public class JniCodeEmitter implements CodeEmitter { return "jobject"; } } - + String getJniMangledName(String name) { name = name.replaceAll("_", "_1"); name = name.replaceAll(";", "_2"); @@ -614,7 +612,7 @@ public class JniCodeEmitter implements CodeEmitter { public void emitJniCode(JFunc jfunc, PrintStream out) { CFunc cfunc = jfunc.getCFunc(); - + // Emit comment identifying original C function // // Example: @@ -658,13 +656,13 @@ public class JniCodeEmitter implements CodeEmitter { } // Append signature to function name - String sig = getJniMangledName(signature).replace('.', '_'); + String sig = getJniMangledName(signature).replace('.', '_'); out.print("__" + sig); outName += "__" + sig; - + signature = signature.replace('.', '/'); rsignature = rsignature.replace('.', '/'); - + out.println(); if (rsignature.length() == 0) { rsignature = "V"; @@ -718,7 +716,7 @@ public class JniCodeEmitter implements CodeEmitter { out.print(", jint remaining"); } out.println(") {"); - + int numArrays = 0; int numBuffers = 0; for (int i = 0; i < nonPrimitiveArgs.size(); i++) { @@ -740,7 +738,7 @@ public class JniCodeEmitter implements CodeEmitter { // Example: // // android::gl::ogles_context_t *ctx; - // + // // jint _exception; // GLenum _returnValue; // @@ -827,7 +825,7 @@ public class JniCodeEmitter implements CodeEmitter { out.println(indent + decl + (decl.endsWith("*") ? "" : " ") + - jfunc.getArgName(idx) + + jfunc.getArgName(idx) + " = (" + decl + ") 0;"); } @@ -843,7 +841,7 @@ public class JniCodeEmitter implements CodeEmitter { for (int i = 0; i < nonPrimitiveArgs.size(); i++) { int idx = nonPrimitiveArgs.get(i).intValue(); int cIndex = jfunc.getArgCIndex(idx); - + String cname = cfunc.getArgName(cIndex); offset = numArrays <= 1 ? "offset" : cname + "Offset"; @@ -852,7 +850,7 @@ public class JniCodeEmitter implements CodeEmitter { if (jfunc.getArgType(idx).isArray()) { out.println(indent + - "if (!" + + "if (!" + cname + "_ref) {"); if (emitExceptionCheck) { @@ -884,7 +882,7 @@ public class JniCodeEmitter implements CodeEmitter { out.println(indent + "}"); out.println(indent + remaining + " = " + - (mUseCPlusPlus ? "_env" : "(*_env)") + + (mUseCPlusPlus ? "_env" : "(*_env)") + "->GetArrayLength(" + (mUseCPlusPlus ? "" : "_env, ") + cname + "_ref) - " + offset + ";"); @@ -901,7 +899,7 @@ public class JniCodeEmitter implements CodeEmitter { out.println(indent + " " + (mUseCPlusPlus ? "_env" : "(*_env)") + "->GetPrimitiveArrayCritical(" + - (mUseCPlusPlus ? "" : "_env, ") + + (mUseCPlusPlus ? "" : "_env, ") + jfunc.getArgName(idx) + "_ref, (jboolean *)0);"); out.println(indent + @@ -917,7 +915,7 @@ public class JniCodeEmitter implements CodeEmitter { out.println(indent + "if (" + cname + "_buf) {"); out.print(indent); } - + out.println(indent + cname + " = (" + @@ -950,10 +948,10 @@ public class JniCodeEmitter implements CodeEmitter { name.substring(1, name.length()); out.print("ctx->procs."); } - + out.print(name + (isPointerFunc ? "Bounds" : "") + "("); - numArgs = cfunc.getNumArgs(); + numArgs = cfunc.getNumArgs(); if (numArgs == 0) { if (mUseContextPointer) { out.println("ctx);"); @@ -1006,7 +1004,7 @@ public class JniCodeEmitter implements CodeEmitter { int cIndex = jfunc.getArgCIndex(idx); if (jfunc.getArgType(idx).isArray()) { - + // If the argument is 'const', GL will not write to it. // In this case, we can use the 'JNI_ABORT' flag to avoid // the need to write back to the Java array @@ -1015,7 +1013,7 @@ public class JniCodeEmitter implements CodeEmitter { out.println(indent + indent + (mUseCPlusPlus ? "_env" : "(*_env)") + "->ReleasePrimitiveArrayCritical(" + - (mUseCPlusPlus ? "" : "_env, ") + + (mUseCPlusPlus ? "" : "_env, ") + jfunc.getArgName(idx) + "_ref, " + cfunc.getArgName(cIndex) + "_base,"); @@ -1070,7 +1068,7 @@ public class JniCodeEmitter implements CodeEmitter { mCStream.println("};"); mCStream.println(); - + mCStream.println("int register_com_google_android_gles_jni_GLImpl(JNIEnv *_env)"); mCStream.println("{"); -- cgit v1.1 From ffac1eff58b59ffdaca1c4a296fa7dead51c487b Mon Sep 17 00:00:00 2001 From: Jack Palevich Date: Tue, 14 Apr 2009 19:00:09 -0700 Subject: Improve glgen + gen script is really a bash script rather than a sh script, so declare that to be true. (For example, it uses pushd, which is a part of bash, but not a part of sh. Not sure how this worked until now. Possibly gen was only run in environments where /bin/sh was really bash. + Check the results of the java compile of the code generator, and abort the script if the compile fails. + Turn on the bash shell option that guards against using uninitialized variables in the script. + Remove the generated class files. Refactor JniCodeEmitter into two classes: a general-purpose JniCodeEmitter and a specific Jsr239CodeEmitter. The hope is to use JniCodeEmitter as a base for emitting static OpenGL ES bindings. --- opengl/tools/glgen/gen | 11 +- opengl/tools/glgen/src/GenerateGL.java | 3 +- opengl/tools/glgen/src/JniCodeEmitter.java | 479 +++++++++++--------------- opengl/tools/glgen/src/Jsr239CodeEmitter.java | 74 ++++ 4 files changed, 284 insertions(+), 283 deletions(-) create mode 100644 opengl/tools/glgen/src/Jsr239CodeEmitter.java diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen index c060040..25e9a09 100755 --- a/opengl/tools/glgen/gen +++ b/opengl/tools/glgen/gen @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash +set -u rm -rf out generated mkdir out @@ -12,12 +13,18 @@ echo "public interface Canvas {}" >> out/android/graphics/Canvas.java GLFILE=out/javax/microedition/khronos/opengles/GL.java cp stubs/GLHeader.java-if $GLFILE -GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JType.java JniCodeEmitter.java ParameterChecker.java" +GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java" pushd src > /dev/null javac ${GLGEN_FILES} +JAVAC_RESULT=$? +if [ $JAVAC_RESULT -ne 0 ]; then + echo "Could not compile glgen." + exit $JAVAC_RESULT +fi popd > /dev/null java -classpath src GenerateGL -c glspec-1.0 glspec-1.0ext glspec-1.1 glspec-1.1ext glspec-1.1extpack glspec-checks +rm src/*.class pushd out > /dev/null mkdir classes diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java index afe1bb6..accb16e 100644 --- a/opengl/tools/glgen/src/GenerateGL.java +++ b/opengl/tools/glgen/src/GenerateGL.java @@ -23,7 +23,6 @@ public class GenerateGL { PrintStream glImplStream, PrintStream cStream) throws Exception { String s = null; - int counter = 0; while ((s = specReader.readLine()) != null) { if (s.trim().startsWith("//")) { continue; @@ -120,7 +119,7 @@ public class GenerateGL { ParameterChecker checker = new ParameterChecker(checksReader); CodeEmitter emitter = - new JniCodeEmitter(classPathName, + new Jsr239CodeEmitter(classPathName, checker, gl10Stream, gl10ExtStream, gl11Stream, gl11ExtStream, gl11ExtPackStream, diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java index 2a8bcbb..9d37607 100644 --- a/opengl/tools/glgen/src/JniCodeEmitter.java +++ b/opengl/tools/glgen/src/JniCodeEmitter.java @@ -4,90 +4,47 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; -/** - * Emits a Java interface and Java & C implementation for a C function. - * - *

The Java interface will have Buffer and array variants for functions that - * have a typed pointer argument. The array variant will convert a single " *data" - * argument to a pair of arguments "[] data, int offset". - */ -public class JniCodeEmitter implements CodeEmitter { - - // If true, use C++ style for calling through a JNIEnv *: - // env->Func(...) - // If false, use C style: - // (*env)->Func(env, ...) - static final boolean mUseCPlusPlus = true; - - boolean mUseContextPointer = true; - - String mClassPathName; - - ParameterChecker mChecker; - PrintStream mJava10InterfaceStream; - PrintStream mJava10ExtInterfaceStream; - PrintStream mJava11InterfaceStream; - PrintStream mJava11ExtInterfaceStream; - PrintStream mJava11ExtPackInterfaceStream; - PrintStream mJavaImplStream; - PrintStream mCStream; - - PrintStream mJavaInterfaceStream; - - List nativeRegistrations = new ArrayList(); +public class JniCodeEmitter { + static final boolean mUseCPlusPlus = true; + protected boolean mUseContextPointer = true; + protected String mClassPathName; + protected ParameterChecker mChecker; + protected List nativeRegistrations = new ArrayList(); boolean needsExit; - - static String indent = " "; - + protected static String indent = " "; HashSet mFunctionsEmitted = new HashSet(); - /** - * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions - * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions - * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions - * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions - * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions - * @param javaImplStream the PrintStream to which to emit the Java implementation - * @param cStream the PrintStream to which to emit the C implementation - */ - public JniCodeEmitter(String classPathName, - ParameterChecker checker, - PrintStream java10InterfaceStream, - PrintStream java10ExtInterfaceStream, - PrintStream java11InterfaceStream, - PrintStream java11ExtInterfaceStream, - PrintStream java11ExtPackInterfaceStream, - PrintStream javaImplStream, - PrintStream cStream, - boolean useContextPointer) { - mClassPathName = classPathName; - mChecker = checker; - mJava10InterfaceStream = java10InterfaceStream; - mJava10ExtInterfaceStream = java10ExtInterfaceStream; - mJava11InterfaceStream = java11InterfaceStream; - mJava11ExtInterfaceStream = java11ExtInterfaceStream; - mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream; - mJavaImplStream = javaImplStream; - mCStream = cStream; - mUseContextPointer = useContextPointer; - } + public static String getJniName(JType jType) { + String jniName = ""; + if (jType.isClass()) { + return "L" + jType.getBaseType() + ";"; + } else if (jType.isArray()) { + jniName = "["; + } - public void setVersion(int version, boolean ext, boolean pack) { - if (version == 0) { - mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream : - mJava10InterfaceStream; - } else if (version == 1) { - mJavaInterfaceStream = ext ? - (pack ? mJava11ExtPackInterfaceStream : - mJava11ExtInterfaceStream) : - mJava11InterfaceStream; - } else { - throw new RuntimeException("Bad version: " + version); + String baseType = jType.getBaseType(); + if (baseType.equals("int")) { + jniName += "I"; + } else if (baseType.equals("float")) { + jniName += "F"; + } else if (baseType.equals("boolean")) { + jniName += "Z"; + } else if (baseType.equals("short")) { + jniName += "S"; + } else if (baseType.equals("long")) { + jniName += "L"; + } else if (baseType.equals("byte")) { + jniName += "B"; } + return jniName; } - public void emitCode(CFunc cfunc, String original) { + + public void emitCode(CFunc cfunc, String original, + PrintStream javaInterfaceStream, + PrintStream javaImplStream, + PrintStream cStream) { JFunc jfunc; String signature; boolean duplicate; @@ -107,12 +64,12 @@ public class JniCodeEmitter implements CodeEmitter { } if (!duplicate) { - emitNativeDeclaration(jfunc, mJavaImplStream); - emitJavaCode(jfunc, mJavaImplStream); + emitNativeDeclaration(jfunc, javaImplStream); + emitJavaCode(jfunc, javaImplStream); } - emitJavaInterfaceCode(jfunc, mJavaInterfaceStream); + emitJavaInterfaceCode(jfunc, javaInterfaceStream); if (!duplicate) { - emitJniCode(jfunc, mCStream); + emitJniCode(jfunc, cStream); } } @@ -127,12 +84,12 @@ public class JniCodeEmitter implements CodeEmitter { } if (!duplicate) { - emitNativeDeclaration(jfunc, mJavaImplStream); + emitNativeDeclaration(jfunc, javaImplStream); } - emitJavaInterfaceCode(jfunc, mJavaInterfaceStream); + emitJavaInterfaceCode(jfunc, javaInterfaceStream); if (!duplicate) { - emitJavaCode(jfunc, mJavaImplStream); - emitJniCode(jfunc, mCStream); + emitJavaCode(jfunc, javaImplStream); + emitJniCode(jfunc, cStream); } } @@ -151,7 +108,7 @@ public class JniCodeEmitter implements CodeEmitter { emitFunction(jfunc, out, false, false); } - void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray ) { + void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) { boolean isVoid = jfunc.getType().isVoid(); boolean isPointerFunc = jfunc.getName().endsWith("Pointer") && jfunc.getCFunc().hasPointerArg(); @@ -194,37 +151,36 @@ public class JniCodeEmitter implements CodeEmitter { out.println(iii + ");"); } - void printIfcheckPostamble(PrintStream out, boolean isBuffer, - boolean emitExceptionCheck, String iii) { - printIfcheckPostamble(out, isBuffer, emitExceptionCheck, - "offset", "_remaining", iii); - } + void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck, + String iii) { + printIfcheckPostamble(out, isBuffer, emitExceptionCheck, + "offset", "_remaining", iii); + } - void printIfcheckPostamble(PrintStream out, boolean isBuffer, - boolean emitExceptionCheck, - String offset, String remaining, String iii) { - out.println(iii + " default:"); - out.println(iii + " _needed = 0;"); - out.println(iii + " break;"); - out.println(iii + "}"); + void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck, + String offset, String remaining, String iii) { + out.println(iii + " default:"); + out.println(iii + " _needed = 0;"); + out.println(iii + " break;"); + out.println(iii + "}"); - out.println(iii + "if (" + remaining + " < _needed) {"); - if (emitExceptionCheck) { - out.println(iii + indent + "_exception = 1;"); - } - out.println(iii + indent + - (mUseCPlusPlus ? "_env" : "(*_env)") + - "->ThrowNew(" + - (mUseCPlusPlus ? "" : "_env, ") + - "IAEClass, " + - "\"" + - (isBuffer ? - "remaining()" : "length - " + offset) + - " < needed\");"); - out.println(iii + indent + "goto exit;"); - needsExit = true; - out.println(iii + "}"); - } + out.println(iii + "if (" + remaining + " < _needed) {"); + if (emitExceptionCheck) { + out.println(iii + indent + "_exception = 1;"); + } + out.println(iii + indent + + (mUseCPlusPlus ? "_env" : "(*_env)") + + "->ThrowNew(" + + (mUseCPlusPlus ? "" : "_env, ") + + "IAEClass, " + + "\"" + + (isBuffer ? + "remaining()" : "length - " + offset) + + " < needed\");"); + out.println(iii + indent + "goto exit;"); + needsExit = true; + out.println(iii + "}"); + } boolean isNullAllowed(CFunc cfunc) { String[] checks = mChecker.getChecks(cfunc.getName()); @@ -310,115 +266,106 @@ public class JniCodeEmitter implements CodeEmitter { } void emitNativeBoundsChecks(CFunc cfunc, String cname, PrintStream out, - boolean isBuffer, boolean emitExceptionCheck, - String offset, String remaining, String iii) { - CType returnType = cfunc.getType(); - boolean isVoid = returnType.isVoid(); - - String[] checks = mChecker.getChecks(cfunc.getName()); - String checkVar; - String retval = getErrorReturnValue(cfunc); - - boolean lastWasIfcheck = false; - - int index = 1; - if (checks != null) { - boolean remainingDeclared = false; - boolean nullCheckDeclared = false; - boolean offsetChecked = false; - while (index < checks.length) { - if (checks[index].startsWith("check")) { - if (lastWasIfcheck) { - printIfcheckPostamble(out, isBuffer, emitExceptionCheck, - offset, remaining, iii); - } - lastWasIfcheck = false; - if (cname != null && !cname.equals(checks[index + 1])) { - index += 3; - continue; - } - out.println(iii + "if (" + remaining + " < " + - checks[index + 2] + - ") {"); - if (emitExceptionCheck) { - out.println(iii + indent + "_exception = 1;"); + boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) { + + String[] checks = mChecker.getChecks(cfunc.getName()); + + boolean lastWasIfcheck = false; + + int index = 1; + if (checks != null) { + while (index < checks.length) { + if (checks[index].startsWith("check")) { + if (lastWasIfcheck) { + printIfcheckPostamble(out, isBuffer, emitExceptionCheck, + offset, remaining, iii); + } + lastWasIfcheck = false; + if (cname != null && !cname.equals(checks[index + 1])) { + index += 3; + continue; + } + out.println(iii + "if (" + remaining + " < " + + checks[index + 2] + + ") {"); + if (emitExceptionCheck) { + out.println(iii + indent + "_exception = 1;"); + } + String exceptionClassName = "IAEClass"; + // If the "check" keyword was of the form + // "check_", use the class name in the + // exception to be thrown + int underscore = checks[index].indexOf('_'); + if (underscore >= 0) { + exceptionClassName = checks[index].substring(underscore + 1) + "Class"; } - String exceptionClassName = "IAEClass"; - // If the "check" keyword was of the form - // "check_", use the class name in the - // exception to be thrown - int underscore = checks[index].indexOf('_'); - if (underscore >= 0) { - exceptionClassName = checks[index].substring(underscore + 1) + "Class"; - } - out.println(iii + indent + - (mUseCPlusPlus ? "_env" : "(*_env)") + - "->ThrowNew(" + - (mUseCPlusPlus ? "" : "_env, ") + - exceptionClassName + ", " + - "\"" + - (isBuffer ? - "remaining()" : "length - " + offset) + - " < " + checks[index + 2] + - "\");"); - - out.println(iii + indent + "goto exit;"); - needsExit = true; - out.println(iii + "}"); - - index += 3; - } else if (checks[index].equals("ifcheck")) { - String[] matches = checks[index + 4].split(","); - - if (!lastWasIfcheck) { - out.println(iii + "int _needed;"); - out.println(iii + - "switch (" + - checks[index + 3] + - ") {"); + out.println(iii + indent + + (mUseCPlusPlus ? "_env" : "(*_env)") + + "->ThrowNew(" + + (mUseCPlusPlus ? "" : "_env, ") + + exceptionClassName + ", " + + "\"" + + (isBuffer ? + "remaining()" : "length - " + offset) + + " < " + checks[index + 2] + + "\");"); + + out.println(iii + indent + "goto exit;"); + needsExit = true; + out.println(iii + "}"); + + index += 3; + } else if (checks[index].equals("ifcheck")) { + String[] matches = checks[index + 4].split(","); + + if (!lastWasIfcheck) { + out.println(iii + "int _needed;"); + out.println(iii + + "switch (" + + checks[index + 3] + + ") {"); + } + + for (int i = 0; i < matches.length; i++) { + out.println("#if defined(" + matches[i] + ")"); + out.println(iii + + " case " + + matches[i] + + ":"); + out.println("#endif // defined(" + matches[i] + ")"); + } + out.println(iii + + " _needed = " + + checks[index + 2] + + ";"); + out.println(iii + + " break;"); + + lastWasIfcheck = true; + index += 5; + } else if (checks[index].equals("return")) { + // ignore + index += 2; + } else if (checks[index].equals("unsupported")) { + // ignore + index += 1; + } else if (checks[index].equals("nullAllowed")) { + // ignore + index += 1; + } else { + System.out.println("Error: unknown keyword \"" + + checks[index] + "\""); + System.exit(0); + } } + } - for (int i = 0; i < matches.length; i++) { - out.println("#if defined(" + matches[i] + ")"); - out.println(iii + - " case " + - matches[i] + - ":"); - out.println("#endif // defined(" + matches[i] + ")"); - } - out.println(iii + - " _needed = " + - checks[index + 2] + - ";"); - out.println(iii + - " break;"); - - lastWasIfcheck = true; - index += 5; - } else if (checks[index].equals("return")) { - // ignore - index += 2; - } else if (checks[index].equals("unsupported")) { - // ignore - index += 1; - } else if (checks[index].equals("nullAllowed")) { - // ignore - index += 1; - } else { - System.out.println("Error: unknown keyword \"" + - checks[index] + "\""); - System.exit(0); + if (lastWasIfcheck) { + printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii); } } - } - - if (lastWasIfcheck) { - printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii); - } - } - boolean hasNonConstArg(JFunc jfunc, CFunc cfunc, - List nonPrimitiveArgs) { + boolean hasNonConstArg(JFunc jfunc, CFunc cfunc, List nonPrimitiveArgs) { if (nonPrimitiveArgs.size() > 0) { for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) { int idx = nonPrimitiveArgs.get(i).intValue(); @@ -447,9 +394,7 @@ public class JniCodeEmitter implements CodeEmitter { * if interfaceDecl: public func(args); * if !interfaceDecl: public func(args) { body } */ - void emitFunction(JFunc jfunc, - PrintStream out, - boolean nativeDecl, boolean interfaceDecl) { + void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) { boolean isPointerFunc = jfunc.getName().endsWith("Pointer") && jfunc.getCFunc().hasPointerArg(); @@ -559,29 +504,43 @@ public class JniCodeEmitter implements CodeEmitter { out.println(); } - public static String getJniName(JType jType) { - String jniName = ""; - if (jType.isClass()) { - return "L" + jType.getBaseType() + ";"; - } else if (jType.isArray()) { - jniName = "["; - } + public void addNativeRegistration(String s) { + nativeRegistrations.add(s); + } - String baseType = jType.getBaseType(); - if (baseType.equals("int")) { - jniName += "I"; - } else if (baseType.equals("float")) { - jniName += "F"; - } else if (baseType.equals("boolean")) { - jniName += "Z"; - } else if (baseType.equals("short")) { - jniName += "S"; - } else if (baseType.equals("long")) { - jniName += "L"; - } else if (baseType.equals("byte")) { - jniName += "B"; + public void emitNativeRegistration(PrintStream cStream) { + cStream.println("static const char *classPathName = \"" + + mClassPathName + + "\";"); + cStream.println(); + + cStream.println("static JNINativeMethod methods[] = {"); + + cStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },"); + + Iterator i = nativeRegistrations.iterator(); + while (i.hasNext()) { + cStream.println(i.next()); } - return jniName; + + cStream.println("};"); + cStream.println(); + + + cStream.println("int register_com_google_android_gles_jni_GLImpl(JNIEnv *_env)"); + cStream.println("{"); + cStream.println(indent + + "int err;"); + + cStream.println(indent + + "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));"); + + cStream.println(indent + "return err;"); + cStream.println("}"); + } + + public JniCodeEmitter() { + super(); } String getJniType(JType jType) { @@ -721,8 +680,6 @@ public class JniCodeEmitter implements CodeEmitter { int numBuffers = 0; for (int i = 0; i < nonPrimitiveArgs.size(); i++) { int idx = nonPrimitiveArgs.get(i).intValue(); - int cIndex = jfunc.getArgCIndex(idx); - String cname = cfunc.getArgName(cIndex); if (jfunc.getArgType(idx).isArray()) { ++numArrays; } @@ -832,8 +789,6 @@ public class JniCodeEmitter implements CodeEmitter { out.println(); } - String retval = isVoid ? "" : " _returnValue"; - // Emit 'GetPrimitiveArrayCritical' for arrays // Emit 'GetPointer' calls for Buffer pointers int bufArgIdx = 0; @@ -1047,38 +1002,4 @@ public class JniCodeEmitter implements CodeEmitter { out.println(); } - public void addNativeRegistration(String s) { - nativeRegistrations.add(s); - } - - public void emitNativeRegistration() { - mCStream.println("static const char *classPathName = \"" + - mClassPathName + - "\";"); - mCStream.println(); - - mCStream.println("static JNINativeMethod methods[] = {"); - - mCStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },"); - - Iterator i = nativeRegistrations.iterator(); - while (i.hasNext()) { - mCStream.println(i.next()); - } - - mCStream.println("};"); - mCStream.println(); - - - mCStream.println("int register_com_google_android_gles_jni_GLImpl(JNIEnv *_env)"); - mCStream.println("{"); - mCStream.println(indent + - "int err;"); - - mCStream.println(indent + - "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));"); - - mCStream.println(indent + "return err;"); - mCStream.println("}"); - } } diff --git a/opengl/tools/glgen/src/Jsr239CodeEmitter.java b/opengl/tools/glgen/src/Jsr239CodeEmitter.java new file mode 100644 index 0000000..eff0447 --- /dev/null +++ b/opengl/tools/glgen/src/Jsr239CodeEmitter.java @@ -0,0 +1,74 @@ +import java.io.PrintStream; + +/** + * Emits a Java interface and Java & C implementation for a C function. + * + *

The Java interface will have Buffer and array variants for functions that + * have a typed pointer argument. The array variant will convert a single " *data" + * argument to a pair of arguments "[] data, int offset". + */ +public class Jsr239CodeEmitter extends JniCodeEmitter implements CodeEmitter { + + PrintStream mJava10InterfaceStream; + PrintStream mJava10ExtInterfaceStream; + PrintStream mJava11InterfaceStream; + PrintStream mJava11ExtInterfaceStream; + PrintStream mJava11ExtPackInterfaceStream; + PrintStream mJavaImplStream; + PrintStream mCStream; + + PrintStream mJavaInterfaceStream; + + /** + * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions + * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions + * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions + * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions + * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions + * @param javaImplStream the PrintStream to which to emit the Java implementation + * @param cStream the PrintStream to which to emit the C implementation + */ + public Jsr239CodeEmitter(String classPathName, + ParameterChecker checker, + PrintStream java10InterfaceStream, + PrintStream java10ExtInterfaceStream, + PrintStream java11InterfaceStream, + PrintStream java11ExtInterfaceStream, + PrintStream java11ExtPackInterfaceStream, + PrintStream javaImplStream, + PrintStream cStream, + boolean useContextPointer) { + mClassPathName = classPathName; + mChecker = checker; + mJava10InterfaceStream = java10InterfaceStream; + mJava10ExtInterfaceStream = java10ExtInterfaceStream; + mJava11InterfaceStream = java11InterfaceStream; + mJava11ExtInterfaceStream = java11ExtInterfaceStream; + mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream; + mJavaImplStream = javaImplStream; + mCStream = cStream; + mUseContextPointer = useContextPointer; + } + + public void setVersion(int version, boolean ext, boolean pack) { + if (version == 0) { + mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream : + mJava10InterfaceStream; + } else if (version == 1) { + mJavaInterfaceStream = ext ? + (pack ? mJava11ExtPackInterfaceStream : + mJava11ExtInterfaceStream) : + mJava11InterfaceStream; + } else { + throw new RuntimeException("Bad version: " + version); + } + } + + public void emitCode(CFunc cfunc, String original) { + emitCode(cfunc, original, mJavaInterfaceStream, mJavaImplStream, mCStream); + } + + public void emitNativeRegistration() { + emitNativeRegistration(mCStream); + } +} -- cgit v1.1 From 427f585f726af6e3bd1fb835f26b2af9f609c483 Mon Sep 17 00:00:00 2001 From: Jack Palevich Date: Wed, 15 Apr 2009 19:13:17 -0700 Subject: Add an Android-specific static OpenGL ES 1.1 Java API. This change adds four new public classes that expose a static OpenGL ES 1.1 API: android.opengl.GLES10 android.opengl.GLES10Ext android.opengl.GLES11 android.opengl.GLES11Ext Benefits: + The static API is slightly faster (1% to 4%) than the existing Interface based JSR239 API. + The static API is similar to the C API, which should make it easier to import C-based example code. + The static API provides a clear path for adding new OpenGL ES 1.1 extensions and OpenGL ES 2.0 APIs, neither of which currently have a JSR standard. Example: import static android.opengl.GLES10.*; ... glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); Note that it is possible to mix-and-match calls to both the static and JSR239 APIs. This works because neither API maintains state. They both call through to the same underlying C OpenGL ES APIs. Implementation details: This change enhances the "glgen" "gen" script to generate both the original JSR239 and new static OpenGL ES APIs. The contents of the generated JSR239 classes remained the same as before, so there is no need to check in new versions of the generated JSR239 classes. As part of this work the gen script was updated to be somewhat more robust, and to work with git instead of perforce. The script prints out commands to git add the generated files, but leaves it up to the script runner to actually execute those commands. --- opengl/tools/glgen/.gitignore | 2 + opengl/tools/glgen/gen | 140 +++++------ opengl/tools/glgen/glspec-1.0 | 106 -------- opengl/tools/glgen/glspec-1.0ext | 1 - opengl/tools/glgen/glspec-1.1 | 42 ---- opengl/tools/glgen/glspec-1.1ext | 16 -- opengl/tools/glgen/glspec-1.1extpack | 38 --- opengl/tools/glgen/glspec-checks | 59 ----- opengl/tools/glgen/specs/gles11/GLES10.spec | 106 ++++++++ opengl/tools/glgen/specs/gles11/GLES10Ext.spec | 1 + opengl/tools/glgen/specs/gles11/GLES11.spec | 44 ++++ opengl/tools/glgen/specs/gles11/GLES11Ext.spec | 90 +++++++ opengl/tools/glgen/specs/gles11/checks.spec | 145 +++++++++++ opengl/tools/glgen/specs/jsr239/glspec-1.0 | 106 ++++++++ opengl/tools/glgen/specs/jsr239/glspec-1.0ext | 1 + opengl/tools/glgen/specs/jsr239/glspec-1.1 | 42 ++++ opengl/tools/glgen/specs/jsr239/glspec-1.1ext | 16 ++ opengl/tools/glgen/specs/jsr239/glspec-1.1extpack | 38 +++ opengl/tools/glgen/specs/jsr239/glspec-checks | 59 +++++ opengl/tools/glgen/src/GLESCodeEmitter.java | 40 +++ opengl/tools/glgen/src/GenerateGL.java | 24 +- opengl/tools/glgen/src/GenerateGLES.java | 99 ++++++++ opengl/tools/glgen/src/JFunc.java | 51 ++-- opengl/tools/glgen/src/JType.java | 2 + opengl/tools/glgen/src/JniCodeEmitter.java | 24 +- opengl/tools/glgen/src/Jsr239CodeEmitter.java | 2 +- opengl/tools/glgen/stubs/GL10ExtHeader.java-if | 22 -- opengl/tools/glgen/stubs/GL10Header.java-if | 259 -------------------- opengl/tools/glgen/stubs/GL11ExtHeader.java-if | 40 --- .../glgen/stubs/GL11ExtensionPackHeader.java-if | 108 -------- opengl/tools/glgen/stubs/GL11Header.java-if | 145 ----------- opengl/tools/glgen/stubs/GL11ImplHeader.java-impl | 30 --- opengl/tools/glgen/stubs/GLCHeader.cpp | 129 ---------- opengl/tools/glgen/stubs/GLHeader.java-if | 22 -- opengl/tools/glgen/stubs/GLImplHeader.java-impl | 48 ---- opengl/tools/glgen/stubs/glGetString.cpp | 10 - opengl/tools/glgen/stubs/glGetString.java-10-if | 4 - opengl/tools/glgen/stubs/glGetString.java-if | 4 - opengl/tools/glgen/stubs/glGetString.java-impl | 16 -- opengl/tools/glgen/stubs/glGetString.nativeReg | 1 - .../glgen/stubs/gles11/GLES10ExtHeader.java-if | 26 ++ .../tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp | 129 ++++++++++ .../tools/glgen/stubs/gles11/GLES10Header.java-if | 271 +++++++++++++++++++++ opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp | 129 ++++++++++ .../glgen/stubs/gles11/GLES11ExtHeader.java-if | 130 ++++++++++ .../tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp | 129 ++++++++++ .../tools/glgen/stubs/gles11/GLES11Header.java-if | 151 ++++++++++++ opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp | 129 ++++++++++ opengl/tools/glgen/stubs/gles11/glGetString.cpp | 11 + opengl/tools/glgen/stubs/gles11/glGetString.java | 16 ++ .../tools/glgen/stubs/gles11/glGetString.nativeReg | 1 + .../tools/glgen/stubs/jsr239/GL10ExtHeader.java-if | 22 ++ opengl/tools/glgen/stubs/jsr239/GL10Header.java-if | 259 ++++++++++++++++++++ .../tools/glgen/stubs/jsr239/GL11ExtHeader.java-if | 40 +++ .../stubs/jsr239/GL11ExtensionPackHeader.java-if | 108 ++++++++ opengl/tools/glgen/stubs/jsr239/GL11Header.java-if | 145 +++++++++++ .../glgen/stubs/jsr239/GL11ImplHeader.java-impl | 30 +++ opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp | 129 ++++++++++ opengl/tools/glgen/stubs/jsr239/GLHeader.java-if | 22 ++ .../glgen/stubs/jsr239/GLImplHeader.java-impl | 48 ++++ opengl/tools/glgen/stubs/jsr239/glGetString.cpp | 11 + .../glgen/stubs/jsr239/glGetString.java-10-if | 4 + .../tools/glgen/stubs/jsr239/glGetString.java-if | 4 + .../tools/glgen/stubs/jsr239/glGetString.java-impl | 16 ++ .../tools/glgen/stubs/jsr239/glGetString.nativeReg | 1 + 65 files changed, 2872 insertions(+), 1221 deletions(-) create mode 100644 opengl/tools/glgen/.gitignore delete mode 100644 opengl/tools/glgen/glspec-1.0 delete mode 100644 opengl/tools/glgen/glspec-1.0ext delete mode 100644 opengl/tools/glgen/glspec-1.1 delete mode 100644 opengl/tools/glgen/glspec-1.1ext delete mode 100644 opengl/tools/glgen/glspec-1.1extpack delete mode 100644 opengl/tools/glgen/glspec-checks create mode 100644 opengl/tools/glgen/specs/gles11/GLES10.spec create mode 100644 opengl/tools/glgen/specs/gles11/GLES10Ext.spec create mode 100644 opengl/tools/glgen/specs/gles11/GLES11.spec create mode 100644 opengl/tools/glgen/specs/gles11/GLES11Ext.spec create mode 100644 opengl/tools/glgen/specs/gles11/checks.spec create mode 100644 opengl/tools/glgen/specs/jsr239/glspec-1.0 create mode 100644 opengl/tools/glgen/specs/jsr239/glspec-1.0ext create mode 100644 opengl/tools/glgen/specs/jsr239/glspec-1.1 create mode 100644 opengl/tools/glgen/specs/jsr239/glspec-1.1ext create mode 100644 opengl/tools/glgen/specs/jsr239/glspec-1.1extpack create mode 100644 opengl/tools/glgen/specs/jsr239/glspec-checks create mode 100644 opengl/tools/glgen/src/GLESCodeEmitter.java create mode 100644 opengl/tools/glgen/src/GenerateGLES.java delete mode 100644 opengl/tools/glgen/stubs/GL10ExtHeader.java-if delete mode 100644 opengl/tools/glgen/stubs/GL10Header.java-if delete mode 100644 opengl/tools/glgen/stubs/GL11ExtHeader.java-if delete mode 100644 opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if delete mode 100644 opengl/tools/glgen/stubs/GL11Header.java-if delete mode 100644 opengl/tools/glgen/stubs/GL11ImplHeader.java-impl delete mode 100644 opengl/tools/glgen/stubs/GLCHeader.cpp delete mode 100644 opengl/tools/glgen/stubs/GLHeader.java-if delete mode 100644 opengl/tools/glgen/stubs/GLImplHeader.java-impl delete mode 100644 opengl/tools/glgen/stubs/glGetString.cpp delete mode 100644 opengl/tools/glgen/stubs/glGetString.java-10-if delete mode 100644 opengl/tools/glgen/stubs/glGetString.java-if delete mode 100644 opengl/tools/glgen/stubs/glGetString.java-impl delete mode 100644 opengl/tools/glgen/stubs/glGetString.nativeReg create mode 100644 opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if create mode 100644 opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp create mode 100644 opengl/tools/glgen/stubs/gles11/GLES10Header.java-if create mode 100644 opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp create mode 100644 opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if create mode 100644 opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp create mode 100644 opengl/tools/glgen/stubs/gles11/GLES11Header.java-if create mode 100644 opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp create mode 100644 opengl/tools/glgen/stubs/gles11/glGetString.cpp create mode 100644 opengl/tools/glgen/stubs/gles11/glGetString.java create mode 100644 opengl/tools/glgen/stubs/gles11/glGetString.nativeReg create mode 100644 opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if create mode 100644 opengl/tools/glgen/stubs/jsr239/GL10Header.java-if create mode 100644 opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if create mode 100644 opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if create mode 100644 opengl/tools/glgen/stubs/jsr239/GL11Header.java-if create mode 100644 opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl create mode 100644 opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp create mode 100644 opengl/tools/glgen/stubs/jsr239/GLHeader.java-if create mode 100644 opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl create mode 100644 opengl/tools/glgen/stubs/jsr239/glGetString.cpp create mode 100644 opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if create mode 100644 opengl/tools/glgen/stubs/jsr239/glGetString.java-if create mode 100644 opengl/tools/glgen/stubs/jsr239/glGetString.java-impl create mode 100644 opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg diff --git a/opengl/tools/glgen/.gitignore b/opengl/tools/glgen/.gitignore new file mode 100644 index 0000000..007ec65 --- /dev/null +++ b/opengl/tools/glgen/.gitignore @@ -0,0 +1,2 @@ +generated +out diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen index 25e9a09..011a6ed 100755 --- a/opengl/tools/glgen/gen +++ b/opengl/tools/glgen/gen @@ -1,19 +1,21 @@ #!/bin/bash set -u +set -e rm -rf out generated mkdir out mkdir -p out/javax/microedition/khronos/opengles mkdir -p out/com/google/android/gles_jni mkdir -p out/android/graphics +mkdir -p out/android/opengl echo "package android.graphics;" > out/android/graphics/Canvas.java echo "public interface Canvas {}" >> out/android/graphics/Canvas.java GLFILE=out/javax/microedition/khronos/opengles/GL.java -cp stubs/GLHeader.java-if $GLFILE +cp stubs/jsr239/GLHeader.java-if $GLFILE -GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java" +GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java GenerateGLES.java GLESCodeEmitter.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java" pushd src > /dev/null javac ${GLGEN_FILES} @@ -23,13 +25,34 @@ if [ $JAVAC_RESULT -ne 0 ]; then exit $JAVAC_RESULT fi popd > /dev/null -java -classpath src GenerateGL -c glspec-1.0 glspec-1.0ext glspec-1.1 glspec-1.1ext glspec-1.1extpack glspec-checks + +echo "Generating JSR239-like APIs" +java -classpath src GenerateGL -c specs/jsr239/glspec-1.0 specs/jsr239/glspec-1.0ext specs/jsr239/glspec-1.1 specs/jsr239/glspec-1.1ext specs/jsr239/glspec-1.1extpack specs/jsr239/glspec-checks +JAVA_RESULT=$? +if [ $JAVA_RESULT -ne 0 ]; then + echo "Could not run GenerateGL." + exit $JAVA_RESULT +fi + +echo "Generating static OpenGLES 1.1 bindings" +java -classpath src GenerateGLES +JAVA_RESULT=$? +if [ $JAVA_RESULT -ne 0 ]; then + echo "Could not run GenerateGLES." + exit $JAVA_RESULT +fi + rm src/*.class pushd out > /dev/null mkdir classes -javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java +javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java android/opengl/GLES10.java android/opengl/GLES10Ext.java android/opengl/GLES11.java android/opengl/GLES11Ext.java popd > /dev/null +JAVA_RESULT=$? +if [ $JAVA_RESULT -ne 0 ]; then + echo "Could not compile generated classes." + exit $JAVA_RESULT +fi rm -rf generated mkdir -p generated/C @@ -37,81 +60,44 @@ cp out/com_google_android_gles_jni_GLImpl.cpp generated/C cp -r out/com generated cp -r out/javax generated +cp out/android_opengl_*.cpp generated/C +mkdir -p generated/android/opengl +cp -r out/android/opengl generated/android + rm -rf out KEEP_GENERATED=0 - -# com_google_android_gles_jni_GLImpl.cpp -if cmp ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp generated/C/com_google_android_gles_jni_GLImpl.cpp ; then -echo com_google_android_gles_jni_GLImpl.cpp unchanged -else -echo Please p4 edit ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp -echo Please cp generated/C/com_google_android_gles_jni_GLImpl.cpp ../../../../../frameworks/base/core/jni -KEEP_GENERATED=1 -fi - -# GLImpl.java -if cmp ../../java/com/google/android/gles_jni/GLImpl.java generated/com/google/android/gles_jni/GLImpl.java ; then -echo GLImpl.java unchanged -else -echo Please edit ../../java/com/google/android/gles_jni/GLImpl.java -echo Please cp generated/com/google/android/gles_jni/GLImpl.java ../../java/com/google/android/gles_jni -KEEP_GENERATED=1 -fi - -# GL.java -if cmp ../../java/javax/microedition/khronos/opengles/GL.java generated/javax/microedition/khronos/opengles/GL.java ; then -echo GL.java unchanged -else -echo Please edit ../../java/javax/microedition/khronos/opengles/GL.java -echo Please cp generated/javax/microedition/khronos/opengles/GL.java ../../java/javax/microedition/khronos/opengles/GL.java -KEEP_GENERATED=1 -fi - -# GL10.java -if cmp ../../java/javax/microedition/khronos/opengles/GL10.java generated/javax/microedition/khronos/opengles/GL10.java ; then -echo GL10.java unchanged -else -echo Please edit ../../java/javax/microedition/khronos/opengles/GL10.java -echo Please cp generated/javax/microedition/khronos/opengles/GL10.java ../../java/javax/microedition/khronos/opengles/GL10.java -KEEP_GENERATED=1 -fi - -# GL10Ext.java -if cmp ../../java/javax/microedition/khronos/opengles/GL10Ext.java generated/javax/microedition/khronos/opengles/GL10Ext.java ; then -echo GL10Ext.java unchanged -else -echo Please edit ../../java/javax/microedition/khronos/opengles/GL10Ext.java -echo Please cp generated/javax/microedition/khronos/opengles/GL10Ext.java ../../java/javax/microedition/khronos/opengles/GL10Ext.java -KEEP_GENERATED=1 -fi - -# GL11.java -if cmp ../../java/javax/microedition/khronos/opengles/GL11.java generated/javax/microedition/khronos/opengles/GL11.java ; then -echo GL11.java unchanged -else -echo Please edit ../../java/javax/microedition/khronos/opengles/GL11.java -echo Please cp generated/javax/microedition/khronos/opengles/GL11.java ../../java/javax/microedition/khronos/opengles/GL11.java -KEEP_GENERATED=1 -fi - -# GL11Ext.java -if cmp ../../java/javax/microedition/khronos/opengles/GL11Ext.java generated/javax/microedition/khronos/opengles/GL11Ext.java ; then -echo GL11Ext.java unchanged -else -echo Please edit ../../java/javax/microedition/khronos/opengles/GL11Ext.java -echo Please cp generated/javax/microedition/khronos/opengles/GL11Ext.java ../../java/javax/microedition/khronos/opengles/GL11Ext.java -KEEP_GENERATED=1 -fi - -# GL11ExtensionPack.java -if cmp ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ; then -echo GL11ExtensionPack.java unchanged -else -echo Please edit ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java -echo Please cp generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java -KEEP_GENERATED=1 -fi +SAID_PLEASE=0 + +# compareGenerated destDir generatedDir file +compareGenerated() { + if cmp -s $1/$3 $2/$3 ; then + echo "# " $3 unchanged + else + if [ $SAID_PLEASE == "0" ] ; then + echo Please evaluate the following commands: + echo + SAID_PLEASE=1 + fi + echo " " cp $2/$3 $1 + echo " " git add $1/$3 + KEEP_GENERATED=1 + fi +} + +compareGenerated ../../../core/jni generated/C com_google_android_gles_jni_GLImpl.cpp +compareGenerated ../../java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java + +for x in GL.java GL10.java GL10Ext.java GL11.java GL11Ext.java GL11ExtensionPack.java +do + compareGenerated ../../java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x +done + +for x in GLES10 GLES10Ext GLES11 GLES11Ext +do + compareGenerated ../../java/android/opengl generated/android/opengl ${x}.java + compareGenerated ../../../core/jni generated/C android_opengl_${x}.cpp +done if [ $KEEP_GENERATED == "0" ] ; then -rm -rf generated + rm -rf generated fi diff --git a/opengl/tools/glgen/glspec-1.0 b/opengl/tools/glgen/glspec-1.0 deleted file mode 100644 index c442320..0000000 --- a/opengl/tools/glgen/glspec-1.0 +++ /dev/null @@ -1,106 +0,0 @@ -void glActiveTexture ( GLenum texture ) -void glAlphaFunc ( GLenum func, GLclampf ref ) -void glAlphaFuncx ( GLenum func, GLclampx ref ) -void glBindTexture ( GLenum target, GLuint texture ) -void glBlendFunc ( GLenum sfactor, GLenum dfactor ) -void glClear ( GLbitfield mask ) -void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) -void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) -void glClearDepthf ( GLclampf depth ) -void glClearDepthx ( GLclampx depth ) -void glClearStencil ( GLint s ) -void glClientActiveTexture ( GLenum texture ) -void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) -void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) -void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) -void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) -void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) -void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) -void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) -void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) -void glCullFace ( GLenum mode ) -void glDeleteTextures ( GLsizei n, const GLuint *textures ) -void glDepthFunc ( GLenum func ) -void glDepthMask ( GLboolean flag ) -void glDepthRangef ( GLclampf zNear, GLclampf zFar ) -void glDepthRangex ( GLclampx zNear, GLclampx zFar ) -void glDisable ( GLenum cap ) -void glDisableClientState ( GLenum array ) -void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) -void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) -void glEnable ( GLenum cap ) -void glEnableClientState ( GLenum array ) -void glFinish ( void ) -void glFlush ( void ) -void glFogf ( GLenum pname, GLfloat param ) -void glFogfv ( GLenum pname, const GLfloat *params ) -void glFogx ( GLenum pname, GLfixed param ) -void glFogxv ( GLenum pname, const GLfixed *params ) -void glFrontFace ( GLenum mode ) -void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) -void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) -void glGenTextures ( GLsizei n, GLuint *textures ) -GLenum glGetError ( void ) -void glGetIntegerv ( GLenum pname, GLint *params ) -const GLubyte * glGetString ( GLenum name ) -void glHint ( GLenum target, GLenum mode ) -void glLightModelf ( GLenum pname, GLfloat param ) -void glLightModelfv ( GLenum pname, const GLfloat *params ) -void glLightModelx ( GLenum pname, GLfixed param ) -void glLightModelxv ( GLenum pname, const GLfixed *params ) -void glLightf ( GLenum light, GLenum pname, GLfloat param ) -void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) -void glLightx ( GLenum light, GLenum pname, GLfixed param ) -void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) -void glLineWidth ( GLfloat width ) -void glLineWidthx ( GLfixed width ) -void glLoadIdentity ( void ) -void glLoadMatrixf ( const GLfloat *m ) -void glLoadMatrixx ( const GLfixed *m ) -void glLogicOp ( GLenum opcode ) -void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) -void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) -void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) -void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) -void glMatrixMode ( GLenum mode ) -void glMultMatrixf ( const GLfloat *m ) -void glMultMatrixx ( const GLfixed *m ) -void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) -void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) -void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) -void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) -void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) -void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) -void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) -void glPixelStorei ( GLenum pname, GLint param ) -void glPointSize ( GLfloat size ) -void glPointSizex ( GLfixed size ) -void glPolygonOffset ( GLfloat factor, GLfloat units ) -void glPolygonOffsetx ( GLfixed factor, GLfixed units ) -void glPopMatrix ( void ) -void glPushMatrix ( void ) -void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) -void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) -void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) -void glSampleCoverage ( GLclampf value, GLboolean invert ) -void glSampleCoveragex ( GLclampx value, GLboolean invert ) -void glScalef ( GLfloat x, GLfloat y, GLfloat z ) -void glScalex ( GLfixed x, GLfixed y, GLfixed z ) -void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) -void glShadeModel ( GLenum mode ) -void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) -void glStencilMask ( GLuint mask ) -void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) -void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) -void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) -void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) -void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) -void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) -void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) -void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) -void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) -void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) -void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) -void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) -void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) -void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) diff --git a/opengl/tools/glgen/glspec-1.0ext b/opengl/tools/glgen/glspec-1.0ext deleted file mode 100644 index 7d19758..0000000 --- a/opengl/tools/glgen/glspec-1.0ext +++ /dev/null @@ -1 +0,0 @@ -GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) diff --git a/opengl/tools/glgen/glspec-1.1 b/opengl/tools/glgen/glspec-1.1 deleted file mode 100644 index 9149a7f..0000000 --- a/opengl/tools/glgen/glspec-1.1 +++ /dev/null @@ -1,42 +0,0 @@ -void glBindBuffer ( GLenum target, GLuint buffer ) -void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) -void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) -void glClipPlanef ( GLenum plane, const GLfloat *equation ) -void glClipPlanex ( GLenum plane, const GLfixed *equation ) -void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) -void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) -void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) -void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) -void glGenBuffers ( GLsizei n, GLuint *buffers ) -void glGetBooleanv ( GLenum pname, GLboolean *params ) -void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) -void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) -void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) -void glGetFixedv ( GLenum pname, GLfixed *params ) -void glGetFloatv ( GLenum pname, GLfloat *params ) -void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) -void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) -void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) -void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) -void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) -void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) -void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) -void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) -void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) -GLboolean glIsBuffer ( GLuint buffer ) -GLboolean glIsEnabled ( GLenum cap ) -GLboolean glIsTexture ( GLuint texture ) -void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) -void glPointParameterf ( GLenum pname, GLfloat param ) -void glPointParameterfv ( GLenum pname, const GLfloat *params ) -void glPointParameterx ( GLenum pname, GLfixed param ) -void glPointParameterxv ( GLenum pname, const GLfixed *params ) -void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) -void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) -void glTexEnvi ( GLenum target, GLenum pname, GLint param ) -void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) -void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) -void glTexParameteri ( GLenum target, GLenum pname, GLint param ) -void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) -void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) -void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) diff --git a/opengl/tools/glgen/glspec-1.1ext b/opengl/tools/glgen/glspec-1.1ext deleted file mode 100644 index cc08c73..0000000 --- a/opengl/tools/glgen/glspec-1.1ext +++ /dev/null @@ -1,16 +0,0 @@ -void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex ) -void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) -void glDrawTexfvOES ( const GLfloat *coords ) -void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height ) -void glDrawTexivOES ( const GLint *coords ) -void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height ) -void glDrawTexsvOES ( const GLshort *coords ) -void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height ) -void glDrawTexxvOES ( const GLfixed *coords ) -void glEnable ( GLenum cap ) -void glEnableClientState ( GLenum array ) -void glLoadPaletteFromModelViewMatrixOES ( void ) -void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) -void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) -void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) -void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) diff --git a/opengl/tools/glgen/glspec-1.1extpack b/opengl/tools/glgen/glspec-1.1extpack deleted file mode 100644 index ca9e6d2..0000000 --- a/opengl/tools/glgen/glspec-1.1extpack +++ /dev/null @@ -1,38 +0,0 @@ -void glBindFramebufferOES ( GLint target, GLint framebuffer ) -void glBindRenderbufferOES ( GLint target, GLint renderbuffer ) -void glBindTexture ( GLint target, GLint texture ) -void glBlendEquation ( GLint mode ) -void glBlendEquationSeparate ( GLint modeRGB, GLint modeAlpha ) -void glBlendFuncSeparate ( GLint srcRGB, GLint dstRGB, GLint srcAlpha, GLint dstAlpha ) -GLint glCheckFramebufferStatusOES ( GLint target ) -void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) -void glCopyTexImage2D ( GLint target, GLint level, GLint internalformat, GLint x, GLint y, GLint width, GLint height, GLint border ) -void glDeleteFramebuffersOES ( GLint n, GLint *framebuffers ) -void glDeleteRenderbuffersOES ( GLint n, GLint *renderbuffers ) -void glEnable ( GLint cap ) -void glFramebufferRenderbufferOES ( GLint target, GLint attachment, GLint renderbuffertarget, GLint renderbuffer ) -void glFramebufferTexture2DOES ( GLint target, GLint attachment, GLint textarget, GLint texture, GLint level ) -void glGenerateMipmapOES ( GLint target ) -void glGenFramebuffersOES ( GLint n, GLint *framebuffers ) -void glGenRenderbuffersOES ( GLint n, GLint *renderbuffers ) -void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params ) -void glGetIntegerv ( GLint pname, GLint *params ) -void glGetRenderbufferParameterivOES ( GLint target, GLint pname, GLint *params ) -void glGetTexGenfv ( GLint coord, GLint pname, GLfloat *params ) -void glGetTexGeniv ( GLint coord, GLint pname, GLint *params ) -void glGetTexGenxv ( GLint coord, GLint pname, GLint *params ) -GLboolean glIsFramebufferOES ( GLint framebuffer ) -GLboolean glIsRenderbufferOES ( GLint renderbuffer ) -void glRenderbufferStorageOES ( GLint target, GLint internalformat, GLint width, GLint height ) -void glStencilOp ( GLint fail, GLint zfail, GLint zpass ) -void glTexEnvf ( GLint target, GLint pname, GLfloat param ) -void glTexEnvfv ( GLint target, GLint pname, GLfloat *params ) -void glTexEnvx ( GLint target, GLint pname, GLint param ) -void glTexEnvxv ( GLint target, GLint pname, GLint *params ) -void glTexGenf ( GLint coord, GLint pname, GLfloat param ) -void glTexGenfv ( GLint coord, GLint pname, GLfloat *params ) -void glTexGeni ( GLint coord, GLint pname, GLint param ) -void glTexGeniv ( GLint coord, GLint pname, GLint *params ) -void glTexGenx ( GLint coord, GLint pname, GLint param ) -void glTexGenxv ( GLint coord, GLint pname, GLint *params ) -void glTexParameterf ( GLint target, GLint pname, GLfloat param ) diff --git a/opengl/tools/glgen/glspec-checks b/opengl/tools/glgen/glspec-checks deleted file mode 100644 index a84ed65..0000000 --- a/opengl/tools/glgen/glspec-checks +++ /dev/null @@ -1,59 +0,0 @@ -glClipPlanef check equation 4 -glClipPlanex check equation 4 -glDeleteBuffers check buffers n -glDeleteTextures check textures n -glDrawElements check_AIOOBE indices count -glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END ifcheck params 4 pname GL_FOG_COLOR -glGenBuffers check buffers n -glGenTextures check textures n -glGetClipPlane check eqn 4 -glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params _NUM_COMPRESSED_TEXTURE_FORMATS pname GL_COMPRESSED_TEXTURE_FORMATS,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT -glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION -glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE -glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR -glGetTexParameter check params 1 -glLightModel ifcheck params 1 pname GL_LIGHT_MODEL_TWO_SIDE ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT -glLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION -glLoadMatrix check m 16 -glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE -glMultMatrix check m 16 -glPointParameter check params 1 -glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR -glTexImage2D nullAllowed -glTexSubImage2D nullAllowed -glBufferData nullAllowed -glTexParameter check params 1 -glQueryMatrixxOES check mantissa 16 check exponent 16 return -1 -glDrawTexfvOES check coords 5 -glDrawTexivOES check coords 5 -glDrawTexsvOES check coords 5 -glDrawTexxvOES check coords 5 -glBindFramebufferOES unsupported -glBindRenderbufferOES unsupported -glBlendEquation unsupported -glBlendEquationSeparate unsupported -glBlendFuncSeparate unsupported -glCheckFramebufferStatusOES unsupported return 0 -glCurrentPaletteMatrixOES unsupported -glDeleteFramebuffersOES unsupported -glDeleteRenderbuffersOES unsupported -glFramebufferRenderbufferOES unsupported -glFramebufferStorageOES unsupported -glFramebufferTexture2DOES unsupported -glGenFramebuffersOES unsupported -glGenRenderbuffersOES unsupported -glGenerateMipmapOES unsupported -glGetBufferParameter unsupported -glGetFramebufferAttachmentParameterivOES unsupported -glGetRenderbufferParameterivOES unsupported -glGetTexGen unsupported -glIsFramebufferOES unsupported return JNI_FALSE -glIsRenderbufferOES unsupported return JNI_FALSE -glLoadPaletteFromModelViewMatrixOES unsupported -glMatrixIndexPointerOES unsupported -glRenderbufferStorageOES unsupported return false -glTexGen unsupported -glTexGenf unsupported -glTexGeni unsupported -glTexGenx unsupported -glWeightPointerOES unsupported diff --git a/opengl/tools/glgen/specs/gles11/GLES10.spec b/opengl/tools/glgen/specs/gles11/GLES10.spec new file mode 100644 index 0000000..8e1152d --- /dev/null +++ b/opengl/tools/glgen/specs/gles11/GLES10.spec @@ -0,0 +1,106 @@ +void glActiveTexture ( GLenum texture ) +void glAlphaFunc ( GLenum func, GLclampf ref ) +void glAlphaFuncx ( GLenum func, GLclampx ref ) +void glBindTexture ( GLenum target, GLuint texture ) +void glBlendFunc ( GLenum sfactor, GLenum dfactor ) +void glClear ( GLbitfield mask ) +void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) +void glClearDepthf ( GLclampf depth ) +void glClearDepthx ( GLclampx depth ) +void glClearStencil ( GLint s ) +void glClientActiveTexture ( GLenum texture ) +void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) +void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) +void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) +void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) +void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) +void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) +void glCullFace ( GLenum mode ) +void glDeleteTextures ( GLsizei n, const GLuint *textures ) +void glDepthFunc ( GLenum func ) +void glDepthMask ( GLboolean flag ) +void glDepthRangef ( GLclampf zNear, GLclampf zFar ) +void glDepthRangex ( GLclampx zNear, GLclampx zFar ) +void glDisable ( GLenum cap ) +void glDisableClientState ( GLenum array ) +void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) +void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) +void glEnable ( GLenum cap ) +void glEnableClientState ( GLenum array ) +void glFinish ( void ) +void glFlush ( void ) +void glFogf ( GLenum pname, GLfloat param ) +void glFogfv ( GLenum pname, const GLfloat *params ) +void glFogx ( GLenum pname, GLfixed param ) +void glFogxv ( GLenum pname, const GLfixed *params ) +void glFrontFace ( GLenum mode ) +void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) +void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) +void glGenTextures ( GLsizei n, GLuint *textures ) +GLenum glGetError ( void ) +void glGetIntegerv ( GLenum pname, GLint *params ) +const GLubyte * glGetString ( GLenum name ) +void glHint ( GLenum target, GLenum mode ) +void glLightModelf ( GLenum pname, GLfloat param ) +void glLightModelfv ( GLenum pname, const GLfloat *params ) +void glLightModelx ( GLenum pname, GLfixed param ) +void glLightModelxv ( GLenum pname, const GLfixed *params ) +void glLightf ( GLenum light, GLenum pname, GLfloat param ) +void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) +void glLightx ( GLenum light, GLenum pname, GLfixed param ) +void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) +void glLineWidth ( GLfloat width ) +void glLineWidthx ( GLfixed width ) +void glLoadIdentity ( void ) +void glLoadMatrixf ( const GLfloat *m ) +void glLoadMatrixx ( const GLfixed *m ) +void glLogicOp ( GLenum opcode ) +void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) +void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) +void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) +void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) +void glMatrixMode ( GLenum mode ) +void glMultMatrixf ( const GLfloat *m ) +void glMultMatrixx ( const GLfixed *m ) +void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) +void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) +void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) +void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) +void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) +void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) +void glPixelStorei ( GLenum pname, GLint param ) +void glPointSize ( GLfloat size ) +void glPointSizex ( GLfixed size ) +void glPolygonOffset ( GLfloat factor, GLfloat units ) +void glPolygonOffsetx ( GLfixed factor, GLfixed units ) +void glPopMatrix ( void ) +void glPushMatrix ( void ) +void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) +void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) +void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) +void glSampleCoverage ( GLclampf value, GLboolean invert ) +void glSampleCoveragex ( GLclampx value, GLboolean invert ) +void glScalef ( GLfloat x, GLfloat y, GLfloat z ) +void glScalex ( GLfixed x, GLfixed y, GLfixed z ) +void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) +void glShadeModel ( GLenum mode ) +void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) +void glStencilMask ( GLuint mask ) +void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) +void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) +void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) +void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) +void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) +void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) +void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) +void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) +void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) +void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) +void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) +void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) diff --git a/opengl/tools/glgen/specs/gles11/GLES10Ext.spec b/opengl/tools/glgen/specs/gles11/GLES10Ext.spec new file mode 100644 index 0000000..53f6c65 --- /dev/null +++ b/opengl/tools/glgen/specs/gles11/GLES10Ext.spec @@ -0,0 +1 @@ +GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) diff --git a/opengl/tools/glgen/specs/gles11/GLES11.spec b/opengl/tools/glgen/specs/gles11/GLES11.spec new file mode 100644 index 0000000..5527c18 --- /dev/null +++ b/opengl/tools/glgen/specs/gles11/GLES11.spec @@ -0,0 +1,44 @@ +void glBindBuffer ( GLenum target, GLuint buffer ) +void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) +void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) +void glClipPlanef ( GLenum plane, const GLfloat *equation ) +void glClipPlanex ( GLenum plane, const GLfixed *equation ) +void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) +void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) +void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) +void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) +void glGenBuffers ( GLsizei n, GLuint *buffers ) +void glGetBooleanv ( GLenum pname, GLboolean *params ) +void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) +void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) +void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) +void glGetFixedv ( GLenum pname, GLfixed *params ) +void glGetFloatv ( GLenum pname, GLfloat *params ) +void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) +void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) +void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) +void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) +// void glGetPointerv ( GLenum pname, void **params ) +void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) +void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) +void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) +void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) +void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) +void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) +GLboolean glIsBuffer ( GLuint buffer ) +GLboolean glIsEnabled ( GLenum cap ) +GLboolean glIsTexture ( GLuint texture ) +void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) +void glPointParameterf ( GLenum pname, GLfloat param ) +void glPointParameterfv ( GLenum pname, const GLfloat *params ) +void glPointParameterx ( GLenum pname, GLfixed param ) +void glPointParameterxv ( GLenum pname, const GLfixed *params ) +void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) +void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) +void glTexEnvi ( GLenum target, GLenum pname, GLint param ) +void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) +void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) +void glTexParameteri ( GLenum target, GLenum pname, GLint param ) +void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) +void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) +void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) diff --git a/opengl/tools/glgen/specs/gles11/GLES11Ext.spec b/opengl/tools/glgen/specs/gles11/GLES11Ext.spec new file mode 100644 index 0000000..cd7333a --- /dev/null +++ b/opengl/tools/glgen/specs/gles11/GLES11Ext.spec @@ -0,0 +1,90 @@ +void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) +void glBlendFuncSeparateOES ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) +void glBlendEquationOES ( GLenum mode ) +void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height ) +void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height ) +void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height ) +void glDrawTexsvOES ( const GLshort *coords ) +void glDrawTexivOES ( const GLint *coords ) +void glDrawTexxvOES ( const GLfixed *coords ) +void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) +void glDrawTexfvOES ( const GLfloat *coords ) +void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image ) +void glEGLImageTargetRenderbufferStorageOES ( GLenum target, GLeglImageOES image ) +void glAlphaFuncxOES ( GLenum func, GLclampx ref ) +void glClearColorxOES ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) +void glClearDepthxOES ( GLclampx depth ) +void glClipPlanexOES ( GLenum plane, const GLfixed *equation ) +void glColor4xOES ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) +void glDepthRangexOES ( GLclampx zNear, GLclampx zFar ) +void glFogxOES ( GLenum pname, GLfixed param ) +void glFogxvOES ( GLenum pname, const GLfixed *params ) +void glFrustumxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) +void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn ) +void glGetFixedvOES ( GLenum pname, GLfixed *params ) +void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params ) +void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params ) +void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params ) +void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params ) +void glLightModelxOES ( GLenum pname, GLfixed param ) +void glLightModelxvOES ( GLenum pname, const GLfixed *params ) +void glLightxOES ( GLenum light, GLenum pname, GLfixed param ) +void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params ) +void glLineWidthxOES ( GLfixed width ) +void glLoadMatrixxOES ( const GLfixed *m ) +void glMaterialxOES ( GLenum face, GLenum pname, GLfixed param ) +void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params ) +void glMultMatrixxOES ( const GLfixed *m ) +void glMultiTexCoord4xOES ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) +void glNormal3xOES ( GLfixed nx, GLfixed ny, GLfixed nz ) +void glOrthoxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) +void glPointParameterxOES ( GLenum pname, GLfixed param ) +void glPointParameterxvOES ( GLenum pname, const GLfixed *params ) +void glPointSizexOES ( GLfixed size ) +void glPolygonOffsetxOES ( GLfixed factor, GLfixed units ) +void glRotatexOES ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) +void glSampleCoveragexOES ( GLclampx value, GLboolean invert ) +void glScalexOES ( GLfixed x, GLfixed y, GLfixed z ) +void glTexEnvxOES ( GLenum target, GLenum pname, GLfixed param ) +void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params ) +void glTexParameterxOES ( GLenum target, GLenum pname, GLfixed param ) +void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params ) +void glTranslatexOES ( GLfixed x, GLfixed y, GLfixed z ) +GLboolean glIsRenderbufferOES ( GLuint renderbuffer ) +void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer ) +void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers ) +void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) +void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) +void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params ) +GLboolean glIsFramebufferOES ( GLuint framebuffer ) +void glBindFramebufferOES ( GLenum target, GLuint framebuffer ) +void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers ) +void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) +GLenum glCheckFramebufferStatusOES ( GLenum target ) +void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) +void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) +void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) +void glGenerateMipmapOES ( GLenum target ) +// Hard to export to Java: +// void *glMapBufferOES ( GLenum target, GLenum access ) +// GLboolean glUnmapBufferOES ( GLenum target ) +// void glGetBufferPointervOES ( GLenum target, GLenum pname, void **params ) +void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex ) +void glLoadPaletteFromModelViewMatrixOES ( void ) +void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) +void glFrustumfOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) +void glOrthofOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) +void glClipPlanefOES ( GLenum plane, const GLfloat *equation ) +void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn ) +void glClearDepthfOES ( GLclampf depth ) +void glTexGenfOES ( GLenum coord, GLenum pname, GLfloat param ) +void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params ) +void glTexGeniOES ( GLenum coord, GLenum pname, GLint param ) +void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params ) +void glTexGenxOES ( GLenum coord, GLenum pname, GLfixed param ) +void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params ) +void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params ) +void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params ) +void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params ) diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec new file mode 100644 index 0000000..9ff1205 --- /dev/null +++ b/opengl/tools/glgen/specs/gles11/checks.spec @@ -0,0 +1,145 @@ +glClipPlanef check eqn 4 +glClipPlanex check eqn 4 +glGetClipPlanefOES check eqn 4 +glGetClipPlanexOES check eqn 4 +glDeleteBuffers check buffers n +glDeleteTextures check textures n +glDrawElements check_AIOOBE indices count +glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END ifcheck params 4 pname GL_FOG_COLOR +glGenBuffers check buffers n +glGenTextures check textures n +glGetClipPlane check eqn 4 +glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params _NUM_COMPRESSED_TEXTURE_FORMATS pname GL_COMPRESSED_TEXTURE_FORMATS,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT +glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION +glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE +glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR +glGetTexParameter check params 1 +glLightModel ifcheck params 1 pname GL_LIGHT_MODEL_TWO_SIDE ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT +glLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION +glLoadMatrix check m 16 +glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE +glMultMatrix check m 16 +glPointParameter check params 1 +glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR +glTexImage2D nullAllowed +glTexSubImage2D nullAllowed +glBufferData nullAllowed +glTexParameter check params 1 +glQueryMatrixxOES check mantissa 16 check exponent 16 return -1 +glDrawTexfvOES check coords 5 +glDrawTexivOES check coords 5 +glDrawTexsvOES check coords 5 +glDrawTexxvOES check coords 5 +glBindFramebufferOES unsupported +glBindRenderbufferOES unsupported +glBlendEquation unsupported +glBlendEquationSeparate unsupported +glBlendFuncSeparate unsupported +glCheckFramebufferStatusOES unsupported return 0 +glCurrentPaletteMatrixOES unsupported +glDeleteFramebuffersOES unsupported +glDeleteRenderbuffersOES unsupported +glFramebufferRenderbufferOES unsupported +glFramebufferStorageOES unsupported +glFramebufferTexture2DOES unsupported +glGenFramebuffersOES unsupported +glGenRenderbuffersOES unsupported +glGenerateMipmapOES unsupported +glGetBufferParameter unsupported +glGetFramebufferAttachmentParameterivOES unsupported +glGetRenderbufferParameterivOES unsupported +glGetTexGen unsupported +glIsFramebufferOES unsupported return JNI_FALSE +glIsRenderbufferOES unsupported return JNI_FALSE +glLoadPaletteFromModelViewMatrixOES unsupported +glMatrixIndexPointerOES unsupported +glRenderbufferStorageOES unsupported return false +glTexGen unsupported +glTexGenf unsupported +glTexGeni unsupported +glTexGenx unsupported +glWeightPointerOES unsupported +// Lots of unsupported +glAlphaFuncxOES unsupported +glBlendEquationOES unsupported +glBlendEquationSeparateOES unsupported +glBlendFuncSeparateOES unsupported +glClearColorxOES unsupported +glClearDepthfOES unsupported +glClearDepthxOES unsupported +glClipPlanefOES unsupported +glClipPlanefOES unsupported +glClipPlanexOES unsupported +glClipPlanexOES unsupported +glColor4xOES unsupported +glDepthRangefOES unsupported +glDepthRangexOES unsupported +glEGLImageTargetRenderbufferStorageOES unsupported +glEGLImageTargetTexture2DOES unsupported +glFogxOES unsupported +glFogxvOES unsupported +glFogxvOES unsupported +glFrustumfOES unsupported +glFrustumxOES unsupported +glGetClipPlanefOES unsupported +glGetClipPlanefOES unsupported +glGetClipPlanexOES unsupported +glGetClipPlanexOES unsupported +glGetFixedvOES unsupported +glGetFixedvOES unsupported +glGetLightxvOES unsupported +glGetLightxvOES unsupported +glGetMaterialxvOES unsupported +glGetMaterialxvOES unsupported +glGetTexEnvxvOES unsupported +glGetTexEnvxvOES unsupported +glGetTexGenfvOES unsupported +glGetTexGenfvOES unsupported +glGetTexGenivOES unsupported +glGetTexGenivOES unsupported +glGetTexGenxvOES unsupported +glGetTexGenxvOES unsupported +glGetTexParameterxvOES unsupported +glGetTexParameterxvOES unsupported +glLightModelxOES unsupported +glLightModelxvOES unsupported +glLightModelxvOES unsupported +glLightxOES unsupported +glLightxvOES unsupported +glLightxvOES unsupported +glLineWidthxOES unsupported +glLoadMatrixxOES unsupported +glLoadMatrixxOES unsupported +glMaterialxOES unsupported +glMaterialxvOES unsupported +glMaterialxvOES unsupported +glMultMatrixxOES unsupported +glMultMatrixxOES unsupported +glMultiTexCoord4xOES unsupported +glNormal3xOES unsupported +glOrthofOES unsupported +glOrthoxOES unsupported +glPointParameterxOES unsupported +glPointParameterxvOES unsupported +glPointParameterxvOES unsupported +glPointSizexOES unsupported +glPolygonOffsetxOES unsupported +glRotatexOES unsupported +glSampleCoveragexOES unsupported +glScalexOES unsupported +glTexEnvxOES unsupported +glTexEnvxvOES unsupported +glTexEnvxvOES unsupported +glTexGenfOES unsupported +glTexGenfvOES unsupported +glTexGenfvOES unsupported +glTexGeniOES unsupported +glTexGenivOES unsupported +glTexGenivOES unsupported +glTexGenxOES unsupported +glTexGenxvOES unsupported +glTexGenxvOES unsupported +glTexParameterxOES unsupported +glTexParameterxvOES unsupported +glTexParameterxvOES unsupported +glTranslatexOES unsupported \ No newline at end of file diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.0 b/opengl/tools/glgen/specs/jsr239/glspec-1.0 new file mode 100644 index 0000000..c442320 --- /dev/null +++ b/opengl/tools/glgen/specs/jsr239/glspec-1.0 @@ -0,0 +1,106 @@ +void glActiveTexture ( GLenum texture ) +void glAlphaFunc ( GLenum func, GLclampf ref ) +void glAlphaFuncx ( GLenum func, GLclampx ref ) +void glBindTexture ( GLenum target, GLuint texture ) +void glBlendFunc ( GLenum sfactor, GLenum dfactor ) +void glClear ( GLbitfield mask ) +void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) +void glClearDepthf ( GLclampf depth ) +void glClearDepthx ( GLclampx depth ) +void glClearStencil ( GLint s ) +void glClientActiveTexture ( GLenum texture ) +void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) +void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) +void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) +void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) +void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) +void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) +void glCullFace ( GLenum mode ) +void glDeleteTextures ( GLsizei n, const GLuint *textures ) +void glDepthFunc ( GLenum func ) +void glDepthMask ( GLboolean flag ) +void glDepthRangef ( GLclampf zNear, GLclampf zFar ) +void glDepthRangex ( GLclampx zNear, GLclampx zFar ) +void glDisable ( GLenum cap ) +void glDisableClientState ( GLenum array ) +void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) +void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) +void glEnable ( GLenum cap ) +void glEnableClientState ( GLenum array ) +void glFinish ( void ) +void glFlush ( void ) +void glFogf ( GLenum pname, GLfloat param ) +void glFogfv ( GLenum pname, const GLfloat *params ) +void glFogx ( GLenum pname, GLfixed param ) +void glFogxv ( GLenum pname, const GLfixed *params ) +void glFrontFace ( GLenum mode ) +void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) +void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) +void glGenTextures ( GLsizei n, GLuint *textures ) +GLenum glGetError ( void ) +void glGetIntegerv ( GLenum pname, GLint *params ) +const GLubyte * glGetString ( GLenum name ) +void glHint ( GLenum target, GLenum mode ) +void glLightModelf ( GLenum pname, GLfloat param ) +void glLightModelfv ( GLenum pname, const GLfloat *params ) +void glLightModelx ( GLenum pname, GLfixed param ) +void glLightModelxv ( GLenum pname, const GLfixed *params ) +void glLightf ( GLenum light, GLenum pname, GLfloat param ) +void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) +void glLightx ( GLenum light, GLenum pname, GLfixed param ) +void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) +void glLineWidth ( GLfloat width ) +void glLineWidthx ( GLfixed width ) +void glLoadIdentity ( void ) +void glLoadMatrixf ( const GLfloat *m ) +void glLoadMatrixx ( const GLfixed *m ) +void glLogicOp ( GLenum opcode ) +void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) +void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) +void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) +void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) +void glMatrixMode ( GLenum mode ) +void glMultMatrixf ( const GLfloat *m ) +void glMultMatrixx ( const GLfixed *m ) +void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) +void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) +void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) +void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) +void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) +void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) +void glPixelStorei ( GLenum pname, GLint param ) +void glPointSize ( GLfloat size ) +void glPointSizex ( GLfixed size ) +void glPolygonOffset ( GLfloat factor, GLfloat units ) +void glPolygonOffsetx ( GLfixed factor, GLfixed units ) +void glPopMatrix ( void ) +void glPushMatrix ( void ) +void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) +void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) +void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) +void glSampleCoverage ( GLclampf value, GLboolean invert ) +void glSampleCoveragex ( GLclampx value, GLboolean invert ) +void glScalef ( GLfloat x, GLfloat y, GLfloat z ) +void glScalex ( GLfixed x, GLfixed y, GLfixed z ) +void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) +void glShadeModel ( GLenum mode ) +void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) +void glStencilMask ( GLuint mask ) +void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) +void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) +void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) +void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) +void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) +void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) +void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) +void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) +void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) +void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) +void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) +void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.0ext b/opengl/tools/glgen/specs/jsr239/glspec-1.0ext new file mode 100644 index 0000000..7d19758 --- /dev/null +++ b/opengl/tools/glgen/specs/jsr239/glspec-1.0ext @@ -0,0 +1 @@ +GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.1 b/opengl/tools/glgen/specs/jsr239/glspec-1.1 new file mode 100644 index 0000000..9149a7f --- /dev/null +++ b/opengl/tools/glgen/specs/jsr239/glspec-1.1 @@ -0,0 +1,42 @@ +void glBindBuffer ( GLenum target, GLuint buffer ) +void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) +void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) +void glClipPlanef ( GLenum plane, const GLfloat *equation ) +void glClipPlanex ( GLenum plane, const GLfixed *equation ) +void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) +void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) +void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) +void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) +void glGenBuffers ( GLsizei n, GLuint *buffers ) +void glGetBooleanv ( GLenum pname, GLboolean *params ) +void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) +void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) +void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) +void glGetFixedv ( GLenum pname, GLfixed *params ) +void glGetFloatv ( GLenum pname, GLfloat *params ) +void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) +void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) +void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) +void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) +void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) +void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) +void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) +void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) +void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) +GLboolean glIsBuffer ( GLuint buffer ) +GLboolean glIsEnabled ( GLenum cap ) +GLboolean glIsTexture ( GLuint texture ) +void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) +void glPointParameterf ( GLenum pname, GLfloat param ) +void glPointParameterfv ( GLenum pname, const GLfloat *params ) +void glPointParameterx ( GLenum pname, GLfixed param ) +void glPointParameterxv ( GLenum pname, const GLfixed *params ) +void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) +void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) +void glTexEnvi ( GLenum target, GLenum pname, GLint param ) +void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) +void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) +void glTexParameteri ( GLenum target, GLenum pname, GLint param ) +void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) +void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) +void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.1ext b/opengl/tools/glgen/specs/jsr239/glspec-1.1ext new file mode 100644 index 0000000..cc08c73 --- /dev/null +++ b/opengl/tools/glgen/specs/jsr239/glspec-1.1ext @@ -0,0 +1,16 @@ +void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex ) +void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) +void glDrawTexfvOES ( const GLfloat *coords ) +void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height ) +void glDrawTexivOES ( const GLint *coords ) +void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height ) +void glDrawTexsvOES ( const GLshort *coords ) +void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height ) +void glDrawTexxvOES ( const GLfixed *coords ) +void glEnable ( GLenum cap ) +void glEnableClientState ( GLenum array ) +void glLoadPaletteFromModelViewMatrixOES ( void ) +void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) +void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) +void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack new file mode 100644 index 0000000..ca9e6d2 --- /dev/null +++ b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack @@ -0,0 +1,38 @@ +void glBindFramebufferOES ( GLint target, GLint framebuffer ) +void glBindRenderbufferOES ( GLint target, GLint renderbuffer ) +void glBindTexture ( GLint target, GLint texture ) +void glBlendEquation ( GLint mode ) +void glBlendEquationSeparate ( GLint modeRGB, GLint modeAlpha ) +void glBlendFuncSeparate ( GLint srcRGB, GLint dstRGB, GLint srcAlpha, GLint dstAlpha ) +GLint glCheckFramebufferStatusOES ( GLint target ) +void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) +void glCopyTexImage2D ( GLint target, GLint level, GLint internalformat, GLint x, GLint y, GLint width, GLint height, GLint border ) +void glDeleteFramebuffersOES ( GLint n, GLint *framebuffers ) +void glDeleteRenderbuffersOES ( GLint n, GLint *renderbuffers ) +void glEnable ( GLint cap ) +void glFramebufferRenderbufferOES ( GLint target, GLint attachment, GLint renderbuffertarget, GLint renderbuffer ) +void glFramebufferTexture2DOES ( GLint target, GLint attachment, GLint textarget, GLint texture, GLint level ) +void glGenerateMipmapOES ( GLint target ) +void glGenFramebuffersOES ( GLint n, GLint *framebuffers ) +void glGenRenderbuffersOES ( GLint n, GLint *renderbuffers ) +void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params ) +void glGetIntegerv ( GLint pname, GLint *params ) +void glGetRenderbufferParameterivOES ( GLint target, GLint pname, GLint *params ) +void glGetTexGenfv ( GLint coord, GLint pname, GLfloat *params ) +void glGetTexGeniv ( GLint coord, GLint pname, GLint *params ) +void glGetTexGenxv ( GLint coord, GLint pname, GLint *params ) +GLboolean glIsFramebufferOES ( GLint framebuffer ) +GLboolean glIsRenderbufferOES ( GLint renderbuffer ) +void glRenderbufferStorageOES ( GLint target, GLint internalformat, GLint width, GLint height ) +void glStencilOp ( GLint fail, GLint zfail, GLint zpass ) +void glTexEnvf ( GLint target, GLint pname, GLfloat param ) +void glTexEnvfv ( GLint target, GLint pname, GLfloat *params ) +void glTexEnvx ( GLint target, GLint pname, GLint param ) +void glTexEnvxv ( GLint target, GLint pname, GLint *params ) +void glTexGenf ( GLint coord, GLint pname, GLfloat param ) +void glTexGenfv ( GLint coord, GLint pname, GLfloat *params ) +void glTexGeni ( GLint coord, GLint pname, GLint param ) +void glTexGeniv ( GLint coord, GLint pname, GLint *params ) +void glTexGenx ( GLint coord, GLint pname, GLint param ) +void glTexGenxv ( GLint coord, GLint pname, GLint *params ) +void glTexParameterf ( GLint target, GLint pname, GLfloat param ) diff --git a/opengl/tools/glgen/specs/jsr239/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks new file mode 100644 index 0000000..a84ed65 --- /dev/null +++ b/opengl/tools/glgen/specs/jsr239/glspec-checks @@ -0,0 +1,59 @@ +glClipPlanef check equation 4 +glClipPlanex check equation 4 +glDeleteBuffers check buffers n +glDeleteTextures check textures n +glDrawElements check_AIOOBE indices count +glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END ifcheck params 4 pname GL_FOG_COLOR +glGenBuffers check buffers n +glGenTextures check textures n +glGetClipPlane check eqn 4 +glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params _NUM_COMPRESSED_TEXTURE_FORMATS pname GL_COMPRESSED_TEXTURE_FORMATS,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT +glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION +glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE +glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR +glGetTexParameter check params 1 +glLightModel ifcheck params 1 pname GL_LIGHT_MODEL_TWO_SIDE ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT +glLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION +glLoadMatrix check m 16 +glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE +glMultMatrix check m 16 +glPointParameter check params 1 +glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR +glTexImage2D nullAllowed +glTexSubImage2D nullAllowed +glBufferData nullAllowed +glTexParameter check params 1 +glQueryMatrixxOES check mantissa 16 check exponent 16 return -1 +glDrawTexfvOES check coords 5 +glDrawTexivOES check coords 5 +glDrawTexsvOES check coords 5 +glDrawTexxvOES check coords 5 +glBindFramebufferOES unsupported +glBindRenderbufferOES unsupported +glBlendEquation unsupported +glBlendEquationSeparate unsupported +glBlendFuncSeparate unsupported +glCheckFramebufferStatusOES unsupported return 0 +glCurrentPaletteMatrixOES unsupported +glDeleteFramebuffersOES unsupported +glDeleteRenderbuffersOES unsupported +glFramebufferRenderbufferOES unsupported +glFramebufferStorageOES unsupported +glFramebufferTexture2DOES unsupported +glGenFramebuffersOES unsupported +glGenRenderbuffersOES unsupported +glGenerateMipmapOES unsupported +glGetBufferParameter unsupported +glGetFramebufferAttachmentParameterivOES unsupported +glGetRenderbufferParameterivOES unsupported +glGetTexGen unsupported +glIsFramebufferOES unsupported return JNI_FALSE +glIsRenderbufferOES unsupported return JNI_FALSE +glLoadPaletteFromModelViewMatrixOES unsupported +glMatrixIndexPointerOES unsupported +glRenderbufferStorageOES unsupported return false +glTexGen unsupported +glTexGenf unsupported +glTexGeni unsupported +glTexGenx unsupported +glWeightPointerOES unsupported diff --git a/opengl/tools/glgen/src/GLESCodeEmitter.java b/opengl/tools/glgen/src/GLESCodeEmitter.java new file mode 100644 index 0000000..b303503 --- /dev/null +++ b/opengl/tools/glgen/src/GLESCodeEmitter.java @@ -0,0 +1,40 @@ +import java.io.PrintStream; + +/** + * Emits a Java interface and Java & C implementation for a C function. + * + *

The Java interface will have Buffer and array variants for functions that + * have a typed pointer argument. The array variant will convert a single " *data" + * argument to a pair of arguments "[] data, int offset". + */ +public class GLESCodeEmitter extends JniCodeEmitter { + + PrintStream mJavaImplStream; + PrintStream mCStream; + + PrintStream mJavaInterfaceStream; + + /** + */ + public GLESCodeEmitter(String classPathName, + ParameterChecker checker, + PrintStream javaImplStream, + PrintStream cStream) { + mClassPathName = classPathName; + mChecker = checker; + + mJavaImplStream = javaImplStream; + mCStream = cStream; + mUseContextPointer = false; + mUseStaticMethods = true; + } + + public void emitCode(CFunc cfunc, String original) { + emitCode(cfunc, original, null, mJavaImplStream, + mCStream); + } + + public void emitNativeRegistration(String nativeRegistrationName) { + emitNativeRegistration(nativeRegistrationName, mCStream); + } +} diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java index accb16e..3715a96 100644 --- a/opengl/tools/glgen/src/GenerateGL.java +++ b/opengl/tools/glgen/src/GenerateGL.java @@ -31,18 +31,18 @@ public class GenerateGL { CFunc cfunc = CFunc.parseCFunc(s); String fname = cfunc.getName(); - File f = new File("stubs/" + fname + + File f = new File("stubs/jsr239/" + fname + ".java-1" + version + "-if"); if (f.exists()) { System.out.println("Special-casing function " + fname); - copy("stubs/" + fname + + copy("stubs/jsr239/" + fname + ".java-1" + version + "-if", glStream); - copy("stubs/" + fname + ".java-impl", glImplStream); - copy("stubs/" + fname + ".cpp", cStream); + copy("stubs/jsr239/" + fname + ".java-impl", glImplStream); + copy("stubs/jsr239/" + fname + ".cpp", cStream); // Register native function names // This should be improved to require fewer discrete files - String filename = "stubs/" + fname + ".nativeReg"; + String filename = "stubs/jsr239/" + fname + ".nativeReg"; BufferedReader br = new BufferedReader(new FileReader(filename)); String nfunc; @@ -135,13 +135,13 @@ public class GenerateGL { glImplStream.println("/* //device/java/android/" + glImplFilename); cStream.println("/* //device/libs/android_runtime/" + cFilename); - copy("stubs/GL10Header.java-if", gl10Stream); - copy("stubs/GL10ExtHeader.java-if", gl10ExtStream); - copy("stubs/GL11Header.java-if", gl11Stream); - copy("stubs/GL11ExtHeader.java-if", gl11ExtStream); - copy("stubs/GL11ExtensionPackHeader.java-if", gl11ExtPackStream); - copy("stubs/GLImplHeader.java-impl", glImplStream); - copy("stubs/GLCHeader.cpp", cStream); + copy("stubs/jsr239/GL10Header.java-if", gl10Stream); + copy("stubs/jsr239/GL10ExtHeader.java-if", gl10ExtStream); + copy("stubs/jsr239/GL11Header.java-if", gl11Stream); + copy("stubs/jsr239/GL11ExtHeader.java-if", gl11ExtStream); + copy("stubs/jsr239/GL11ExtensionPackHeader.java-if", gl11ExtPackStream); + copy("stubs/jsr239/GLImplHeader.java-impl", glImplStream); + copy("stubs/jsr239/GLCHeader.cpp", cStream); emit(0, false, false, emitter, spec10Reader, gl10Stream, glImplStream, cStream); diff --git a/opengl/tools/glgen/src/GenerateGLES.java b/opengl/tools/glgen/src/GenerateGLES.java new file mode 100644 index 0000000..60775b7 --- /dev/null +++ b/opengl/tools/glgen/src/GenerateGLES.java @@ -0,0 +1,99 @@ + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintStream; + +public class GenerateGLES { + + static void copy(String filename, PrintStream out) throws IOException { + BufferedReader br = new BufferedReader(new FileReader(filename)); + String s; + while ((s = br.readLine()) != null) { + out.println(s); + } + } + + private static void emit(GLESCodeEmitter emitter, + BufferedReader specReader, + PrintStream glStream, + PrintStream cStream) throws Exception { + String s = null; + while ((s = specReader.readLine()) != null) { + if (s.trim().startsWith("//")) { + continue; + } + + CFunc cfunc = CFunc.parseCFunc(s); + + String fname = cfunc.getName(); + String stubRoot = "stubs/gles11/" + fname; + String javaPath = stubRoot + ".java"; + File f = new File(javaPath); + if (f.exists()) { + System.out.println("Special-casing function " + fname); + copy(javaPath, glStream); + copy(stubRoot + ".cpp", cStream); + + // Register native function names + // This should be improved to require fewer discrete files + String filename = stubRoot + ".nativeReg"; + BufferedReader br = + new BufferedReader(new FileReader(filename)); + String nfunc; + while ((nfunc = br.readLine()) != null) { + emitter.addNativeRegistration(nfunc); + } + } else { + emitter.emitCode(cfunc, s); + } + } + } + + public static void main(String[] args) throws Exception { + int aidx = 0; + while ((aidx < args.length) && (args[aidx].charAt(0) == '-')) { + switch (args[aidx].charAt(1)) { + default: + System.err.println("Unknown flag: " + args[aidx]); + System.exit(1); + } + + aidx++; + } + + BufferedReader checksReader = + new BufferedReader(new FileReader("specs/gles11/checks.spec")); + ParameterChecker checker = new ParameterChecker(checksReader); + + // Generate files + for(String suffix: new String[] {"GLES10", "GLES10Ext", + "GLES11", "GLES11Ext"}) + { + BufferedReader spec11Reader = + new BufferedReader(new FileReader("specs/gles11/" + + suffix + ".spec")); + String gl11Filename = "android/opengl/" + suffix + ".java"; + String gl11cFilename = "android_opengl_" + suffix + ".cpp"; + PrintStream gl11Stream = + new PrintStream(new FileOutputStream("out/" + gl11Filename)); + PrintStream gl11cStream = + new PrintStream(new FileOutputStream("out/" + gl11cFilename)); + gl11Stream.println("/*"); + gl11cStream.println("/*"); + copy("stubs/gles11/" + suffix + "Header.java-if", gl11Stream); + copy("stubs/gles11/" + suffix + "cHeader.cpp", gl11cStream); + GLESCodeEmitter emitter = new GLESCodeEmitter( + "android/opengl/" + suffix, + checker, gl11Stream, gl11cStream); + emit(emitter, spec11Reader, gl11Stream, gl11cStream); + emitter.emitNativeRegistration("register_android_opengl_jni_" + + suffix); + gl11Stream.println("}"); + gl11Stream.close(); + gl11cStream.close(); + } + } +} diff --git a/opengl/tools/glgen/src/JFunc.java b/opengl/tools/glgen/src/JFunc.java index 68f717c..63c045b 100644 --- a/opengl/tools/glgen/src/JFunc.java +++ b/opengl/tools/glgen/src/JFunc.java @@ -104,34 +104,39 @@ public class JFunc { } public static JFunc convert(CFunc cfunc, boolean useArray) { - JFunc jfunc = new JFunc(cfunc); - jfunc.setName(cfunc.getName()); - jfunc.setType(JType.convert(cfunc.getType(), false)); - - int numArgs = cfunc.getNumArgs(); - int numOffsets = 0; - for (int i = 0; i < numArgs; i++) { - CType cArgType = cfunc.getArgType(i); - if (cArgType.isTypedPointer() && useArray) { - ++numOffsets; + try { + JFunc jfunc = new JFunc(cfunc); + jfunc.setName(cfunc.getName()); + jfunc.setType(JType.convert(cfunc.getType(), false)); + + int numArgs = cfunc.getNumArgs(); + int numOffsets = 0; + for (int i = 0; i < numArgs; i++) { + CType cArgType = cfunc.getArgType(i); + if (cArgType.isTypedPointer() && useArray) { + ++numOffsets; + } } - } - - for (int i = 0; i < numArgs; i++) { - String cArgName = cfunc.getArgName(i); - CType cArgType = cfunc.getArgType(i); - jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i); - if (cArgType.isTypedPointer() && useArray) { - if (numOffsets > 1) { - jfunc.addArgument(cArgName + "Offset", new JType("int"), i); - } else { - jfunc.addArgument("offset", new JType("int"), i); + for (int i = 0; i < numArgs; i++) { + String cArgName = cfunc.getArgName(i); + CType cArgType = cfunc.getArgType(i); + + jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i); + if (cArgType.isTypedPointer() && useArray) { + if (numOffsets > 1) { + jfunc.addArgument(cArgName + "Offset", new JType("int"), i); + } else { + jfunc.addArgument("offset", new JType("int"), i); + } } } - } - return jfunc; + return jfunc; + } catch (RuntimeException e) { + System.err.println("Failed to convert function " + cfunc); + throw e; + } } @Override diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java index 5ad0e54..df1177b 100644 --- a/opengl/tools/glgen/src/JType.java +++ b/opengl/tools/glgen/src/JType.java @@ -36,6 +36,8 @@ public class JType { new JType("java.nio.Buffer", true, false)); typeMapping.put(new CType("void", false, true), new JType("java.nio.Buffer", true, false)); + typeMapping.put(new CType("GLeglImageOES", false, false), + new JType("java.nio.Buffer", true, false)); // Typed pointers map to typed Buffers typeMapping.put(new CType("GLboolean", false, true), diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java index 9d37607..ef0dbd0 100644 --- a/opengl/tools/glgen/src/JniCodeEmitter.java +++ b/opengl/tools/glgen/src/JniCodeEmitter.java @@ -8,6 +8,7 @@ public class JniCodeEmitter { static final boolean mUseCPlusPlus = true; protected boolean mUseContextPointer = true; + protected boolean mUseStaticMethods = false; protected String mClassPathName; protected ParameterChecker mChecker; protected List nativeRegistrations = new ArrayList(); @@ -67,7 +68,9 @@ public class JniCodeEmitter { emitNativeDeclaration(jfunc, javaImplStream); emitJavaCode(jfunc, javaImplStream); } - emitJavaInterfaceCode(jfunc, javaInterfaceStream); + if (javaInterfaceStream != null) { + emitJavaInterfaceCode(jfunc, javaInterfaceStream); + } if (!duplicate) { emitJniCode(jfunc, cStream); } @@ -86,7 +89,9 @@ public class JniCodeEmitter { if (!duplicate) { emitNativeDeclaration(jfunc, javaImplStream); } - emitJavaInterfaceCode(jfunc, javaInterfaceStream); + if (javaInterfaceStream != null) { + emitJavaInterfaceCode(jfunc, javaInterfaceStream); + } if (!duplicate) { emitJavaCode(jfunc, javaImplStream); emitJniCode(jfunc, cStream); @@ -405,18 +410,20 @@ public class JniCodeEmitter { return; } + String maybeStatic = mUseStaticMethods ? "static " : ""; + if (isPointerFunc) { out.println(indent + - (nativeDecl ? "private native " : - (interfaceDecl ? "" : "public ")) + + (nativeDecl ? "private " + maybeStatic +"native " : + (interfaceDecl ? "" : "public ") + maybeStatic) + jfunc.getType() + " " + jfunc.getName() + (nativeDecl ? "Bounds" : "") + "("); } else { out.println(indent + - (nativeDecl ? "public native " : - (interfaceDecl ? "" : "public ")) + + (nativeDecl ? "public " + maybeStatic +"native " : + (interfaceDecl ? "" : "public ") + maybeStatic) + jfunc.getType() + " " + jfunc.getName() + "("); @@ -508,7 +515,8 @@ public class JniCodeEmitter { nativeRegistrations.add(s); } - public void emitNativeRegistration(PrintStream cStream) { + public void emitNativeRegistration(String registrationFunctionName, + PrintStream cStream) { cStream.println("static const char *classPathName = \"" + mClassPathName + "\";"); @@ -527,7 +535,7 @@ public class JniCodeEmitter { cStream.println(); - cStream.println("int register_com_google_android_gles_jni_GLImpl(JNIEnv *_env)"); + cStream.println("int " + registrationFunctionName + "(JNIEnv *_env)"); cStream.println("{"); cStream.println(indent + "int err;"); diff --git a/opengl/tools/glgen/src/Jsr239CodeEmitter.java b/opengl/tools/glgen/src/Jsr239CodeEmitter.java index eff0447..335d226 100644 --- a/opengl/tools/glgen/src/Jsr239CodeEmitter.java +++ b/opengl/tools/glgen/src/Jsr239CodeEmitter.java @@ -69,6 +69,6 @@ public class Jsr239CodeEmitter extends JniCodeEmitter implements CodeEmitter { } public void emitNativeRegistration() { - emitNativeRegistration(mCStream); + emitNativeRegistration("register_com_google_android_gles_jni_GLImpl", mCStream); } } diff --git a/opengl/tools/glgen/stubs/GL10ExtHeader.java-if b/opengl/tools/glgen/stubs/GL10ExtHeader.java-if deleted file mode 100644 index b0999c2..0000000 --- a/opengl/tools/glgen/stubs/GL10ExtHeader.java-if +++ /dev/null @@ -1,22 +0,0 @@ -** -** Copyright 2007, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -// This source file is automatically generated - -package javax.microedition.khronos.opengles; - -public interface GL10Ext extends GL { - diff --git a/opengl/tools/glgen/stubs/GL10Header.java-if b/opengl/tools/glgen/stubs/GL10Header.java-if deleted file mode 100644 index 8392821..0000000 --- a/opengl/tools/glgen/stubs/GL10Header.java-if +++ /dev/null @@ -1,259 +0,0 @@ -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -// This source file is automatically generated - -package javax.microedition.khronos.opengles; - -public interface GL10 extends GL { - int GL_ADD = 0x0104; - int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E; - int GL_ALIASED_POINT_SIZE_RANGE = 0x846D; - int GL_ALPHA = 0x1906; - int GL_ALPHA_BITS = 0x0D55; - int GL_ALPHA_TEST = 0x0BC0; - int GL_ALWAYS = 0x0207; - int GL_AMBIENT = 0x1200; - int GL_AMBIENT_AND_DIFFUSE = 0x1602; - int GL_AND = 0x1501; - int GL_AND_INVERTED = 0x1504; - int GL_AND_REVERSE = 0x1502; - int GL_BACK = 0x0405; - int GL_BLEND = 0x0BE2; - int GL_BLUE_BITS = 0x0D54; - int GL_BYTE = 0x1400; - int GL_CCW = 0x0901; - int GL_CLAMP_TO_EDGE = 0x812F; - int GL_CLEAR = 0x1500; - int GL_COLOR_ARRAY = 0x8076; - int GL_COLOR_BUFFER_BIT = 0x4000; - int GL_COLOR_LOGIC_OP = 0x0BF2; - int GL_COLOR_MATERIAL = 0x0B57; - int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3; - int GL_CONSTANT_ATTENUATION = 0x1207; - int GL_COPY = 0x1503; - int GL_COPY_INVERTED = 0x150C; - int GL_CULL_FACE = 0x0B44; - int GL_CW = 0x0900; - int GL_DECAL = 0x2101; - int GL_DECR = 0x1E03; - int GL_DEPTH_BITS = 0x0D56; - int GL_DEPTH_BUFFER_BIT = 0x0100; - int GL_DEPTH_TEST = 0x0B71; - int GL_DIFFUSE = 0x1201; - int GL_DITHER = 0x0BD0; - int GL_DONT_CARE = 0x1100; - int GL_DST_ALPHA = 0x0304; - int GL_DST_COLOR = 0x0306; - int GL_EMISSION = 0x1600; - int GL_EQUAL = 0x0202; - int GL_EQUIV = 0x1509; - int GL_EXP = 0x0800; - int GL_EXP2 = 0x0801; - int GL_EXTENSIONS = 0x1F03; - int GL_FALSE = 0; - int GL_FASTEST = 0x1101; - int GL_FIXED = 0x140C; - int GL_FLAT = 0x1D00; - int GL_FLOAT = 0x1406; - int GL_FOG = 0x0B60; - int GL_FOG_COLOR = 0x0B66; - int GL_FOG_DENSITY = 0x0B62; - int GL_FOG_END = 0x0B64; - int GL_FOG_HINT = 0x0C54; - int GL_FOG_MODE = 0x0B65; - int GL_FOG_START = 0x0B63; - int GL_FRONT = 0x0404; - int GL_FRONT_AND_BACK = 0x0408; - int GL_GEQUAL = 0x0206; - int GL_GREATER = 0x0204; - int GL_GREEN_BITS = 0x0D53; - int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 0x8B9B; - int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 0x8B9A; - int GL_INCR = 0x1E02; - int GL_INVALID_ENUM = 0x0500; - int GL_INVALID_OPERATION = 0x0502; - int GL_INVALID_VALUE = 0x0501; - int GL_INVERT = 0x150A; - int GL_KEEP = 0x1E00; - int GL_LEQUAL = 0x0203; - int GL_LESS = 0x0201; - int GL_LIGHT_MODEL_AMBIENT = 0x0B53; - int GL_LIGHT_MODEL_TWO_SIDE = 0x0B52; - int GL_LIGHT0 = 0x4000; - int GL_LIGHT1 = 0x4001; - int GL_LIGHT2 = 0x4002; - int GL_LIGHT3 = 0x4003; - int GL_LIGHT4 = 0x4004; - int GL_LIGHT5 = 0x4005; - int GL_LIGHT6 = 0x4006; - int GL_LIGHT7 = 0x4007; - int GL_LIGHTING = 0x0B50; - int GL_LINE_LOOP = 0x0002; - int GL_LINE_SMOOTH = 0x0B20; - int GL_LINE_SMOOTH_HINT = 0x0C52; - int GL_LINE_STRIP = 0x0003; - int GL_LINEAR = 0x2601; - int GL_LINEAR_ATTENUATION = 0x1208; - int GL_LINEAR_MIPMAP_LINEAR = 0x2703; - int GL_LINEAR_MIPMAP_NEAREST = 0x2701; - int GL_LINES = 0x0001; - int GL_LUMINANCE = 0x1909; - int GL_LUMINANCE_ALPHA = 0x190A; - int GL_MAX_ELEMENTS_INDICES = 0x80E9; - int GL_MAX_ELEMENTS_VERTICES = 0x80E8; - int GL_MAX_LIGHTS = 0x0D31; - int GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36; - int GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38; - int GL_MAX_TEXTURE_SIZE = 0x0D33; - int GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39; - int GL_MAX_TEXTURE_UNITS = 0x84E2; - int GL_MAX_VIEWPORT_DIMS = 0x0D3A; - int GL_MODELVIEW = 0x1700; - int GL_MODULATE = 0x2100; - int GL_MULTISAMPLE = 0x809D; - int GL_NAND = 0x150E; - int GL_NEAREST = 0x2600; - int GL_NEAREST_MIPMAP_LINEAR = 0x2702; - int GL_NEAREST_MIPMAP_NEAREST = 0x2700; - int GL_NEVER = 0x0200; - int GL_NICEST = 0x1102; - int GL_NO_ERROR = 0; - int GL_NOOP = 0x1505; - int GL_NOR = 0x1508; - int GL_NORMAL_ARRAY = 0x8075; - int GL_NORMALIZE = 0x0BA1; - int GL_NOTEQUAL = 0x0205; - int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; - int GL_ONE = 1; - int GL_ONE_MINUS_DST_ALPHA = 0x0305; - int GL_ONE_MINUS_DST_COLOR = 0x0307; - int GL_ONE_MINUS_SRC_ALPHA = 0x0303; - int GL_ONE_MINUS_SRC_COLOR = 0x0301; - int GL_OR = 0x1507; - int GL_OR_INVERTED = 0x150D; - int GL_OR_REVERSE = 0x150B; - int GL_OUT_OF_MEMORY = 0x0505; - int GL_PACK_ALIGNMENT = 0x0D05; - int GL_PALETTE4_R5_G6_B5_OES = 0x8B92; - int GL_PALETTE4_RGB5_A1_OES = 0x8B94; - int GL_PALETTE4_RGB8_OES = 0x8B90; - int GL_PALETTE4_RGBA4_OES = 0x8B93; - int GL_PALETTE4_RGBA8_OES = 0x8B91; - int GL_PALETTE8_R5_G6_B5_OES = 0x8B97; - int GL_PALETTE8_RGB5_A1_OES = 0x8B99; - int GL_PALETTE8_RGB8_OES = 0x8B95; - int GL_PALETTE8_RGBA4_OES = 0x8B98; - int GL_PALETTE8_RGBA8_OES = 0x8B96; - int GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50; - int GL_POINT_SMOOTH = 0x0B10; - int GL_POINT_SMOOTH_HINT = 0x0C51; - int GL_POINTS = 0x0000; - int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; - int GL_POINT_SIZE = 0x0B11; - int GL_POLYGON_OFFSET_FILL = 0x8037; - int GL_POLYGON_SMOOTH_HINT = 0x0C53; - int GL_POSITION = 0x1203; - int GL_PROJECTION = 0x1701; - int GL_QUADRATIC_ATTENUATION = 0x1209; - int GL_RED_BITS = 0x0D52; - int GL_RENDERER = 0x1F01; - int GL_REPEAT = 0x2901; - int GL_REPLACE = 0x1E01; - int GL_RESCALE_NORMAL = 0x803A; - int GL_RGB = 0x1907; - int GL_RGBA = 0x1908; - int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E; - int GL_SAMPLE_ALPHA_TO_ONE = 0x809F; - int GL_SAMPLE_COVERAGE = 0x80A0; - int GL_SCISSOR_TEST = 0x0C11; - int GL_SET = 0x150F; - int GL_SHININESS = 0x1601; - int GL_SHORT = 0x1402; - int GL_SMOOTH = 0x1D01; - int GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22; - int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12; - int GL_SPECULAR = 0x1202; - int GL_SPOT_CUTOFF = 0x1206; - int GL_SPOT_DIRECTION = 0x1204; - int GL_SPOT_EXPONENT = 0x1205; - int GL_SRC_ALPHA = 0x0302; - int GL_SRC_ALPHA_SATURATE = 0x0308; - int GL_SRC_COLOR = 0x0300; - int GL_STACK_OVERFLOW = 0x0503; - int GL_STACK_UNDERFLOW = 0x0504; - int GL_STENCIL_BITS = 0x0D57; - int GL_STENCIL_BUFFER_BIT = 0x0400; - int GL_STENCIL_TEST = 0x0B90; - int GL_SUBPIXEL_BITS = 0x0D50; - int GL_TEXTURE = 0x1702; - int GL_TEXTURE_2D = 0x0DE1; - int GL_TEXTURE_COORD_ARRAY = 0x8078; - int GL_TEXTURE_ENV = 0x2300; - int GL_TEXTURE_ENV_COLOR = 0x2201; - int GL_TEXTURE_ENV_MODE = 0x2200; - int GL_TEXTURE_MAG_FILTER = 0x2800; - int GL_TEXTURE_MIN_FILTER = 0x2801; - int GL_TEXTURE_WRAP_S = 0x2802; - int GL_TEXTURE_WRAP_T = 0x2803; - int GL_TEXTURE0 = 0x84C0; - int GL_TEXTURE1 = 0x84C1; - int GL_TEXTURE2 = 0x84C2; - int GL_TEXTURE3 = 0x84C3; - int GL_TEXTURE4 = 0x84C4; - int GL_TEXTURE5 = 0x84C5; - int GL_TEXTURE6 = 0x84C6; - int GL_TEXTURE7 = 0x84C7; - int GL_TEXTURE8 = 0x84C8; - int GL_TEXTURE9 = 0x84C9; - int GL_TEXTURE10 = 0x84CA; - int GL_TEXTURE11 = 0x84CB; - int GL_TEXTURE12 = 0x84CC; - int GL_TEXTURE13 = 0x84CD; - int GL_TEXTURE14 = 0x84CE; - int GL_TEXTURE15 = 0x84CF; - int GL_TEXTURE16 = 0x84D0; - int GL_TEXTURE17 = 0x84D1; - int GL_TEXTURE18 = 0x84D2; - int GL_TEXTURE19 = 0x84D3; - int GL_TEXTURE20 = 0x84D4; - int GL_TEXTURE21 = 0x84D5; - int GL_TEXTURE22 = 0x84D6; - int GL_TEXTURE23 = 0x84D7; - int GL_TEXTURE24 = 0x84D8; - int GL_TEXTURE25 = 0x84D9; - int GL_TEXTURE26 = 0x84DA; - int GL_TEXTURE27 = 0x84DB; - int GL_TEXTURE28 = 0x84DC; - int GL_TEXTURE29 = 0x84DD; - int GL_TEXTURE30 = 0x84DE; - int GL_TEXTURE31 = 0x84DF; - int GL_TRIANGLE_FAN = 0x0006; - int GL_TRIANGLE_STRIP = 0x0005; - int GL_TRIANGLES = 0x0004; - int GL_TRUE = 1; - int GL_UNPACK_ALIGNMENT = 0x0CF5; - int GL_UNSIGNED_BYTE = 0x1401; - int GL_UNSIGNED_SHORT = 0x1403; - int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; - int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; - int GL_UNSIGNED_SHORT_5_6_5 = 0x8363; - int GL_VENDOR = 0x1F00; - int GL_VERSION = 0x1F02; - int GL_VERTEX_ARRAY = 0x8074; - int GL_XOR = 0x1506; - int GL_ZERO = 0; - diff --git a/opengl/tools/glgen/stubs/GL11ExtHeader.java-if b/opengl/tools/glgen/stubs/GL11ExtHeader.java-if deleted file mode 100644 index 7be2164..0000000 --- a/opengl/tools/glgen/stubs/GL11ExtHeader.java-if +++ /dev/null @@ -1,40 +0,0 @@ -** -** Copyright 2007, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -// This source file is automatically generated - -package javax.microedition.khronos.opengles; - -public interface GL11Ext extends GL { - int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 0x8B9E; - int GL_MATRIX_INDEX_ARRAY_OES = 0x8844; - int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 0x8849; - int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 0x8846; - int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 0x8848; - int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 0x8847; - int GL_MATRIX_PALETTE_OES = 0x8840; - int GL_MAX_PALETTE_MATRICES_OES = 0x8842; - int GL_MAX_VERTEX_UNITS_OES = 0x86A4; - int GL_TEXTURE_CROP_RECT_OES = 0x8B9D; - int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 0x889E; - int GL_WEIGHT_ARRAY_OES = 0x86AD; - int GL_WEIGHT_ARRAY_POINTER_OES = 0x86AC; - int GL_WEIGHT_ARRAY_SIZE_OES = 0x86AB; - int GL_WEIGHT_ARRAY_STRIDE_OES = 0x86AA; - int GL_WEIGHT_ARRAY_TYPE_OES = 0x86A9; - - void glTexParameterfv(int target, int pname, float[] param, int offset); - diff --git a/opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if b/opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if deleted file mode 100644 index a800191..0000000 --- a/opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if +++ /dev/null @@ -1,108 +0,0 @@ -** -** Copyright 2007, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -// This source file is automatically generated - -package javax.microedition.khronos.opengles; - -public interface GL11ExtensionPack extends GL { - int GL_BLEND_DST_ALPHA = 0x80CA; - int GL_BLEND_DST_RGB = 0x80C8; - int GL_BLEND_EQUATION = 0x8009; - int GL_BLEND_EQUATION_ALPHA = 0x883D; - int GL_BLEND_EQUATION_RGB = 0x8009; - int GL_BLEND_SRC_ALPHA = 0x80CB; - int GL_BLEND_SRC_RGB = 0x80C9; - int GL_COLOR_ATTACHMENT0_OES = 0x8CE0; - int GL_COLOR_ATTACHMENT1_OES = 0x8CE1; - int GL_COLOR_ATTACHMENT2_OES = 0x8CE2; - int GL_COLOR_ATTACHMENT3_OES = 0x8CE3; - int GL_COLOR_ATTACHMENT4_OES = 0x8CE4; - int GL_COLOR_ATTACHMENT5_OES = 0x8CE5; - int GL_COLOR_ATTACHMENT6_OES = 0x8CE6; - int GL_COLOR_ATTACHMENT7_OES = 0x8CE7; - int GL_COLOR_ATTACHMENT8_OES = 0x8CE8; - int GL_COLOR_ATTACHMENT9_OES = 0x8CE9; - int GL_COLOR_ATTACHMENT10_OES = 0x8CEA; - int GL_COLOR_ATTACHMENT11_OES = 0x8CEB; - int GL_COLOR_ATTACHMENT12_OES = 0x8CEC; - int GL_COLOR_ATTACHMENT13_OES = 0x8CED; - int GL_COLOR_ATTACHMENT14_OES = 0x8CEE; - int GL_COLOR_ATTACHMENT15_OES = 0x8CEF; - int GL_DECR_WRAP = 0x8508; - int GL_DEPTH_ATTACHMENT_OES = 0x8D00; - int GL_DEPTH_COMPONENT = 0x1902; - int GL_DEPTH_COMPONENT16 = 0x81A5; - int GL_DEPTH_COMPONENT24 = 0x81A6; - int GL_DEPTH_COMPONENT32 = 0x81A7; - int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 0x8CD1; - int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 0x8CD0; - int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 0x8CD3; - int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 0x8CD2; - int GL_FRAMEBUFFER_BINDING_OES = 0x8CA6; - int GL_FRAMEBUFFER_COMPLETE_OES = 0x8CD5; - int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 0x8CD6; - int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 0x8CD9; - int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES = 0x8CDB; - int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 0x8CDA; - int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 0x8CD7; - int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES = 0x8CDC; - int GL_FRAMEBUFFER_OES = 0x8D40; - int GL_FRAMEBUFFER_UNSUPPORTED_OES = 0x8CDD; - int GL_FUNC_ADD = 0x8006; - int GL_FUNC_REVERSE_SUBTRACT = 0x800B; - int GL_FUNC_SUBTRACT = 0x800A; - int GL_INCR_WRAP = 0x8507; - int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 0x0506; - int GL_MAX_COLOR_ATTACHMENTS_OES = 0x8CDF; - int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; - int GL_MAX_RENDERBUFFER_SIZE_OES = 0x84E8; - int GL_MIRRORED_REPEAT = 0x8370; - int GL_NORMAL_MAP = 0x8511; - int GL_REFLECTION_MAP = 0x8512; - int GL_RENDERBUFFER_ALPHA_SIZE_OES = 0x8D53; - int GL_RENDERBUFFER_BINDING_OES = 0x8CA7; - int GL_RENDERBUFFER_BLUE_SIZE_OES = 0x8D52; - int GL_RENDERBUFFER_DEPTH_SIZE_OES = 0x8D54; - int GL_RENDERBUFFER_GREEN_SIZE_OES = 0x8D51; - int GL_RENDERBUFFER_HEIGHT_OES = 0x8D43; - int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 0x8D44; - int GL_RENDERBUFFER_OES = 0x8D41; - int GL_RENDERBUFFER_RED_SIZE_OES = 0x8D50; - int GL_RENDERBUFFER_STENCIL_SIZE_OES = 0x8D55; - int GL_RENDERBUFFER_WIDTH_OES = 0x8D42; - int GL_RGB5_A1 = 0x8057; - int GL_RGB565_OES = 0x8D62; - int GL_RGB8 = 0x8051; - int GL_RGBA4 = 0x8056; - int GL_RGBA8 = 0x8058; - int GL_STENCIL_ATTACHMENT_OES = 0x8D20; - int GL_STENCIL_INDEX = 0x1901; - int GL_STENCIL_INDEX1_OES = 0x8D46; - int GL_STENCIL_INDEX4_OES = 0x8D47; - int GL_STENCIL_INDEX8_OES = 0x8D48; - int GL_STR = -1; - int GL_TEXTURE_BINDING_CUBE_MAP = 0x8514; - int GL_TEXTURE_CUBE_MAP = 0x8513; - int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; - int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; - int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; - int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; - int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; - int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; - int GL_TEXTURE_GEN_MODE = 0x2500; - int GL_TEXTURE_GEN_STR = 0x8D60; - diff --git a/opengl/tools/glgen/stubs/GL11Header.java-if b/opengl/tools/glgen/stubs/GL11Header.java-if deleted file mode 100644 index b0e5a6b..0000000 --- a/opengl/tools/glgen/stubs/GL11Header.java-if +++ /dev/null @@ -1,145 +0,0 @@ -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -// This source file is automatically generated - -package javax.microedition.khronos.opengles; - -public interface GL11 extends GL10 { - int GL_ACTIVE_TEXTURE = 0x84E0; - int GL_ADD_SIGNED = 0x8574; - int GL_ALPHA_SCALE = 0x0D1C; - int GL_ALPHA_TEST_FUNC = 0x0BC1; - int GL_ALPHA_TEST_REF = 0x0BC2; - int GL_ARRAY_BUFFER = 0x8892; - int GL_ARRAY_BUFFER_BINDING = 0x8894; - int GL_BLEND_DST = 0x0BE0; - int GL_BLEND_SRC = 0x0BE1; - int GL_BUFFER_ACCESS = 0x88BB; - int GL_BUFFER_SIZE = 0x8764; - int GL_BUFFER_USAGE = 0x8765; - int GL_CLIENT_ACTIVE_TEXTURE = 0x84E1; - int GL_CLIP_PLANE0 = 0x3000; - int GL_CLIP_PLANE1 = 0x3001; - int GL_CLIP_PLANE2 = 0x3002; - int GL_CLIP_PLANE3 = 0x3003; - int GL_CLIP_PLANE4 = 0x3004; - int GL_CLIP_PLANE5 = 0x3005; - int GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898; - int GL_COLOR_ARRAY_POINTER = 0x8090; - int GL_COLOR_ARRAY_SIZE = 0x8081; - int GL_COLOR_ARRAY_STRIDE = 0x8083; - int GL_COLOR_ARRAY_TYPE = 0x8082; - int GL_COLOR_CLEAR_VALUE = 0x0C22; - int GL_COLOR_WRITEMASK = 0x0C23; - int GL_COMBINE = 0x8570; - int GL_COMBINE_ALPHA = 0x8572; - int GL_COMBINE_RGB = 0x8571; - int GL_CONSTANT = 0x8576; - int GL_COORD_REPLACE_OES = 0x8862; - int GL_CULL_FACE_MODE = 0x0B45; - int GL_CURRENT_COLOR = 0x0B00; - int GL_CURRENT_NORMAL = 0x0B02; - int GL_CURRENT_TEXTURE_COORDS = 0x0B03; - int GL_DEPTH_CLEAR_VALUE = 0x0B73; - int GL_DEPTH_FUNC = 0x0B74; - int GL_DEPTH_RANGE = 0x0B70; - int GL_DEPTH_WRITEMASK = 0x0B72; - int GL_DOT3_RGB = 0x86AE; - int GL_DOT3_RGBA = 0x86AF; - int GL_DYNAMIC_DRAW = 0x88E8; - int GL_ELEMENT_ARRAY_BUFFER = 0x8893; - int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; - int GL_FRONT_FACE = 0x0B46; - int GL_GENERATE_MIPMAP = 0x8191; - int GL_GENERATE_MIPMAP_HINT = 0x8192; - int GL_INTERPOLATE = 0x8575; - int GL_LINE_WIDTH = 0x0B21; - int GL_LOGIC_OP_MODE = 0x0BF0; - int GL_MATRIX_MODE = 0x0BA0; - int GL_MAX_CLIP_PLANES = 0x0D32; - int GL_MODELVIEW_MATRIX = 0x0BA6; - int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898D; - int GL_MODELVIEW_STACK_DEPTH = 0x0BA3; - int GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897; - int GL_NORMAL_ARRAY_POINTER = 0x808F; - int GL_NORMAL_ARRAY_STRIDE = 0x807F; - int GL_NORMAL_ARRAY_TYPE = 0x807E; - int GL_OPERAND0_ALPHA = 0x8598; - int GL_OPERAND0_RGB = 0x8590; - int GL_OPERAND1_ALPHA = 0x8599; - int GL_OPERAND1_RGB = 0x8591; - int GL_OPERAND2_ALPHA = 0x859A; - int GL_OPERAND2_RGB = 0x8592; - int GL_POINT_DISTANCE_ATTENUATION = 0x8129; - int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; - int GL_POINT_SIZE = 0x0B11; - int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 0x8B9F; - int GL_POINT_SIZE_ARRAY_OES = 0x8B9C; - int GL_POINT_SIZE_ARRAY_POINTER_OES = 0x898C; - int GL_POINT_SIZE_ARRAY_STRIDE_OES = 0x898B; - int GL_POINT_SIZE_ARRAY_TYPE_OES = 0x898A; - int GL_POINT_SIZE_MAX = 0x8127; - int GL_POINT_SIZE_MIN = 0x8126; - int GL_POINT_SPRITE_OES = 0x8861; - int GL_POLYGON_OFFSET_FACTOR = 0x8038; - int GL_POLYGON_OFFSET_UNITS = 0x2A00; - int GL_PREVIOUS = 0x8578; - int GL_PRIMARY_COLOR = 0x8577; - int GL_PROJECTION_MATRIX = 0x0BA7; - int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E; - int GL_PROJECTION_STACK_DEPTH = 0x0BA4; - int GL_RGB_SCALE = 0x8573; - int GL_SAMPLE_BUFFERS = 0x80A8; - int GL_SAMPLE_COVERAGE_INVERT = 0x80AB; - int GL_SAMPLE_COVERAGE_VALUE = 0x80AA; - int GL_SAMPLES = 0x80A9; - int GL_SCISSOR_BOX = 0x0C10; - int GL_SHADE_MODEL = 0x0B54; - int GL_SRC0_ALPHA = 0x8588; - int GL_SRC0_RGB = 0x8580; - int GL_SRC1_ALPHA = 0x8589; - int GL_SRC1_RGB = 0x8581; - int GL_SRC2_ALPHA = 0x858A; - int GL_SRC2_RGB = 0x8582; - int GL_STATIC_DRAW = 0x88E4; - int GL_STENCIL_CLEAR_VALUE = 0x0B91; - int GL_STENCIL_FAIL = 0x0B94; - int GL_STENCIL_FUNC = 0x0B92; - int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95; - int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96; - int GL_STENCIL_REF = 0x0B97; - int GL_STENCIL_VALUE_MASK = 0x0B93; - int GL_STENCIL_WRITEMASK = 0x0B98; - int GL_SUBTRACT = 0x84E7; - int GL_TEXTURE_BINDING_2D = 0x8069; - int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A; - int GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092; - int GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088; - int GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A; - int GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089; - int GL_TEXTURE_MATRIX = 0x0BA8; - int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898F; - int GL_TEXTURE_STACK_DEPTH = 0x0BA5; - int GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896; - int GL_VERTEX_ARRAY_POINTER = 0x808E; - int GL_VERTEX_ARRAY_SIZE = 0x807A; - int GL_VERTEX_ARRAY_STRIDE = 0x807C; - int GL_VERTEX_ARRAY_TYPE = 0x807B; - int GL_VIEWPORT = 0x0BA2; - int GL_WRITE_ONLY = 0x88B9; - - void glGetPointerv(int pname, java.nio.Buffer[] params); diff --git a/opengl/tools/glgen/stubs/GL11ImplHeader.java-impl b/opengl/tools/glgen/stubs/GL11ImplHeader.java-impl deleted file mode 100644 index 501be65..0000000 --- a/opengl/tools/glgen/stubs/GL11ImplHeader.java-impl +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -// All Rights Reserved. - -// This source file is automatically generated - -package com.google.android.gles_jni; - -import java.nio.Buffer; -import javax.microedition.khronos.opengles.GL11; -import android.graphics.Canvas; - -public class GL11Impl implements GL11 { - - // Private accessors for native code - - native private static void _nativeClassInit(); - static { - _nativeClassInit(); - } - - Buffer _colorPointer = null; - Buffer _normalPointer = null; - Buffer _texCoordPointer = null; - Buffer _vertexPointer = null; - - public GL11Impl() { - } - - diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/GLCHeader.cpp deleted file mode 100644 index 6495686..0000000 --- a/opengl/tools/glgen/stubs/GLCHeader.cpp +++ /dev/null @@ -1,129 +0,0 @@ -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -// This source file is automatically generated - -#include -#include - -#include -#include - -#include - -#define _NUM_COMPRESSED_TEXTURE_FORMATS \ - (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS) - -static int initialized = 0; - -static jclass nioAccessClass; -static jclass bufferClass; -static jclass OOMEClass; -static jclass UOEClass; -static jclass IAEClass; -static jclass AIOOBEClass; -static jmethodID getBasePointerID; -static jmethodID getBaseArrayID; -static jmethodID getBaseArrayOffsetID; -static jfieldID positionID; -static jfieldID limitID; -static jfieldID elementSizeShiftID; - -/* Cache method IDs each time the class is loaded. */ - -void -nativeClassInitBuffer(JNIEnv *_env) -{ - jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); - nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); - - jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); - bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); - - getBasePointerID = _env->GetStaticMethodID(nioAccessClass, - "getBasePointer", "(Ljava/nio/Buffer;)J"); - getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); - getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); - - positionID = _env->GetFieldID(bufferClass, "position", "I"); - limitID = _env->GetFieldID(bufferClass, "limit", "I"); - elementSizeShiftID = - _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); -} - - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - nativeClassInitBuffer(_env); - - jclass IAEClassLocal = - _env->FindClass("java/lang/IllegalArgumentException"); - jclass OOMEClassLocal = - _env->FindClass("java/lang/OutOfMemoryError"); - jclass UOEClassLocal = - _env->FindClass("java/lang/UnsupportedOperationException"); - jclass AIOOBEClassLocal = - _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); - - IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); - OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); - UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); - AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); -} - -static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) -{ - jint position; - jint limit; - jint elementSizeShift; - jlong pointer; - jint offset; - void *data; - - position = _env->GetIntField(buffer, positionID); - limit = _env->GetIntField(buffer, limitID); - elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - *remaining = (limit - position) << elementSizeShift; - pointer = _env->CallStaticLongMethod(nioAccessClass, - getBasePointerID, buffer); - if (pointer != 0L) { - *array = NULL; - return (void *) (jint) pointer; - } - - *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, - getBaseArrayID, buffer); - offset = _env->CallStaticIntMethod(nioAccessClass, - getBaseArrayOffsetID, buffer); - data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - - return (void *) ((char *) data + offset); -} - - -static void -releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) -{ - _env->ReleasePrimitiveArrayCritical(array, data, - commit ? 0 : JNI_ABORT); -} - -// -------------------------------------------------------------------------- - diff --git a/opengl/tools/glgen/stubs/GLHeader.java-if b/opengl/tools/glgen/stubs/GLHeader.java-if deleted file mode 100644 index 3b78f3d..0000000 --- a/opengl/tools/glgen/stubs/GLHeader.java-if +++ /dev/null @@ -1,22 +0,0 @@ -/* //device/java/android/javax/microedition/khronos/opengles/GL.java -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -package javax.microedition.khronos.opengles; - -public interface GL { -} - diff --git a/opengl/tools/glgen/stubs/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/GLImplHeader.java-impl deleted file mode 100644 index db3a41c..0000000 --- a/opengl/tools/glgen/stubs/GLImplHeader.java-impl +++ /dev/null @@ -1,48 +0,0 @@ -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -// This source file is automatically generated - -package com.google.android.gles_jni; - -import java.nio.Buffer; -import javax.microedition.khronos.opengles.GL10; -import javax.microedition.khronos.opengles.GL10Ext; -import javax.microedition.khronos.opengles.GL11; -import javax.microedition.khronos.opengles.GL11Ext; -import javax.microedition.khronos.opengles.GL11ExtensionPack; - -public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack { - - // Private accessors for native code - - native private static void _nativeClassInit(); - static { - _nativeClassInit(); - } - - Buffer _colorPointer = null; - Buffer _normalPointer = null; - Buffer _texCoordPointer = null; - Buffer _vertexPointer = null; - - public GLImpl() { - } - - public void glGetPointerv(int pname, java.nio.Buffer[] params) { - throw new UnsupportedOperationException("glGetPointerv"); - } - diff --git a/opengl/tools/glgen/stubs/glGetString.cpp b/opengl/tools/glgen/stubs/glGetString.cpp deleted file mode 100644 index 22e1297..0000000 --- a/opengl/tools/glgen/stubs/glGetString.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -/* const GLubyte * glGetString ( GLenum name ) */ -jstring -android_glGetString - (JNIEnv *_env, jobject _this, jint name) { - const char * chars = (const char *)glGetString((GLenum)name); - jstring output = _env->NewStringUTF(chars); - return output; -} diff --git a/opengl/tools/glgen/stubs/glGetString.java-10-if b/opengl/tools/glgen/stubs/glGetString.java-10-if deleted file mode 100644 index 898fabc..0000000 --- a/opengl/tools/glgen/stubs/glGetString.java-10-if +++ /dev/null @@ -1,4 +0,0 @@ - public String glGetString( - int name - ); - diff --git a/opengl/tools/glgen/stubs/glGetString.java-if b/opengl/tools/glgen/stubs/glGetString.java-if deleted file mode 100644 index 898fabc..0000000 --- a/opengl/tools/glgen/stubs/glGetString.java-if +++ /dev/null @@ -1,4 +0,0 @@ - public String glGetString( - int name - ); - diff --git a/opengl/tools/glgen/stubs/glGetString.java-impl b/opengl/tools/glgen/stubs/glGetString.java-impl deleted file mode 100644 index 8c7881c..0000000 --- a/opengl/tools/glgen/stubs/glGetString.java-impl +++ /dev/null @@ -1,16 +0,0 @@ - // C function const GLubyte * glGetString ( GLenum name ) - - public native String _glGetString( - int name - ); - - public String glGetString( - int name - ) { - String returnValue; - returnValue = _glGetString( - name - ); - return returnValue; - } - diff --git a/opengl/tools/glgen/stubs/glGetString.nativeReg b/opengl/tools/glgen/stubs/glGetString.nativeReg deleted file mode 100644 index e64187c..0000000 --- a/opengl/tools/glgen/stubs/glGetString.nativeReg +++ /dev/null @@ -1 +0,0 @@ -{"_glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if new file mode 100644 index 0000000..42891ea --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if @@ -0,0 +1,26 @@ +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package android.opengl; + +public class GLES10Ext { + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } + \ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp new file mode 100644 index 0000000..3e5c19c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp @@ -0,0 +1,129 @@ +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include +#include + +#include +#include + +#include + +#define _NUM_COMPRESSED_TEXTURE_FORMATS \ + (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS) + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- + diff --git a/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if new file mode 100644 index 0000000..4b2a831 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if @@ -0,0 +1,271 @@ +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package android.opengl; + +import java.nio.Buffer; + +public class GLES10 { + public static final int GL_ADD = 0x0104; + public static final int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E; + public static final int GL_ALIASED_POINT_SIZE_RANGE = 0x846D; + public static final int GL_ALPHA = 0x1906; + public static final int GL_ALPHA_BITS = 0x0D55; + public static final int GL_ALPHA_TEST = 0x0BC0; + public static final int GL_ALWAYS = 0x0207; + public static final int GL_AMBIENT = 0x1200; + public static final int GL_AMBIENT_AND_DIFFUSE = 0x1602; + public static final int GL_AND = 0x1501; + public static final int GL_AND_INVERTED = 0x1504; + public static final int GL_AND_REVERSE = 0x1502; + public static final int GL_BACK = 0x0405; + public static final int GL_BLEND = 0x0BE2; + public static final int GL_BLUE_BITS = 0x0D54; + public static final int GL_BYTE = 0x1400; + public static final int GL_CCW = 0x0901; + public static final int GL_CLAMP_TO_EDGE = 0x812F; + public static final int GL_CLEAR = 0x1500; + public static final int GL_COLOR_ARRAY = 0x8076; + public static final int GL_COLOR_BUFFER_BIT = 0x4000; + public static final int GL_COLOR_LOGIC_OP = 0x0BF2; + public static final int GL_COLOR_MATERIAL = 0x0B57; + public static final int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3; + public static final int GL_CONSTANT_ATTENUATION = 0x1207; + public static final int GL_COPY = 0x1503; + public static final int GL_COPY_INVERTED = 0x150C; + public static final int GL_CULL_FACE = 0x0B44; + public static final int GL_CW = 0x0900; + public static final int GL_DECAL = 0x2101; + public static final int GL_DECR = 0x1E03; + public static final int GL_DEPTH_BITS = 0x0D56; + public static final int GL_DEPTH_BUFFER_BIT = 0x0100; + public static final int GL_DEPTH_TEST = 0x0B71; + public static final int GL_DIFFUSE = 0x1201; + public static final int GL_DITHER = 0x0BD0; + public static final int GL_DONT_CARE = 0x1100; + public static final int GL_DST_ALPHA = 0x0304; + public static final int GL_DST_COLOR = 0x0306; + public static final int GL_EMISSION = 0x1600; + public static final int GL_EQUAL = 0x0202; + public static final int GL_EQUIV = 0x1509; + public static final int GL_EXP = 0x0800; + public static final int GL_EXP2 = 0x0801; + public static final int GL_EXTENSIONS = 0x1F03; + public static final int GL_FALSE = 0; + public static final int GL_FASTEST = 0x1101; + public static final int GL_FIXED = 0x140C; + public static final int GL_FLAT = 0x1D00; + public static final int GL_FLOAT = 0x1406; + public static final int GL_FOG = 0x0B60; + public static final int GL_FOG_COLOR = 0x0B66; + public static final int GL_FOG_DENSITY = 0x0B62; + public static final int GL_FOG_END = 0x0B64; + public static final int GL_FOG_HINT = 0x0C54; + public static final int GL_FOG_MODE = 0x0B65; + public static final int GL_FOG_START = 0x0B63; + public static final int GL_FRONT = 0x0404; + public static final int GL_FRONT_AND_BACK = 0x0408; + public static final int GL_GEQUAL = 0x0206; + public static final int GL_GREATER = 0x0204; + public static final int GL_GREEN_BITS = 0x0D53; + public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 0x8B9B; + public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 0x8B9A; + public static final int GL_INCR = 0x1E02; + public static final int GL_INVALID_ENUM = 0x0500; + public static final int GL_INVALID_OPERATION = 0x0502; + public static final int GL_INVALID_VALUE = 0x0501; + public static final int GL_INVERT = 0x150A; + public static final int GL_KEEP = 0x1E00; + public static final int GL_LEQUAL = 0x0203; + public static final int GL_LESS = 0x0201; + public static final int GL_LIGHT_MODEL_AMBIENT = 0x0B53; + public static final int GL_LIGHT_MODEL_TWO_SIDE = 0x0B52; + public static final int GL_LIGHT0 = 0x4000; + public static final int GL_LIGHT1 = 0x4001; + public static final int GL_LIGHT2 = 0x4002; + public static final int GL_LIGHT3 = 0x4003; + public static final int GL_LIGHT4 = 0x4004; + public static final int GL_LIGHT5 = 0x4005; + public static final int GL_LIGHT6 = 0x4006; + public static final int GL_LIGHT7 = 0x4007; + public static final int GL_LIGHTING = 0x0B50; + public static final int GL_LINE_LOOP = 0x0002; + public static final int GL_LINE_SMOOTH = 0x0B20; + public static final int GL_LINE_SMOOTH_HINT = 0x0C52; + public static final int GL_LINE_STRIP = 0x0003; + public static final int GL_LINEAR = 0x2601; + public static final int GL_LINEAR_ATTENUATION = 0x1208; + public static final int GL_LINEAR_MIPMAP_LINEAR = 0x2703; + public static final int GL_LINEAR_MIPMAP_NEAREST = 0x2701; + public static final int GL_LINES = 0x0001; + public static final int GL_LUMINANCE = 0x1909; + public static final int GL_LUMINANCE_ALPHA = 0x190A; + public static final int GL_MAX_ELEMENTS_INDICES = 0x80E9; + public static final int GL_MAX_ELEMENTS_VERTICES = 0x80E8; + public static final int GL_MAX_LIGHTS = 0x0D31; + public static final int GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36; + public static final int GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38; + public static final int GL_MAX_TEXTURE_SIZE = 0x0D33; + public static final int GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39; + public static final int GL_MAX_TEXTURE_UNITS = 0x84E2; + public static final int GL_MAX_VIEWPORT_DIMS = 0x0D3A; + public static final int GL_MODELVIEW = 0x1700; + public static final int GL_MODULATE = 0x2100; + public static final int GL_MULTISAMPLE = 0x809D; + public static final int GL_NAND = 0x150E; + public static final int GL_NEAREST = 0x2600; + public static final int GL_NEAREST_MIPMAP_LINEAR = 0x2702; + public static final int GL_NEAREST_MIPMAP_NEAREST = 0x2700; + public static final int GL_NEVER = 0x0200; + public static final int GL_NICEST = 0x1102; + public static final int GL_NO_ERROR = 0; + public static final int GL_NOOP = 0x1505; + public static final int GL_NOR = 0x1508; + public static final int GL_NORMAL_ARRAY = 0x8075; + public static final int GL_NORMALIZE = 0x0BA1; + public static final int GL_NOTEQUAL = 0x0205; + public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; + public static final int GL_ONE = 1; + public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305; + public static final int GL_ONE_MINUS_DST_COLOR = 0x0307; + public static final int GL_ONE_MINUS_SRC_ALPHA = 0x0303; + public static final int GL_ONE_MINUS_SRC_COLOR = 0x0301; + public static final int GL_OR = 0x1507; + public static final int GL_OR_INVERTED = 0x150D; + public static final int GL_OR_REVERSE = 0x150B; + public static final int GL_OUT_OF_MEMORY = 0x0505; + public static final int GL_PACK_ALIGNMENT = 0x0D05; + public static final int GL_PALETTE4_R5_G6_B5_OES = 0x8B92; + public static final int GL_PALETTE4_RGB5_A1_OES = 0x8B94; + public static final int GL_PALETTE4_RGB8_OES = 0x8B90; + public static final int GL_PALETTE4_RGBA4_OES = 0x8B93; + public static final int GL_PALETTE4_RGBA8_OES = 0x8B91; + public static final int GL_PALETTE8_R5_G6_B5_OES = 0x8B97; + public static final int GL_PALETTE8_RGB5_A1_OES = 0x8B99; + public static final int GL_PALETTE8_RGB8_OES = 0x8B95; + public static final int GL_PALETTE8_RGBA4_OES = 0x8B98; + public static final int GL_PALETTE8_RGBA8_OES = 0x8B96; + public static final int GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50; + public static final int GL_POINT_SMOOTH = 0x0B10; + public static final int GL_POINT_SMOOTH_HINT = 0x0C51; + public static final int GL_POINTS = 0x0000; + public static final int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; + public static final int GL_POINT_SIZE = 0x0B11; + public static final int GL_POLYGON_OFFSET_FILL = 0x8037; + public static final int GL_POLYGON_SMOOTH_HINT = 0x0C53; + public static final int GL_POSITION = 0x1203; + public static final int GL_PROJECTION = 0x1701; + public static final int GL_QUADRATIC_ATTENUATION = 0x1209; + public static final int GL_RED_BITS = 0x0D52; + public static final int GL_RENDERER = 0x1F01; + public static final int GL_REPEAT = 0x2901; + public static final int GL_REPLACE = 0x1E01; + public static final int GL_RESCALE_NORMAL = 0x803A; + public static final int GL_RGB = 0x1907; + public static final int GL_RGBA = 0x1908; + public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + public static final int GL_SAMPLE_ALPHA_TO_ONE = 0x809F; + public static final int GL_SAMPLE_COVERAGE = 0x80A0; + public static final int GL_SCISSOR_TEST = 0x0C11; + public static final int GL_SET = 0x150F; + public static final int GL_SHININESS = 0x1601; + public static final int GL_SHORT = 0x1402; + public static final int GL_SMOOTH = 0x1D01; + public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22; + public static final int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12; + public static final int GL_SPECULAR = 0x1202; + public static final int GL_SPOT_CUTOFF = 0x1206; + public static final int GL_SPOT_DIRECTION = 0x1204; + public static final int GL_SPOT_EXPONENT = 0x1205; + public static final int GL_SRC_ALPHA = 0x0302; + public static final int GL_SRC_ALPHA_SATURATE = 0x0308; + public static final int GL_SRC_COLOR = 0x0300; + public static final int GL_STACK_OVERFLOW = 0x0503; + public static final int GL_STACK_UNDERFLOW = 0x0504; + public static final int GL_STENCIL_BITS = 0x0D57; + public static final int GL_STENCIL_BUFFER_BIT = 0x0400; + public static final int GL_STENCIL_TEST = 0x0B90; + public static final int GL_SUBPIXEL_BITS = 0x0D50; + public static final int GL_TEXTURE = 0x1702; + public static final int GL_TEXTURE_2D = 0x0DE1; + public static final int GL_TEXTURE_COORD_ARRAY = 0x8078; + public static final int GL_TEXTURE_ENV = 0x2300; + public static final int GL_TEXTURE_ENV_COLOR = 0x2201; + public static final int GL_TEXTURE_ENV_MODE = 0x2200; + public static final int GL_TEXTURE_MAG_FILTER = 0x2800; + public static final int GL_TEXTURE_MIN_FILTER = 0x2801; + public static final int GL_TEXTURE_WRAP_S = 0x2802; + public static final int GL_TEXTURE_WRAP_T = 0x2803; + public static final int GL_TEXTURE0 = 0x84C0; + public static final int GL_TEXTURE1 = 0x84C1; + public static final int GL_TEXTURE2 = 0x84C2; + public static final int GL_TEXTURE3 = 0x84C3; + public static final int GL_TEXTURE4 = 0x84C4; + public static final int GL_TEXTURE5 = 0x84C5; + public static final int GL_TEXTURE6 = 0x84C6; + public static final int GL_TEXTURE7 = 0x84C7; + public static final int GL_TEXTURE8 = 0x84C8; + public static final int GL_TEXTURE9 = 0x84C9; + public static final int GL_TEXTURE10 = 0x84CA; + public static final int GL_TEXTURE11 = 0x84CB; + public static final int GL_TEXTURE12 = 0x84CC; + public static final int GL_TEXTURE13 = 0x84CD; + public static final int GL_TEXTURE14 = 0x84CE; + public static final int GL_TEXTURE15 = 0x84CF; + public static final int GL_TEXTURE16 = 0x84D0; + public static final int GL_TEXTURE17 = 0x84D1; + public static final int GL_TEXTURE18 = 0x84D2; + public static final int GL_TEXTURE19 = 0x84D3; + public static final int GL_TEXTURE20 = 0x84D4; + public static final int GL_TEXTURE21 = 0x84D5; + public static final int GL_TEXTURE22 = 0x84D6; + public static final int GL_TEXTURE23 = 0x84D7; + public static final int GL_TEXTURE24 = 0x84D8; + public static final int GL_TEXTURE25 = 0x84D9; + public static final int GL_TEXTURE26 = 0x84DA; + public static final int GL_TEXTURE27 = 0x84DB; + public static final int GL_TEXTURE28 = 0x84DC; + public static final int GL_TEXTURE29 = 0x84DD; + public static final int GL_TEXTURE30 = 0x84DE; + public static final int GL_TEXTURE31 = 0x84DF; + public static final int GL_TRIANGLE_FAN = 0x0006; + public static final int GL_TRIANGLE_STRIP = 0x0005; + public static final int GL_TRIANGLES = 0x0004; + public static final int GL_TRUE = 1; + public static final int GL_UNPACK_ALIGNMENT = 0x0CF5; + public static final int GL_UNSIGNED_BYTE = 0x1401; + public static final int GL_UNSIGNED_SHORT = 0x1403; + public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; + public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; + public static final int GL_UNSIGNED_SHORT_5_6_5 = 0x8363; + public static final int GL_VENDOR = 0x1F00; + public static final int GL_VERSION = 0x1F02; + public static final int GL_VERTEX_ARRAY = 0x8074; + public static final int GL_XOR = 0x1506; + public static final int GL_ZERO = 0; + + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } + + private static Buffer _colorPointer; + private static Buffer _normalPointer; + private static Buffer _texCoordPointer; + private static Buffer _vertexPointer; + diff --git a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp new file mode 100644 index 0000000..3e5c19c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp @@ -0,0 +1,129 @@ +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include +#include + +#include +#include + +#include + +#define _NUM_COMPRESSED_TEXTURE_FORMATS \ + (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS) + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- + diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if new file mode 100644 index 0000000..428ccee --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if @@ -0,0 +1,130 @@ +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package android.opengl; + +public class GLES11Ext { + public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009; + public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D; + public static final int GL_BLEND_DST_RGB_OES = 0x80C8; + public static final int GL_BLEND_SRC_RGB_OES = 0x80C9; + public static final int GL_BLEND_DST_ALPHA_OES = 0x80CA; + public static final int GL_BLEND_SRC_ALPHA_OES = 0x80CB; + public static final int GL_BLEND_EQUATION_OES = 0x8009; + public static final int GL_FUNC_ADD_OES = 0x8006; + public static final int GL_FUNC_SUBTRACT_OES = 0x800A; + public static final int GL_FUNC_REVERSE_SUBTRACT_OES = 0x800B; + public static final int GL_ETC1_RGB8_OES = 0x8D64; + public static final int GL_DEPTH_COMPONENT24_OES = 0x81A6; + public static final int GL_DEPTH_COMPONENT32_OES = 0x81A7; + public static final int GL_TEXTURE_CROP_RECT_OES = 0x8B9D; + public static final int GL_FIXED_OES = 0x140C; + public static final int GL_NONE_OES = 0; + public static final int GL_FRAMEBUFFER_OES = 0x8D40; + public static final int GL_RENDERBUFFER_OES = 0x8D41; + public static final int GL_RGBA4_OES = 0x8056; + public static final int GL_RGB5_A1_OES = 0x8057; + public static final int GL_RGB565_OES = 0x8D62; + public static final int GL_DEPTH_COMPONENT16_OES = 0x81A5; + public static final int GL_RENDERBUFFER_WIDTH_OES = 0x8D42; + public static final int GL_RENDERBUFFER_HEIGHT_OES = 0x8D43; + public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 0x8D44; + public static final int GL_RENDERBUFFER_RED_SIZE_OES = 0x8D50; + public static final int GL_RENDERBUFFER_GREEN_SIZE_OES = 0x8D51; + public static final int GL_RENDERBUFFER_BLUE_SIZE_OES = 0x8D52; + public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES = 0x8D53; + public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES = 0x8D54; + public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES = 0x8D55; + public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 0x8CD0; + public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 0x8CD1; + public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 0x8CD2; + public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 0x8CD3; + public static final int GL_COLOR_ATTACHMENT0_OES = 0x8CE0; + public static final int GL_DEPTH_ATTACHMENT_OES = 0x8D00; + public static final int GL_STENCIL_ATTACHMENT_OES = 0x8D20; + public static final int GL_FRAMEBUFFER_COMPLETE_OES = 0x8CD5; + public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 0x8CD6; + public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 0x8CD7; + public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 0x8CD9; + public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 0x8CDA; + public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES = 0x8CDD; + public static final int GL_FRAMEBUFFER_BINDING_OES = 0x8CA6; + public static final int GL_RENDERBUFFER_BINDING_OES = 0x8CA7; + public static final int GL_MAX_RENDERBUFFER_SIZE_OES = 0x84E8; + public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 0x0506; + public static final int GL_WRITE_ONLY_OES = 0x88B9; + public static final int GL_BUFFER_ACCESS_OES = 0x88BB; + public static final int GL_BUFFER_MAPPED_OES = 0x88BC; + public static final int GL_BUFFER_MAP_POINTER_OES = 0x88BD; + public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898D; + public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E; + public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898F; + public static final int GL_MAX_VERTEX_UNITS_OES = 0x86A4; + public static final int GL_MAX_PALETTE_MATRICES_OES = 0x8842; + public static final int GL_MATRIX_PALETTE_OES = 0x8840; + public static final int GL_MATRIX_INDEX_ARRAY_OES = 0x8844; + public static final int GL_WEIGHT_ARRAY_OES = 0x86AD; + public static final int GL_CURRENT_PALETTE_MATRIX_OES = 0x8843; + public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 0x8846; + public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 0x8847; + public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 0x8848; + public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 0x8849; + public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 0x8B9E; + public static final int GL_WEIGHT_ARRAY_SIZE_OES = 0x86AB; + public static final int GL_WEIGHT_ARRAY_TYPE_OES = 0x86A9; + public static final int GL_WEIGHT_ARRAY_STRIDE_OES = 0x86AA; + public static final int GL_WEIGHT_ARRAY_POINTER_OES = 0x86AC; + public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 0x889E; + public static final int GL_DEPTH_STENCIL_OES = 0x84F9; + public static final int GL_UNSIGNED_INT_24_8_OES = 0x84FA; + public static final int GL_DEPTH24_STENCIL8_OES = 0x88F0; + public static final int GL_RGB8_OES = 0x8051; + public static final int GL_RGBA8_OES = 0x8058; + public static final int GL_STENCIL_INDEX1_OES = 0x8D46; + public static final int GL_STENCIL_INDEX4_OES = 0x8D47; + public static final int GL_STENCIL_INDEX8_OES = 0x8D48; + public static final int GL_INCR_WRAP_OES = 0x8507; + public static final int GL_DECR_WRAP_OES = 0x8508; + public static final int GL_NORMAL_MAP_OES = 0x8511; + public static final int GL_REFLECTION_MAP_OES = 0x8512; + public static final int GL_TEXTURE_CUBE_MAP_OES = 0x8513; + public static final int GL_TEXTURE_BINDING_CUBE_MAP_OES = 0x8514; + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES = 0x8515; + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES = 0x8516; + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES = 0x8517; + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES = 0x8518; + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES = 0x8519; + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES = 0x851A; + public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES = 0x851C; + public static final int GL_TEXTURE_GEN_MODE_OES = 0x2500; + public static final int GL_TEXTURE_GEN_STR_OES = 0x8D60; + public static final int GL_MIRRORED_REPEAT_OES = 0x8370; + public static final int GL_3DC_X_AMD = 0x87F9; + public static final int GL_3DC_XY_AMD = 0x87FA; + public static final int GL_ATC_RGB_AMD = 0x8C92; + public static final int GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = 0x8C93; + public static final int GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = 0x87EE; + public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; + public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; + public static final int GL_BGRA = 0x80E1; + + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } + \ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp new file mode 100644 index 0000000..3e5c19c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp @@ -0,0 +1,129 @@ +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include +#include + +#include +#include + +#include + +#define _NUM_COMPRESSED_TEXTURE_FORMATS \ + (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS) + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- + diff --git a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if new file mode 100644 index 0000000..26f466f --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if @@ -0,0 +1,151 @@ +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package android.opengl; + +import java.nio.Buffer; + +public class GLES11 extends GLES10 { + public static final int GL_ACTIVE_TEXTURE = 0x84E0; + public static final int GL_ADD_SIGNED = 0x8574; + public static final int GL_ALPHA_SCALE = 0x0D1C; + public static final int GL_ALPHA_TEST_FUNC = 0x0BC1; + public static final int GL_ALPHA_TEST_REF = 0x0BC2; + public static final int GL_ARRAY_BUFFER = 0x8892; + public static final int GL_ARRAY_BUFFER_BINDING = 0x8894; + public static final int GL_BLEND_DST = 0x0BE0; + public static final int GL_BLEND_SRC = 0x0BE1; + public static final int GL_BUFFER_ACCESS = 0x88BB; + public static final int GL_BUFFER_SIZE = 0x8764; + public static final int GL_BUFFER_USAGE = 0x8765; + public static final int GL_CLIENT_ACTIVE_TEXTURE = 0x84E1; + public static final int GL_CLIP_PLANE0 = 0x3000; + public static final int GL_CLIP_PLANE1 = 0x3001; + public static final int GL_CLIP_PLANE2 = 0x3002; + public static final int GL_CLIP_PLANE3 = 0x3003; + public static final int GL_CLIP_PLANE4 = 0x3004; + public static final int GL_CLIP_PLANE5 = 0x3005; + public static final int GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898; + public static final int GL_COLOR_ARRAY_POINTER = 0x8090; + public static final int GL_COLOR_ARRAY_SIZE = 0x8081; + public static final int GL_COLOR_ARRAY_STRIDE = 0x8083; + public static final int GL_COLOR_ARRAY_TYPE = 0x8082; + public static final int GL_COLOR_CLEAR_VALUE = 0x0C22; + public static final int GL_COLOR_WRITEMASK = 0x0C23; + public static final int GL_COMBINE = 0x8570; + public static final int GL_COMBINE_ALPHA = 0x8572; + public static final int GL_COMBINE_RGB = 0x8571; + public static final int GL_CONSTANT = 0x8576; + public static final int GL_COORD_REPLACE_OES = 0x8862; + public static final int GL_CULL_FACE_MODE = 0x0B45; + public static final int GL_CURRENT_COLOR = 0x0B00; + public static final int GL_CURRENT_NORMAL = 0x0B02; + public static final int GL_CURRENT_TEXTURE_COORDS = 0x0B03; + public static final int GL_DEPTH_CLEAR_VALUE = 0x0B73; + public static final int GL_DEPTH_FUNC = 0x0B74; + public static final int GL_DEPTH_RANGE = 0x0B70; + public static final int GL_DEPTH_WRITEMASK = 0x0B72; + public static final int GL_DOT3_RGB = 0x86AE; + public static final int GL_DOT3_RGBA = 0x86AF; + public static final int GL_DYNAMIC_DRAW = 0x88E8; + public static final int GL_ELEMENT_ARRAY_BUFFER = 0x8893; + public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + public static final int GL_FRONT_FACE = 0x0B46; + public static final int GL_GENERATE_MIPMAP = 0x8191; + public static final int GL_GENERATE_MIPMAP_HINT = 0x8192; + public static final int GL_INTERPOLATE = 0x8575; + public static final int GL_LINE_WIDTH = 0x0B21; + public static final int GL_LOGIC_OP_MODE = 0x0BF0; + public static final int GL_MATRIX_MODE = 0x0BA0; + public static final int GL_MAX_CLIP_PLANES = 0x0D32; + public static final int GL_MODELVIEW_MATRIX = 0x0BA6; + public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898D; + public static final int GL_MODELVIEW_STACK_DEPTH = 0x0BA3; + public static final int GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897; + public static final int GL_NORMAL_ARRAY_POINTER = 0x808F; + public static final int GL_NORMAL_ARRAY_STRIDE = 0x807F; + public static final int GL_NORMAL_ARRAY_TYPE = 0x807E; + public static final int GL_OPERAND0_ALPHA = 0x8598; + public static final int GL_OPERAND0_RGB = 0x8590; + public static final int GL_OPERAND1_ALPHA = 0x8599; + public static final int GL_OPERAND1_RGB = 0x8591; + public static final int GL_OPERAND2_ALPHA = 0x859A; + public static final int GL_OPERAND2_RGB = 0x8592; + public static final int GL_POINT_DISTANCE_ATTENUATION = 0x8129; + public static final int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; + public static final int GL_POINT_SIZE = 0x0B11; + public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 0x8B9F; + public static final int GL_POINT_SIZE_ARRAY_OES = 0x8B9C; + public static final int GL_POINT_SIZE_ARRAY_POINTER_OES = 0x898C; + public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES = 0x898B; + public static final int GL_POINT_SIZE_ARRAY_TYPE_OES = 0x898A; + public static final int GL_POINT_SIZE_MAX = 0x8127; + public static final int GL_POINT_SIZE_MIN = 0x8126; + public static final int GL_POINT_SPRITE_OES = 0x8861; + public static final int GL_POLYGON_OFFSET_FACTOR = 0x8038; + public static final int GL_POLYGON_OFFSET_UNITS = 0x2A00; + public static final int GL_PREVIOUS = 0x8578; + public static final int GL_PRIMARY_COLOR = 0x8577; + public static final int GL_PROJECTION_MATRIX = 0x0BA7; + public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E; + public static final int GL_PROJECTION_STACK_DEPTH = 0x0BA4; + public static final int GL_RGB_SCALE = 0x8573; + public static final int GL_SAMPLE_BUFFERS = 0x80A8; + public static final int GL_SAMPLE_COVERAGE_INVERT = 0x80AB; + public static final int GL_SAMPLE_COVERAGE_VALUE = 0x80AA; + public static final int GL_SAMPLES = 0x80A9; + public static final int GL_SCISSOR_BOX = 0x0C10; + public static final int GL_SHADE_MODEL = 0x0B54; + public static final int GL_SRC0_ALPHA = 0x8588; + public static final int GL_SRC0_RGB = 0x8580; + public static final int GL_SRC1_ALPHA = 0x8589; + public static final int GL_SRC1_RGB = 0x8581; + public static final int GL_SRC2_ALPHA = 0x858A; + public static final int GL_SRC2_RGB = 0x8582; + public static final int GL_STATIC_DRAW = 0x88E4; + public static final int GL_STENCIL_CLEAR_VALUE = 0x0B91; + public static final int GL_STENCIL_FAIL = 0x0B94; + public static final int GL_STENCIL_FUNC = 0x0B92; + public static final int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95; + public static final int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96; + public static final int GL_STENCIL_REF = 0x0B97; + public static final int GL_STENCIL_VALUE_MASK = 0x0B93; + public static final int GL_STENCIL_WRITEMASK = 0x0B98; + public static final int GL_SUBTRACT = 0x84E7; + public static final int GL_TEXTURE_BINDING_2D = 0x8069; + public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A; + public static final int GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092; + public static final int GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088; + public static final int GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A; + public static final int GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089; + public static final int GL_TEXTURE_MATRIX = 0x0BA8; + public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898F; + public static final int GL_TEXTURE_STACK_DEPTH = 0x0BA5; + public static final int GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896; + public static final int GL_VERTEX_ARRAY_POINTER = 0x808E; + public static final int GL_VERTEX_ARRAY_SIZE = 0x807A; + public static final int GL_VERTEX_ARRAY_STRIDE = 0x807C; + public static final int GL_VERTEX_ARRAY_TYPE = 0x807B; + public static final int GL_VIEWPORT = 0x0BA2; + public static final int GL_WRITE_ONLY = 0x88B9; + + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } + diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp new file mode 100644 index 0000000..3e5c19c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp @@ -0,0 +1,129 @@ +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include +#include + +#include +#include + +#include + +#define _NUM_COMPRESSED_TEXTURE_FORMATS \ + (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS) + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- + diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.cpp b/opengl/tools/glgen/stubs/gles11/glGetString.cpp new file mode 100644 index 0000000..a400859 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetString.cpp @@ -0,0 +1,11 @@ +#include + +/* const GLubyte * glGetString ( GLenum name ) */ +static +jstring +android_glGetString + (JNIEnv *_env, jobject _this, jint name) { + const char * chars = (const char *)glGetString((GLenum)name); + jstring output = _env->NewStringUTF(chars); + return output; +} diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.java b/opengl/tools/glgen/stubs/gles11/glGetString.java new file mode 100644 index 0000000..8c7881c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetString.java @@ -0,0 +1,16 @@ + // C function const GLubyte * glGetString ( GLenum name ) + + public native String _glGetString( + int name + ); + + public String glGetString( + int name + ) { + String returnValue; + returnValue = _glGetString( + name + ); + return returnValue; + } + diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg new file mode 100644 index 0000000..e64187c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg @@ -0,0 +1 @@ +{"_glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, diff --git a/opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if new file mode 100644 index 0000000..b0999c2 --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if @@ -0,0 +1,22 @@ +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package javax.microedition.khronos.opengles; + +public interface GL10Ext extends GL { + diff --git a/opengl/tools/glgen/stubs/jsr239/GL10Header.java-if b/opengl/tools/glgen/stubs/jsr239/GL10Header.java-if new file mode 100644 index 0000000..8392821 --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GL10Header.java-if @@ -0,0 +1,259 @@ +** +** Copyright 2006, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package javax.microedition.khronos.opengles; + +public interface GL10 extends GL { + int GL_ADD = 0x0104; + int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E; + int GL_ALIASED_POINT_SIZE_RANGE = 0x846D; + int GL_ALPHA = 0x1906; + int GL_ALPHA_BITS = 0x0D55; + int GL_ALPHA_TEST = 0x0BC0; + int GL_ALWAYS = 0x0207; + int GL_AMBIENT = 0x1200; + int GL_AMBIENT_AND_DIFFUSE = 0x1602; + int GL_AND = 0x1501; + int GL_AND_INVERTED = 0x1504; + int GL_AND_REVERSE = 0x1502; + int GL_BACK = 0x0405; + int GL_BLEND = 0x0BE2; + int GL_BLUE_BITS = 0x0D54; + int GL_BYTE = 0x1400; + int GL_CCW = 0x0901; + int GL_CLAMP_TO_EDGE = 0x812F; + int GL_CLEAR = 0x1500; + int GL_COLOR_ARRAY = 0x8076; + int GL_COLOR_BUFFER_BIT = 0x4000; + int GL_COLOR_LOGIC_OP = 0x0BF2; + int GL_COLOR_MATERIAL = 0x0B57; + int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3; + int GL_CONSTANT_ATTENUATION = 0x1207; + int GL_COPY = 0x1503; + int GL_COPY_INVERTED = 0x150C; + int GL_CULL_FACE = 0x0B44; + int GL_CW = 0x0900; + int GL_DECAL = 0x2101; + int GL_DECR = 0x1E03; + int GL_DEPTH_BITS = 0x0D56; + int GL_DEPTH_BUFFER_BIT = 0x0100; + int GL_DEPTH_TEST = 0x0B71; + int GL_DIFFUSE = 0x1201; + int GL_DITHER = 0x0BD0; + int GL_DONT_CARE = 0x1100; + int GL_DST_ALPHA = 0x0304; + int GL_DST_COLOR = 0x0306; + int GL_EMISSION = 0x1600; + int GL_EQUAL = 0x0202; + int GL_EQUIV = 0x1509; + int GL_EXP = 0x0800; + int GL_EXP2 = 0x0801; + int GL_EXTENSIONS = 0x1F03; + int GL_FALSE = 0; + int GL_FASTEST = 0x1101; + int GL_FIXED = 0x140C; + int GL_FLAT = 0x1D00; + int GL_FLOAT = 0x1406; + int GL_FOG = 0x0B60; + int GL_FOG_COLOR = 0x0B66; + int GL_FOG_DENSITY = 0x0B62; + int GL_FOG_END = 0x0B64; + int GL_FOG_HINT = 0x0C54; + int GL_FOG_MODE = 0x0B65; + int GL_FOG_START = 0x0B63; + int GL_FRONT = 0x0404; + int GL_FRONT_AND_BACK = 0x0408; + int GL_GEQUAL = 0x0206; + int GL_GREATER = 0x0204; + int GL_GREEN_BITS = 0x0D53; + int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 0x8B9B; + int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 0x8B9A; + int GL_INCR = 0x1E02; + int GL_INVALID_ENUM = 0x0500; + int GL_INVALID_OPERATION = 0x0502; + int GL_INVALID_VALUE = 0x0501; + int GL_INVERT = 0x150A; + int GL_KEEP = 0x1E00; + int GL_LEQUAL = 0x0203; + int GL_LESS = 0x0201; + int GL_LIGHT_MODEL_AMBIENT = 0x0B53; + int GL_LIGHT_MODEL_TWO_SIDE = 0x0B52; + int GL_LIGHT0 = 0x4000; + int GL_LIGHT1 = 0x4001; + int GL_LIGHT2 = 0x4002; + int GL_LIGHT3 = 0x4003; + int GL_LIGHT4 = 0x4004; + int GL_LIGHT5 = 0x4005; + int GL_LIGHT6 = 0x4006; + int GL_LIGHT7 = 0x4007; + int GL_LIGHTING = 0x0B50; + int GL_LINE_LOOP = 0x0002; + int GL_LINE_SMOOTH = 0x0B20; + int GL_LINE_SMOOTH_HINT = 0x0C52; + int GL_LINE_STRIP = 0x0003; + int GL_LINEAR = 0x2601; + int GL_LINEAR_ATTENUATION = 0x1208; + int GL_LINEAR_MIPMAP_LINEAR = 0x2703; + int GL_LINEAR_MIPMAP_NEAREST = 0x2701; + int GL_LINES = 0x0001; + int GL_LUMINANCE = 0x1909; + int GL_LUMINANCE_ALPHA = 0x190A; + int GL_MAX_ELEMENTS_INDICES = 0x80E9; + int GL_MAX_ELEMENTS_VERTICES = 0x80E8; + int GL_MAX_LIGHTS = 0x0D31; + int GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36; + int GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38; + int GL_MAX_TEXTURE_SIZE = 0x0D33; + int GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39; + int GL_MAX_TEXTURE_UNITS = 0x84E2; + int GL_MAX_VIEWPORT_DIMS = 0x0D3A; + int GL_MODELVIEW = 0x1700; + int GL_MODULATE = 0x2100; + int GL_MULTISAMPLE = 0x809D; + int GL_NAND = 0x150E; + int GL_NEAREST = 0x2600; + int GL_NEAREST_MIPMAP_LINEAR = 0x2702; + int GL_NEAREST_MIPMAP_NEAREST = 0x2700; + int GL_NEVER = 0x0200; + int GL_NICEST = 0x1102; + int GL_NO_ERROR = 0; + int GL_NOOP = 0x1505; + int GL_NOR = 0x1508; + int GL_NORMAL_ARRAY = 0x8075; + int GL_NORMALIZE = 0x0BA1; + int GL_NOTEQUAL = 0x0205; + int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; + int GL_ONE = 1; + int GL_ONE_MINUS_DST_ALPHA = 0x0305; + int GL_ONE_MINUS_DST_COLOR = 0x0307; + int GL_ONE_MINUS_SRC_ALPHA = 0x0303; + int GL_ONE_MINUS_SRC_COLOR = 0x0301; + int GL_OR = 0x1507; + int GL_OR_INVERTED = 0x150D; + int GL_OR_REVERSE = 0x150B; + int GL_OUT_OF_MEMORY = 0x0505; + int GL_PACK_ALIGNMENT = 0x0D05; + int GL_PALETTE4_R5_G6_B5_OES = 0x8B92; + int GL_PALETTE4_RGB5_A1_OES = 0x8B94; + int GL_PALETTE4_RGB8_OES = 0x8B90; + int GL_PALETTE4_RGBA4_OES = 0x8B93; + int GL_PALETTE4_RGBA8_OES = 0x8B91; + int GL_PALETTE8_R5_G6_B5_OES = 0x8B97; + int GL_PALETTE8_RGB5_A1_OES = 0x8B99; + int GL_PALETTE8_RGB8_OES = 0x8B95; + int GL_PALETTE8_RGBA4_OES = 0x8B98; + int GL_PALETTE8_RGBA8_OES = 0x8B96; + int GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50; + int GL_POINT_SMOOTH = 0x0B10; + int GL_POINT_SMOOTH_HINT = 0x0C51; + int GL_POINTS = 0x0000; + int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; + int GL_POINT_SIZE = 0x0B11; + int GL_POLYGON_OFFSET_FILL = 0x8037; + int GL_POLYGON_SMOOTH_HINT = 0x0C53; + int GL_POSITION = 0x1203; + int GL_PROJECTION = 0x1701; + int GL_QUADRATIC_ATTENUATION = 0x1209; + int GL_RED_BITS = 0x0D52; + int GL_RENDERER = 0x1F01; + int GL_REPEAT = 0x2901; + int GL_REPLACE = 0x1E01; + int GL_RESCALE_NORMAL = 0x803A; + int GL_RGB = 0x1907; + int GL_RGBA = 0x1908; + int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + int GL_SAMPLE_ALPHA_TO_ONE = 0x809F; + int GL_SAMPLE_COVERAGE = 0x80A0; + int GL_SCISSOR_TEST = 0x0C11; + int GL_SET = 0x150F; + int GL_SHININESS = 0x1601; + int GL_SHORT = 0x1402; + int GL_SMOOTH = 0x1D01; + int GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22; + int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12; + int GL_SPECULAR = 0x1202; + int GL_SPOT_CUTOFF = 0x1206; + int GL_SPOT_DIRECTION = 0x1204; + int GL_SPOT_EXPONENT = 0x1205; + int GL_SRC_ALPHA = 0x0302; + int GL_SRC_ALPHA_SATURATE = 0x0308; + int GL_SRC_COLOR = 0x0300; + int GL_STACK_OVERFLOW = 0x0503; + int GL_STACK_UNDERFLOW = 0x0504; + int GL_STENCIL_BITS = 0x0D57; + int GL_STENCIL_BUFFER_BIT = 0x0400; + int GL_STENCIL_TEST = 0x0B90; + int GL_SUBPIXEL_BITS = 0x0D50; + int GL_TEXTURE = 0x1702; + int GL_TEXTURE_2D = 0x0DE1; + int GL_TEXTURE_COORD_ARRAY = 0x8078; + int GL_TEXTURE_ENV = 0x2300; + int GL_TEXTURE_ENV_COLOR = 0x2201; + int GL_TEXTURE_ENV_MODE = 0x2200; + int GL_TEXTURE_MAG_FILTER = 0x2800; + int GL_TEXTURE_MIN_FILTER = 0x2801; + int GL_TEXTURE_WRAP_S = 0x2802; + int GL_TEXTURE_WRAP_T = 0x2803; + int GL_TEXTURE0 = 0x84C0; + int GL_TEXTURE1 = 0x84C1; + int GL_TEXTURE2 = 0x84C2; + int GL_TEXTURE3 = 0x84C3; + int GL_TEXTURE4 = 0x84C4; + int GL_TEXTURE5 = 0x84C5; + int GL_TEXTURE6 = 0x84C6; + int GL_TEXTURE7 = 0x84C7; + int GL_TEXTURE8 = 0x84C8; + int GL_TEXTURE9 = 0x84C9; + int GL_TEXTURE10 = 0x84CA; + int GL_TEXTURE11 = 0x84CB; + int GL_TEXTURE12 = 0x84CC; + int GL_TEXTURE13 = 0x84CD; + int GL_TEXTURE14 = 0x84CE; + int GL_TEXTURE15 = 0x84CF; + int GL_TEXTURE16 = 0x84D0; + int GL_TEXTURE17 = 0x84D1; + int GL_TEXTURE18 = 0x84D2; + int GL_TEXTURE19 = 0x84D3; + int GL_TEXTURE20 = 0x84D4; + int GL_TEXTURE21 = 0x84D5; + int GL_TEXTURE22 = 0x84D6; + int GL_TEXTURE23 = 0x84D7; + int GL_TEXTURE24 = 0x84D8; + int GL_TEXTURE25 = 0x84D9; + int GL_TEXTURE26 = 0x84DA; + int GL_TEXTURE27 = 0x84DB; + int GL_TEXTURE28 = 0x84DC; + int GL_TEXTURE29 = 0x84DD; + int GL_TEXTURE30 = 0x84DE; + int GL_TEXTURE31 = 0x84DF; + int GL_TRIANGLE_FAN = 0x0006; + int GL_TRIANGLE_STRIP = 0x0005; + int GL_TRIANGLES = 0x0004; + int GL_TRUE = 1; + int GL_UNPACK_ALIGNMENT = 0x0CF5; + int GL_UNSIGNED_BYTE = 0x1401; + int GL_UNSIGNED_SHORT = 0x1403; + int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; + int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; + int GL_UNSIGNED_SHORT_5_6_5 = 0x8363; + int GL_VENDOR = 0x1F00; + int GL_VERSION = 0x1F02; + int GL_VERTEX_ARRAY = 0x8074; + int GL_XOR = 0x1506; + int GL_ZERO = 0; + diff --git a/opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if new file mode 100644 index 0000000..7be2164 --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if @@ -0,0 +1,40 @@ +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package javax.microedition.khronos.opengles; + +public interface GL11Ext extends GL { + int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 0x8B9E; + int GL_MATRIX_INDEX_ARRAY_OES = 0x8844; + int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 0x8849; + int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 0x8846; + int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 0x8848; + int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 0x8847; + int GL_MATRIX_PALETTE_OES = 0x8840; + int GL_MAX_PALETTE_MATRICES_OES = 0x8842; + int GL_MAX_VERTEX_UNITS_OES = 0x86A4; + int GL_TEXTURE_CROP_RECT_OES = 0x8B9D; + int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 0x889E; + int GL_WEIGHT_ARRAY_OES = 0x86AD; + int GL_WEIGHT_ARRAY_POINTER_OES = 0x86AC; + int GL_WEIGHT_ARRAY_SIZE_OES = 0x86AB; + int GL_WEIGHT_ARRAY_STRIDE_OES = 0x86AA; + int GL_WEIGHT_ARRAY_TYPE_OES = 0x86A9; + + void glTexParameterfv(int target, int pname, float[] param, int offset); + diff --git a/opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if new file mode 100644 index 0000000..a800191 --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if @@ -0,0 +1,108 @@ +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package javax.microedition.khronos.opengles; + +public interface GL11ExtensionPack extends GL { + int GL_BLEND_DST_ALPHA = 0x80CA; + int GL_BLEND_DST_RGB = 0x80C8; + int GL_BLEND_EQUATION = 0x8009; + int GL_BLEND_EQUATION_ALPHA = 0x883D; + int GL_BLEND_EQUATION_RGB = 0x8009; + int GL_BLEND_SRC_ALPHA = 0x80CB; + int GL_BLEND_SRC_RGB = 0x80C9; + int GL_COLOR_ATTACHMENT0_OES = 0x8CE0; + int GL_COLOR_ATTACHMENT1_OES = 0x8CE1; + int GL_COLOR_ATTACHMENT2_OES = 0x8CE2; + int GL_COLOR_ATTACHMENT3_OES = 0x8CE3; + int GL_COLOR_ATTACHMENT4_OES = 0x8CE4; + int GL_COLOR_ATTACHMENT5_OES = 0x8CE5; + int GL_COLOR_ATTACHMENT6_OES = 0x8CE6; + int GL_COLOR_ATTACHMENT7_OES = 0x8CE7; + int GL_COLOR_ATTACHMENT8_OES = 0x8CE8; + int GL_COLOR_ATTACHMENT9_OES = 0x8CE9; + int GL_COLOR_ATTACHMENT10_OES = 0x8CEA; + int GL_COLOR_ATTACHMENT11_OES = 0x8CEB; + int GL_COLOR_ATTACHMENT12_OES = 0x8CEC; + int GL_COLOR_ATTACHMENT13_OES = 0x8CED; + int GL_COLOR_ATTACHMENT14_OES = 0x8CEE; + int GL_COLOR_ATTACHMENT15_OES = 0x8CEF; + int GL_DECR_WRAP = 0x8508; + int GL_DEPTH_ATTACHMENT_OES = 0x8D00; + int GL_DEPTH_COMPONENT = 0x1902; + int GL_DEPTH_COMPONENT16 = 0x81A5; + int GL_DEPTH_COMPONENT24 = 0x81A6; + int GL_DEPTH_COMPONENT32 = 0x81A7; + int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 0x8CD1; + int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 0x8CD0; + int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 0x8CD3; + int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 0x8CD2; + int GL_FRAMEBUFFER_BINDING_OES = 0x8CA6; + int GL_FRAMEBUFFER_COMPLETE_OES = 0x8CD5; + int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 0x8CD6; + int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 0x8CD9; + int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES = 0x8CDB; + int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 0x8CDA; + int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 0x8CD7; + int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES = 0x8CDC; + int GL_FRAMEBUFFER_OES = 0x8D40; + int GL_FRAMEBUFFER_UNSUPPORTED_OES = 0x8CDD; + int GL_FUNC_ADD = 0x8006; + int GL_FUNC_REVERSE_SUBTRACT = 0x800B; + int GL_FUNC_SUBTRACT = 0x800A; + int GL_INCR_WRAP = 0x8507; + int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 0x0506; + int GL_MAX_COLOR_ATTACHMENTS_OES = 0x8CDF; + int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + int GL_MAX_RENDERBUFFER_SIZE_OES = 0x84E8; + int GL_MIRRORED_REPEAT = 0x8370; + int GL_NORMAL_MAP = 0x8511; + int GL_REFLECTION_MAP = 0x8512; + int GL_RENDERBUFFER_ALPHA_SIZE_OES = 0x8D53; + int GL_RENDERBUFFER_BINDING_OES = 0x8CA7; + int GL_RENDERBUFFER_BLUE_SIZE_OES = 0x8D52; + int GL_RENDERBUFFER_DEPTH_SIZE_OES = 0x8D54; + int GL_RENDERBUFFER_GREEN_SIZE_OES = 0x8D51; + int GL_RENDERBUFFER_HEIGHT_OES = 0x8D43; + int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 0x8D44; + int GL_RENDERBUFFER_OES = 0x8D41; + int GL_RENDERBUFFER_RED_SIZE_OES = 0x8D50; + int GL_RENDERBUFFER_STENCIL_SIZE_OES = 0x8D55; + int GL_RENDERBUFFER_WIDTH_OES = 0x8D42; + int GL_RGB5_A1 = 0x8057; + int GL_RGB565_OES = 0x8D62; + int GL_RGB8 = 0x8051; + int GL_RGBA4 = 0x8056; + int GL_RGBA8 = 0x8058; + int GL_STENCIL_ATTACHMENT_OES = 0x8D20; + int GL_STENCIL_INDEX = 0x1901; + int GL_STENCIL_INDEX1_OES = 0x8D46; + int GL_STENCIL_INDEX4_OES = 0x8D47; + int GL_STENCIL_INDEX8_OES = 0x8D48; + int GL_STR = -1; + int GL_TEXTURE_BINDING_CUBE_MAP = 0x8514; + int GL_TEXTURE_CUBE_MAP = 0x8513; + int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; + int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; + int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; + int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; + int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; + int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; + int GL_TEXTURE_GEN_MODE = 0x2500; + int GL_TEXTURE_GEN_STR = 0x8D60; + diff --git a/opengl/tools/glgen/stubs/jsr239/GL11Header.java-if b/opengl/tools/glgen/stubs/jsr239/GL11Header.java-if new file mode 100644 index 0000000..b0e5a6b --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GL11Header.java-if @@ -0,0 +1,145 @@ +** +** Copyright 2006, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package javax.microedition.khronos.opengles; + +public interface GL11 extends GL10 { + int GL_ACTIVE_TEXTURE = 0x84E0; + int GL_ADD_SIGNED = 0x8574; + int GL_ALPHA_SCALE = 0x0D1C; + int GL_ALPHA_TEST_FUNC = 0x0BC1; + int GL_ALPHA_TEST_REF = 0x0BC2; + int GL_ARRAY_BUFFER = 0x8892; + int GL_ARRAY_BUFFER_BINDING = 0x8894; + int GL_BLEND_DST = 0x0BE0; + int GL_BLEND_SRC = 0x0BE1; + int GL_BUFFER_ACCESS = 0x88BB; + int GL_BUFFER_SIZE = 0x8764; + int GL_BUFFER_USAGE = 0x8765; + int GL_CLIENT_ACTIVE_TEXTURE = 0x84E1; + int GL_CLIP_PLANE0 = 0x3000; + int GL_CLIP_PLANE1 = 0x3001; + int GL_CLIP_PLANE2 = 0x3002; + int GL_CLIP_PLANE3 = 0x3003; + int GL_CLIP_PLANE4 = 0x3004; + int GL_CLIP_PLANE5 = 0x3005; + int GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898; + int GL_COLOR_ARRAY_POINTER = 0x8090; + int GL_COLOR_ARRAY_SIZE = 0x8081; + int GL_COLOR_ARRAY_STRIDE = 0x8083; + int GL_COLOR_ARRAY_TYPE = 0x8082; + int GL_COLOR_CLEAR_VALUE = 0x0C22; + int GL_COLOR_WRITEMASK = 0x0C23; + int GL_COMBINE = 0x8570; + int GL_COMBINE_ALPHA = 0x8572; + int GL_COMBINE_RGB = 0x8571; + int GL_CONSTANT = 0x8576; + int GL_COORD_REPLACE_OES = 0x8862; + int GL_CULL_FACE_MODE = 0x0B45; + int GL_CURRENT_COLOR = 0x0B00; + int GL_CURRENT_NORMAL = 0x0B02; + int GL_CURRENT_TEXTURE_COORDS = 0x0B03; + int GL_DEPTH_CLEAR_VALUE = 0x0B73; + int GL_DEPTH_FUNC = 0x0B74; + int GL_DEPTH_RANGE = 0x0B70; + int GL_DEPTH_WRITEMASK = 0x0B72; + int GL_DOT3_RGB = 0x86AE; + int GL_DOT3_RGBA = 0x86AF; + int GL_DYNAMIC_DRAW = 0x88E8; + int GL_ELEMENT_ARRAY_BUFFER = 0x8893; + int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + int GL_FRONT_FACE = 0x0B46; + int GL_GENERATE_MIPMAP = 0x8191; + int GL_GENERATE_MIPMAP_HINT = 0x8192; + int GL_INTERPOLATE = 0x8575; + int GL_LINE_WIDTH = 0x0B21; + int GL_LOGIC_OP_MODE = 0x0BF0; + int GL_MATRIX_MODE = 0x0BA0; + int GL_MAX_CLIP_PLANES = 0x0D32; + int GL_MODELVIEW_MATRIX = 0x0BA6; + int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898D; + int GL_MODELVIEW_STACK_DEPTH = 0x0BA3; + int GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897; + int GL_NORMAL_ARRAY_POINTER = 0x808F; + int GL_NORMAL_ARRAY_STRIDE = 0x807F; + int GL_NORMAL_ARRAY_TYPE = 0x807E; + int GL_OPERAND0_ALPHA = 0x8598; + int GL_OPERAND0_RGB = 0x8590; + int GL_OPERAND1_ALPHA = 0x8599; + int GL_OPERAND1_RGB = 0x8591; + int GL_OPERAND2_ALPHA = 0x859A; + int GL_OPERAND2_RGB = 0x8592; + int GL_POINT_DISTANCE_ATTENUATION = 0x8129; + int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; + int GL_POINT_SIZE = 0x0B11; + int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 0x8B9F; + int GL_POINT_SIZE_ARRAY_OES = 0x8B9C; + int GL_POINT_SIZE_ARRAY_POINTER_OES = 0x898C; + int GL_POINT_SIZE_ARRAY_STRIDE_OES = 0x898B; + int GL_POINT_SIZE_ARRAY_TYPE_OES = 0x898A; + int GL_POINT_SIZE_MAX = 0x8127; + int GL_POINT_SIZE_MIN = 0x8126; + int GL_POINT_SPRITE_OES = 0x8861; + int GL_POLYGON_OFFSET_FACTOR = 0x8038; + int GL_POLYGON_OFFSET_UNITS = 0x2A00; + int GL_PREVIOUS = 0x8578; + int GL_PRIMARY_COLOR = 0x8577; + int GL_PROJECTION_MATRIX = 0x0BA7; + int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E; + int GL_PROJECTION_STACK_DEPTH = 0x0BA4; + int GL_RGB_SCALE = 0x8573; + int GL_SAMPLE_BUFFERS = 0x80A8; + int GL_SAMPLE_COVERAGE_INVERT = 0x80AB; + int GL_SAMPLE_COVERAGE_VALUE = 0x80AA; + int GL_SAMPLES = 0x80A9; + int GL_SCISSOR_BOX = 0x0C10; + int GL_SHADE_MODEL = 0x0B54; + int GL_SRC0_ALPHA = 0x8588; + int GL_SRC0_RGB = 0x8580; + int GL_SRC1_ALPHA = 0x8589; + int GL_SRC1_RGB = 0x8581; + int GL_SRC2_ALPHA = 0x858A; + int GL_SRC2_RGB = 0x8582; + int GL_STATIC_DRAW = 0x88E4; + int GL_STENCIL_CLEAR_VALUE = 0x0B91; + int GL_STENCIL_FAIL = 0x0B94; + int GL_STENCIL_FUNC = 0x0B92; + int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95; + int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96; + int GL_STENCIL_REF = 0x0B97; + int GL_STENCIL_VALUE_MASK = 0x0B93; + int GL_STENCIL_WRITEMASK = 0x0B98; + int GL_SUBTRACT = 0x84E7; + int GL_TEXTURE_BINDING_2D = 0x8069; + int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A; + int GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092; + int GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088; + int GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A; + int GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089; + int GL_TEXTURE_MATRIX = 0x0BA8; + int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898F; + int GL_TEXTURE_STACK_DEPTH = 0x0BA5; + int GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896; + int GL_VERTEX_ARRAY_POINTER = 0x808E; + int GL_VERTEX_ARRAY_SIZE = 0x807A; + int GL_VERTEX_ARRAY_STRIDE = 0x807C; + int GL_VERTEX_ARRAY_TYPE = 0x807B; + int GL_VIEWPORT = 0x0BA2; + int GL_WRITE_ONLY = 0x88B9; + + void glGetPointerv(int pname, java.nio.Buffer[] params); diff --git a/opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl new file mode 100644 index 0000000..501be65 --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl @@ -0,0 +1,30 @@ +// Copyright 2006 The Android Open Source Project + +// All Rights Reserved. + +// This source file is automatically generated + +package com.google.android.gles_jni; + +import java.nio.Buffer; +import javax.microedition.khronos.opengles.GL11; +import android.graphics.Canvas; + +public class GL11Impl implements GL11 { + + // Private accessors for native code + + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } + + Buffer _colorPointer = null; + Buffer _normalPointer = null; + Buffer _texCoordPointer = null; + Buffer _vertexPointer = null; + + public GL11Impl() { + } + + diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp new file mode 100644 index 0000000..4636081 --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp @@ -0,0 +1,129 @@ +** +** Copyright 2006, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +#include +#include + +#include +#include + +#include + +#define _NUM_COMPRESSED_TEXTURE_FORMATS \ + (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS) + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- + diff --git a/opengl/tools/glgen/stubs/jsr239/GLHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GLHeader.java-if new file mode 100644 index 0000000..3b78f3d --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GLHeader.java-if @@ -0,0 +1,22 @@ +/* //device/java/android/javax/microedition/khronos/opengles/GL.java +** +** Copyright 2006, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package javax.microedition.khronos.opengles; + +public interface GL { +} + diff --git a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl new file mode 100644 index 0000000..db3a41c --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl @@ -0,0 +1,48 @@ +** +** Copyright 2006, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +// This source file is automatically generated + +package com.google.android.gles_jni; + +import java.nio.Buffer; +import javax.microedition.khronos.opengles.GL10; +import javax.microedition.khronos.opengles.GL10Ext; +import javax.microedition.khronos.opengles.GL11; +import javax.microedition.khronos.opengles.GL11Ext; +import javax.microedition.khronos.opengles.GL11ExtensionPack; + +public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack { + + // Private accessors for native code + + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } + + Buffer _colorPointer = null; + Buffer _normalPointer = null; + Buffer _texCoordPointer = null; + Buffer _vertexPointer = null; + + public GLImpl() { + } + + public void glGetPointerv(int pname, java.nio.Buffer[] params) { + throw new UnsupportedOperationException("glGetPointerv"); + } + diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.cpp b/opengl/tools/glgen/stubs/jsr239/glGetString.cpp new file mode 100644 index 0000000..a400859 --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/glGetString.cpp @@ -0,0 +1,11 @@ +#include + +/* const GLubyte * glGetString ( GLenum name ) */ +static +jstring +android_glGetString + (JNIEnv *_env, jobject _this, jint name) { + const char * chars = (const char *)glGetString((GLenum)name); + jstring output = _env->NewStringUTF(chars); + return output; +} diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if b/opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if new file mode 100644 index 0000000..898fabc --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if @@ -0,0 +1,4 @@ + public String glGetString( + int name + ); + diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.java-if b/opengl/tools/glgen/stubs/jsr239/glGetString.java-if new file mode 100644 index 0000000..898fabc --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/glGetString.java-if @@ -0,0 +1,4 @@ + public String glGetString( + int name + ); + diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.java-impl b/opengl/tools/glgen/stubs/jsr239/glGetString.java-impl new file mode 100644 index 0000000..8c7881c --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/glGetString.java-impl @@ -0,0 +1,16 @@ + // C function const GLubyte * glGetString ( GLenum name ) + + public native String _glGetString( + int name + ); + + public String glGetString( + int name + ) { + String returnValue; + returnValue = _glGetString( + name + ); + return returnValue; + } + diff --git a/opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg b/opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg new file mode 100644 index 0000000..e64187c --- /dev/null +++ b/opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg @@ -0,0 +1 @@ +{"_glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, -- cgit v1.1 -- cgit v1.1 From 0ae13e36e1e5052e5f889f1d3e3c07db4f2c03db Mon Sep 17 00:00:00 2001 From: James Dong Date: Mon, 20 Apr 2009 19:35:28 -0700 Subject: Remove dangling media recorder client reference when setCamera() is used. --- camera/libcameraservice/CameraService.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index cb8ab58..701259e 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -217,7 +217,13 @@ status_t CameraService::Client::unlock() // allow anyone to use camera LOGV("unlock (%p)", getCameraClient()->asBinder().get()); status_t result = checkPid(); - if (result == NO_ERROR) mClientPid = 0; + if (result == NO_ERROR) { + mClientPid = 0; + + // we need to remove the reference so that when app goes + // away, the reference count goes to 0. + mCameraClient.clear(); + } return result; } -- cgit v1.1 From 4dd495b72cbe8cf8df03f862e8e600ac14fdf30d Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 21 Apr 2009 07:56:33 -0700 Subject: Fix issue 1745312: Various cleanups in media framework AudioTrack, AudioRecord: - remove useless mAudioFlinger member of AudioTrack and AudioRecord. - signal cblk.cv condition in stop() method to speed up stop completion. - extend wait condition timeout in obtainBuffer() when waitCount is -1 to avoid waking up callback thread unnecessarily AudioFlinger: - remove some warnings in AudioFlinger.cpp. - remove function AudioFlinger::MixerThread::removetrack_l() as its content is never executed. - remove useless call to setMasterVolume in AudioFlinger::handleForcedSpeakerRoute(). - Offset VOICE_CALL stream volume to reflect actual volume that is never 0 in hardware (this fix has been made in the open source): 0.01 + v * 0.99. AudioSystem.java: - correct typo in comment IAudioflinger, IAudioFlingerClient: - make AudioFlinger binder interfaces used for callbacks ONEWAY. AudioHardwareInterface: - correct routeStrings[] table in AudioHardwareInteface.cpp --- libs/audioflinger/AudioFlinger.cpp | 50 ++++++++++++---------------- libs/audioflinger/AudioFlinger.h | 1 - libs/audioflinger/AudioHardwareInterface.cpp | 2 +- 3 files changed, 22 insertions(+), 31 deletions(-) diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index d11e13a..b56221f 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -651,27 +651,30 @@ status_t AudioFlinger::setStreamVolume(int stream, float value) return BAD_VALUE; } - mHardwareMixerThread->setStreamVolume(stream, value); -#ifdef WITH_A2DP - mA2dpMixerThread->setStreamVolume(stream, value); -#endif - status_t ret = NO_ERROR; if (stream == AudioSystem::VOICE_CALL || stream == AudioSystem::BLUETOOTH_SCO) { - + float hwValue; if (stream == AudioSystem::VOICE_CALL) { - value = (float)AudioSystem::logToLinear(value)/100.0f; + hwValue = (float)AudioSystem::logToLinear(value)/100.0f; + // offset value to reflect actual hardware volume that never reaches 0 + // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java) + value = 0.01 + 0.99 * value; } else { // (type == AudioSystem::BLUETOOTH_SCO) - value = 1.0f; + hwValue = 1.0f; } AutoMutex lock(mHardwareLock); mHardwareStatus = AUDIO_SET_VOICE_VOLUME; - ret = mAudioHardware->setVoiceVolume(value); + ret = mAudioHardware->setVoiceVolume(hwValue); mHardwareStatus = AUDIO_HW_IDLE; } + mHardwareMixerThread->setStreamVolume(stream, value); +#ifdef WITH_A2DP + mA2dpMixerThread->setStreamVolume(stream, value); +#endif + return ret; } @@ -709,7 +712,14 @@ float AudioFlinger::streamVolume(int stream) const if (uint32_t(stream) >= AudioSystem::NUM_STREAM_TYPES) { return 0.0f; } - return mHardwareMixerThread->streamVolume(stream); + + float volume = mHardwareMixerThread->streamVolume(stream); + // remove correction applied by setStreamVolume() + if (stream == AudioSystem::VOICE_CALL) { + volume = (volume - 0.01) / 0.99 ; + } + + return volume; } bool AudioFlinger::streamMute(int stream) const @@ -812,17 +822,12 @@ void AudioFlinger::handleForcedSpeakerRoute(int command) if (mForcedRoute == 0 && !(mSavedRoute & AudioSystem::ROUTE_SPEAKER)) { LOGV("Route forced to Speaker ON %08x", mSavedRoute | AudioSystem::ROUTE_SPEAKER); mHardwareMixerThread->setStreamMute(AudioSystem::MUSIC, true); - mHardwareStatus = AUDIO_HW_SET_MASTER_VOLUME; - mAudioHardware->setMasterVolume(0); usleep(mHardwareMixerThread->latency()*1000); mHardwareStatus = AUDIO_HW_SET_ROUTING; mAudioHardware->setRouting(AudioSystem::MODE_NORMAL, mSavedRoute | AudioSystem::ROUTE_SPEAKER); mHardwareStatus = AUDIO_HW_IDLE; // delay track start so that audio hardware has time to siwtch routes usleep(kStartSleepTime); - mHardwareStatus = AUDIO_HW_SET_MASTER_VOLUME; - mAudioHardware->setMasterVolume(mHardwareMixerThread->masterVolume()); - mHardwareStatus = AUDIO_HW_IDLE; } mForcedRoute = AudioSystem::ROUTE_SPEAKER; } @@ -1480,18 +1485,6 @@ status_t AudioFlinger::MixerThread::addTrack_l(const sp& track) return status; } -// removeTrack_l() must be called with AudioFlinger::mLock held -void AudioFlinger::MixerThread::removeTrack_l(wp track, int name) -{ - sp t = track.promote(); - if (t!=NULL && (t->mState <= TrackBase::STOPPED)) { - t->reset(); - deleteTrackName_l(name); - removeActiveTrack_l(track); - mAudioFlinger->mWaitWorkCV.broadcast(); - } -} - // destroyTrack_l() must be called with AudioFlinger::mLock held void AudioFlinger::MixerThread::destroyTrack_l(const sp& track) { @@ -1697,7 +1690,7 @@ void* AudioFlinger::MixerThread::TrackBase::getBuffer(uint32_t offset, uint32_t // Check validity of returned pointer in case the track control block would have been corrupted. if (bufferStart < mBuffer || bufferStart > bufferEnd || bufferEnd > mBufferEnd || - cblk->channels == 2 && ((unsigned long)bufferStart & 3) ) { + (cblk->channels == 2 && ((unsigned long)bufferStart & 3))) { LOGE("TrackBase::getBuffer buffer out of range:\n start: %p, end %p , mBuffer %p mBufferEnd %p\n \ server %d, serverBase %d, user %d, userBase %d, channels %d", bufferStart, bufferEnd, mBuffer, mBufferEnd, @@ -1733,7 +1726,6 @@ AudioFlinger::MixerThread::Track::~Track() wp weak(this); // never create a strong ref from the dtor Mutex::Autolock _l(mMixerThread->mAudioFlinger->mLock); mState = TERMINATED; - mMixerThread->removeTrack_l(weak, mName); } void AudioFlinger::MixerThread::Track::destroy() diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h index db5cc74..c7ca9ec 100644 --- a/libs/audioflinger/AudioFlinger.h +++ b/libs/audioflinger/AudioFlinger.h @@ -501,7 +501,6 @@ private: MixerThread& operator = (const MixerThread&); status_t addTrack_l(const sp& track); - void removeTrack_l(wp track, int name); void destroyTrack_l(const sp& track); int getTrackName_l(); void deleteTrackName_l(int name); diff --git a/libs/audioflinger/AudioHardwareInterface.cpp b/libs/audioflinger/AudioHardwareInterface.cpp index ac76a19..cc1bd8f 100644 --- a/libs/audioflinger/AudioHardwareInterface.cpp +++ b/libs/audioflinger/AudioHardwareInterface.cpp @@ -53,7 +53,7 @@ static const char* routeStrings[] = "EARPIECE ", "SPEAKER ", "BLUETOOTH ", - "HEADSET " + "HEADSET ", "BLUETOOTH_A2DP " }; static const char* routeNone = "NONE"; -- cgit v1.1 -- cgit v1.1 -- cgit v1.1 From 81d763f77a85309528a3f266141968a8ec08e0d4 Mon Sep 17 00:00:00 2001 From: Wu-cheng Li Date: Wed, 22 Apr 2009 16:21:26 +0800 Subject: Remove debug messages. modified: core/java/android/hardware/Camera.java modified: camera/libcameraservice/CameraService.cpp --- camera/libcameraservice/CameraService.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 701259e..96ee502 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -900,8 +900,6 @@ status_t CameraService::Client::setParameters(const String8& params) // get preview/capture parameters - key/value pairs String8 CameraService::Client::getParameters() const { - LOGD("getParameters"); - Mutex::Autolock lock(mLock); if (mHardware == 0) { @@ -909,7 +907,9 @@ String8 CameraService::Client::getParameters() const return String8(); } - return mHardware->getParameters().flatten(); + String8 params(mHardware->getParameters().flatten()); + LOGD("getParameters(%s)", params.string()); + return params; } void CameraService::Client::postAutoFocus(bool focused) -- cgit v1.1