mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 860615 - Add SharedTextureHandle support to GLContextCGL. r=jgilbert
This commit is contained in:
parent
c5e0409372
commit
5f39aac0c3
@ -439,6 +439,9 @@ public:
|
||||
TextureID
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
, SurfaceTexture
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
, IOSurface
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "prenv.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozilla/gfx/MacIOSurface.h"
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
@ -177,6 +178,39 @@ public:
|
||||
GLContext* aContext,
|
||||
TextureImage::Flags aFlags = TextureImage::NoFlags);
|
||||
|
||||
virtual SharedTextureHandle CreateSharedHandle(SharedTextureShareType shareType,
|
||||
void* buffer,
|
||||
SharedTextureBufferType bufferType)
|
||||
{
|
||||
return GLContextProviderCGL::CreateSharedHandle(shareType, buffer, bufferType);
|
||||
}
|
||||
|
||||
virtual void ReleaseSharedHandle(SharedTextureShareType shareType,
|
||||
SharedTextureHandle sharedHandle)
|
||||
{
|
||||
if (sharedHandle) {
|
||||
reinterpret_cast<MacIOSurface*>(sharedHandle)->Release();
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool GetSharedHandleDetails(SharedTextureShareType shareType,
|
||||
SharedTextureHandle sharedHandle,
|
||||
SharedHandleDetails& details)
|
||||
{
|
||||
details.mTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
|
||||
details.mProgramType = RGBARectLayerProgramType;
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool AttachSharedHandle(SharedTextureShareType shareType,
|
||||
SharedTextureHandle sharedHandle)
|
||||
{
|
||||
MacIOSurface* surf = reinterpret_cast<MacIOSurface*>(sharedHandle);
|
||||
surf->CGLTexImageIOSurface2D(mContext, LOCAL_GL_RGBA, LOCAL_GL_BGRA,
|
||||
LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
NSOpenGLContext *mContext;
|
||||
GLuint mTempTextureName;
|
||||
};
|
||||
@ -419,7 +453,15 @@ GLContextProviderCGL::CreateSharedHandle(GLContext::SharedTextureShareType share
|
||||
void* buffer,
|
||||
GLContext::SharedTextureBufferType bufferType)
|
||||
{
|
||||
return 0;
|
||||
if (shareType != GLContext::SameProcess ||
|
||||
bufferType != GLContext::IOSurface) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
MacIOSurface* surf = static_cast<MacIOSurface*>(buffer);
|
||||
surf->AddRef();
|
||||
|
||||
return (SharedTextureHandle)surf;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user