зеркало из https://github.com/mozilla/gecko-dev.git
Bug 867460: remove notion of ShaderProgramTypes from gfx/gl. Carry r=bas. r=bgirard for the changes.
This commit is contained in:
Родитель
d4cc20985d
Коммит
4c463d2865
|
@ -1481,7 +1481,7 @@ static already_AddRefed<gfxImageSurface> YInvertImageSurface(gfxImageSurface* aS
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfxImageSurface>
|
already_AddRefed<gfxImageSurface>
|
||||||
GLContext::GetTexImage(GLuint aTexture, bool aYInvert, ShaderProgramType aShader)
|
GLContext::GetTexImage(GLuint aTexture, bool aYInvert, SurfaceFormat aFormat)
|
||||||
{
|
{
|
||||||
MakeCurrent();
|
MakeCurrent();
|
||||||
GuaranteeResolve();
|
GuaranteeResolve();
|
||||||
|
@ -1507,7 +1507,7 @@ GLContext::GetTexImage(GLuint aTexture, bool aYInvert, ShaderProgramType aShader
|
||||||
fPixelStorei(LOCAL_GL_PACK_ALIGNMENT, currentPackAlignment);
|
fPixelStorei(LOCAL_GL_PACK_ALIGNMENT, currentPackAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aShader == RGBALayerProgramType || aShader == RGBXLayerProgramType) {
|
if (aFormat == FORMAT_R8G8B8A8 || aFormat == FORMAT_R8G8B8X8) {
|
||||||
SwapRAndBComponents(surf);
|
SwapRAndBComponents(surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1768,7 +1768,7 @@ GLContext::ReadPixelsIntoImageSurface(gfxImageSurface* dest)
|
||||||
if (DebugMode()) {
|
if (DebugMode()) {
|
||||||
NS_WARNING("Needing intermediary surface for ReadPixels. This will be slow!");
|
NS_WARNING("Needing intermediary surface for ReadPixels. This will be slow!");
|
||||||
}
|
}
|
||||||
gfxASurface::gfxImageFormat readFormatGFX;
|
ImageFormat readFormatGFX;
|
||||||
|
|
||||||
switch (readFormat) {
|
switch (readFormat) {
|
||||||
case LOCAL_GL_RGBA:
|
case LOCAL_GL_RGBA:
|
||||||
|
@ -2033,7 +2033,7 @@ DataOffset(gfxImageSurface *aSurf, const nsIntPoint &aPoint)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderProgramType
|
GLContext::SurfaceFormat
|
||||||
GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||||
const nsIntRegion& aDstRegion,
|
const nsIntRegion& aDstRegion,
|
||||||
GLuint& aTexture,
|
GLuint& aTexture,
|
||||||
|
@ -2110,37 +2110,36 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||||
GLenum format;
|
GLenum format;
|
||||||
GLenum type;
|
GLenum type;
|
||||||
int32_t pixelSize = gfxASurface::BytePerPixelFromFormat(imageSurface->Format());
|
int32_t pixelSize = gfxASurface::BytePerPixelFromFormat(imageSurface->Format());
|
||||||
ShaderProgramType shader;
|
SurfaceFormat surfaceFormat;
|
||||||
|
|
||||||
switch (imageSurface->Format()) {
|
switch (imageSurface->Format()) {
|
||||||
case gfxASurface::ImageFormatARGB32:
|
case gfxASurface::ImageFormatARGB32:
|
||||||
format = LOCAL_GL_RGBA;
|
format = LOCAL_GL_RGBA;
|
||||||
type = LOCAL_GL_UNSIGNED_BYTE;
|
type = LOCAL_GL_UNSIGNED_BYTE;
|
||||||
shader = BGRALayerProgramType;
|
surfaceFormat = FORMAT_B8G8R8A8;
|
||||||
break;
|
break;
|
||||||
case gfxASurface::ImageFormatRGB24:
|
case gfxASurface::ImageFormatRGB24:
|
||||||
// Treat RGB24 surfaces as RGBA32 except for the shader
|
// Treat RGB24 surfaces as RGBA32 except for the shader
|
||||||
// program used.
|
// program used.
|
||||||
format = LOCAL_GL_RGBA;
|
format = LOCAL_GL_RGBA;
|
||||||
type = LOCAL_GL_UNSIGNED_BYTE;
|
type = LOCAL_GL_UNSIGNED_BYTE;
|
||||||
shader = BGRXLayerProgramType;
|
surfaceFormat = FORMAT_B8G8R8X8;
|
||||||
break;
|
break;
|
||||||
case gfxASurface::ImageFormatRGB16_565:
|
case gfxASurface::ImageFormatRGB16_565:
|
||||||
format = LOCAL_GL_RGB;
|
format = LOCAL_GL_RGB;
|
||||||
type = LOCAL_GL_UNSIGNED_SHORT_5_6_5;
|
type = LOCAL_GL_UNSIGNED_SHORT_5_6_5;
|
||||||
shader = RGBALayerProgramType;
|
surfaceFormat = FORMAT_R5G6B5;
|
||||||
break;
|
break;
|
||||||
case gfxASurface::ImageFormatA8:
|
case gfxASurface::ImageFormatA8:
|
||||||
format = LOCAL_GL_LUMINANCE;
|
format = LOCAL_GL_LUMINANCE;
|
||||||
type = LOCAL_GL_UNSIGNED_BYTE;
|
type = LOCAL_GL_UNSIGNED_BYTE;
|
||||||
// We don't have a specific luminance shader
|
surfaceFormat = FORMAT_A8;
|
||||||
shader = ShaderProgramType(0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NS_ASSERTION(false, "Unhandled image surface format!");
|
NS_ASSERTION(false, "Unhandled image surface format!");
|
||||||
format = 0;
|
format = 0;
|
||||||
type = 0;
|
type = 0;
|
||||||
shader = ShaderProgramType(0);
|
surfaceFormat = FORMAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t stride = imageSurface->Stride();
|
int32_t stride = imageSurface->Stride();
|
||||||
|
@ -2189,7 +2188,7 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return shader;
|
return surfaceFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLint GetAddressAlignment(ptrdiff_t aAddress)
|
static GLint GetAddressAlignment(ptrdiff_t aAddress)
|
||||||
|
|
|
@ -89,6 +89,8 @@ class GLContext
|
||||||
protected:
|
protected:
|
||||||
typedef class gfx::SharedSurface SharedSurface;
|
typedef class gfx::SharedSurface SharedSurface;
|
||||||
typedef gfx::SharedSurfaceType SharedSurfaceType;
|
typedef gfx::SharedSurfaceType SharedSurfaceType;
|
||||||
|
typedef gfxASurface::gfxImageFormat ImageFormat;
|
||||||
|
typedef gfx::SurfaceFormat SurfaceFormat;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef struct gfx::SurfaceCaps SurfaceCaps;
|
typedef struct gfx::SurfaceCaps SurfaceCaps;
|
||||||
|
@ -489,7 +491,7 @@ public:
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GLenum mTarget;
|
GLenum mTarget;
|
||||||
ShaderProgramType mProgramType;
|
SurfaceFormat mTextureFormat;
|
||||||
gfx3DMatrix mTextureTransform;
|
gfx3DMatrix mTextureTransform;
|
||||||
} SharedHandleDetails;
|
} SharedHandleDetails;
|
||||||
|
|
||||||
|
@ -805,7 +807,7 @@ public:
|
||||||
GLenum aTextureFormat,
|
GLenum aTextureFormat,
|
||||||
bool aYInvert = false);
|
bool aYInvert = false);
|
||||||
|
|
||||||
already_AddRefed<gfxImageSurface> GetTexImage(GLuint aTexture, bool aYInvert, ShaderProgramType aShader);
|
already_AddRefed<gfxImageSurface> GetTexImage(GLuint aTexture, bool aYInvert, SurfaceFormat aFormat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call ReadPixels into an existing gfxImageSurface.
|
* Call ReadPixels into an existing gfxImageSurface.
|
||||||
|
@ -877,15 +879,15 @@ public:
|
||||||
* surface. This testure may be overridden, clients should not rely on
|
* surface. This testure may be overridden, clients should not rely on
|
||||||
* the contents of this texture after this call or even on this
|
* the contents of this texture after this call or even on this
|
||||||
* texture unit being active.
|
* texture unit being active.
|
||||||
* \return Shader program needed to render this texture.
|
* \return Surface format of this texture.
|
||||||
*/
|
*/
|
||||||
ShaderProgramType UploadSurfaceToTexture(gfxASurface *aSurface,
|
SurfaceFormat UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||||
const nsIntRegion& aDstRegion,
|
const nsIntRegion& aDstRegion,
|
||||||
GLuint& aTexture,
|
GLuint& aTexture,
|
||||||
bool aOverwrite = false,
|
bool aOverwrite = false,
|
||||||
const nsIntPoint& aSrcPoint = nsIntPoint(0, 0),
|
const nsIntPoint& aSrcPoint = nsIntPoint(0, 0),
|
||||||
bool aPixelBuffer = false,
|
bool aPixelBuffer = false,
|
||||||
GLenum aTextureUnit = LOCAL_GL_TEXTURE0);
|
GLenum aTextureUnit = LOCAL_GL_TEXTURE0);
|
||||||
|
|
||||||
|
|
||||||
void TexImage2D(GLenum target, GLint level, GLint internalformat,
|
void TexImage2D(GLenum target, GLint level, GLint internalformat,
|
||||||
|
|
|
@ -201,7 +201,7 @@ public:
|
||||||
SharedHandleDetails& details)
|
SharedHandleDetails& details)
|
||||||
{
|
{
|
||||||
details.mTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
|
details.mTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
|
||||||
details.mProgramType = RGBARectLayerProgramType;
|
details.mTextureFormat = FORMAT_R8G8B8A8;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ public:
|
||||||
|
|
||||||
#include "gfxCrashReporterUtils.h"
|
#include "gfxCrashReporterUtils.h"
|
||||||
|
|
||||||
|
using namespace mozilla::gfx;
|
||||||
|
|
||||||
#if defined(MOZ_PLATFORM_MAEMO) || defined(MOZ_WIDGET_GONK)
|
#if defined(MOZ_PLATFORM_MAEMO) || defined(MOZ_WIDGET_GONK)
|
||||||
static bool gUseBackingSurface = true;
|
static bool gUseBackingSurface = true;
|
||||||
|
@ -981,7 +982,7 @@ bool GLContextEGL::GetSharedHandleDetails(SharedTextureShareType shareType,
|
||||||
SurfaceTextureWrapper* surfaceWrapper = reinterpret_cast<SurfaceTextureWrapper*>(wrapper);
|
SurfaceTextureWrapper* surfaceWrapper = reinterpret_cast<SurfaceTextureWrapper*>(wrapper);
|
||||||
|
|
||||||
details.mTarget = LOCAL_GL_TEXTURE_EXTERNAL;
|
details.mTarget = LOCAL_GL_TEXTURE_EXTERNAL;
|
||||||
details.mProgramType = RGBALayerExternalProgramType;
|
details.mTextureFormat = FORMAT_R8G8B8A8;
|
||||||
surfaceWrapper->SurfaceTexture()->GetTransformMatrix(details.mTextureTransform);
|
surfaceWrapper->SurfaceTexture()->GetTransformMatrix(details.mTextureTransform);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -989,7 +990,7 @@ bool GLContextEGL::GetSharedHandleDetails(SharedTextureShareType shareType,
|
||||||
|
|
||||||
case SharedHandleType::Image:
|
case SharedHandleType::Image:
|
||||||
details.mTarget = LOCAL_GL_TEXTURE_2D;
|
details.mTarget = LOCAL_GL_TEXTURE_2D;
|
||||||
details.mProgramType = RGBALayerProgramType;
|
details.mTextureFormat = FORMAT_R8G8B8A8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1117,21 +1118,21 @@ public:
|
||||||
|
|
||||||
if (gUseBackingSurface) {
|
if (gUseBackingSurface) {
|
||||||
if (mUpdateFormat != gfxASurface::ImageFormatARGB32) {
|
if (mUpdateFormat != gfxASurface::ImageFormatARGB32) {
|
||||||
mShaderType = RGBXLayerProgramType;
|
mTextureFormat = FORMAT_R8G8B8X8;
|
||||||
} else {
|
} else {
|
||||||
mShaderType = RGBALayerProgramType;
|
mTextureFormat = FORMAT_R8G8B8A8;
|
||||||
}
|
}
|
||||||
Resize(aSize);
|
Resize(aSize);
|
||||||
} else {
|
} else {
|
||||||
if (mUpdateFormat == gfxASurface::ImageFormatRGB16_565) {
|
if (mUpdateFormat == gfxASurface::ImageFormatRGB16_565) {
|
||||||
mShaderType = RGBXLayerProgramType;
|
mTextureFormat = FORMAT_R8G8B8X8;
|
||||||
} else if (mUpdateFormat == gfxASurface::ImageFormatRGB24) {
|
} else if (mUpdateFormat == gfxASurface::ImageFormatRGB24) {
|
||||||
// RGB24 means really RGBX for Thebes, which means we have to
|
// RGB24 means really RGBX for Thebes, which means we have to
|
||||||
// use the right shader and ignore the uninitialized alpha
|
// use the right shader and ignore the uninitialized alpha
|
||||||
// value.
|
// value.
|
||||||
mShaderType = BGRXLayerProgramType;
|
mTextureFormat = FORMAT_B8G8R8X8;
|
||||||
} else {
|
} else {
|
||||||
mShaderType = BGRALayerProgramType;
|
mTextureFormat = FORMAT_B8G8R8A8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1296,7 +1297,7 @@ public:
|
||||||
region = aRegion;
|
region = aRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
mShaderType =
|
mTextureFormat =
|
||||||
mGLContext->UploadSurfaceToTexture(aSurf,
|
mGLContext->UploadSurfaceToTexture(aSurf,
|
||||||
region,
|
region,
|
||||||
mTexture,
|
mTexture,
|
||||||
|
|
|
@ -1062,9 +1062,9 @@ private:
|
||||||
, sGLXLib(sGLXLibrary[aLibType])
|
, sGLXLib(sGLXLibrary[aLibType])
|
||||||
{
|
{
|
||||||
if (aSurface->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA) {
|
if (aSurface->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA) {
|
||||||
mShaderType = gl::RGBALayerProgramType;
|
mTextureFormat = FORMAT_R8G8B8A8;
|
||||||
} else {
|
} else {
|
||||||
mShaderType = gl::RGBXLayerProgramType;
|
mTextureFormat = FORMAT_R8G8B8X8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,23 +15,6 @@ typedef int GLsizei;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace gl {
|
namespace gl {
|
||||||
|
|
||||||
enum ShaderProgramType {
|
|
||||||
RGBALayerProgramType,
|
|
||||||
RGBALayerExternalProgramType,
|
|
||||||
BGRALayerProgramType,
|
|
||||||
RGBXLayerProgramType,
|
|
||||||
BGRXLayerProgramType,
|
|
||||||
RGBARectLayerProgramType,
|
|
||||||
RGBAExternalLayerProgramType,
|
|
||||||
ColorLayerProgramType,
|
|
||||||
YCbCrLayerProgramType,
|
|
||||||
ComponentAlphaPass1ProgramType,
|
|
||||||
ComponentAlphaPass2ProgramType,
|
|
||||||
Copy2DProgramType,
|
|
||||||
Copy2DRectProgramType,
|
|
||||||
NumProgramTypes
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GLFormats
|
struct GLFormats
|
||||||
{
|
{
|
||||||
// Constructs a zeroed object:
|
// Constructs a zeroed object:
|
||||||
|
|
|
@ -98,7 +98,7 @@ BasicTextureImage::EndUpdate()
|
||||||
|
|
||||||
bool relative = FinishedSurfaceUpdate();
|
bool relative = FinishedSurfaceUpdate();
|
||||||
|
|
||||||
mShaderType =
|
mTextureFormat =
|
||||||
mGLContext->UploadSurfaceToTexture(mUpdateSurface,
|
mGLContext->UploadSurfaceToTexture(mUpdateSurface,
|
||||||
mUpdateRegion,
|
mUpdateRegion,
|
||||||
mTexture,
|
mTexture,
|
||||||
|
@ -156,7 +156,7 @@ BasicTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion,
|
||||||
region = aRegion;
|
region = aRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
mShaderType =
|
mTextureFormat =
|
||||||
mGLContext->UploadSurfaceToTexture(aSurf,
|
mGLContext->UploadSurfaceToTexture(aSurf,
|
||||||
region,
|
region,
|
||||||
mTexture,
|
mTexture,
|
||||||
|
@ -268,7 +268,7 @@ TiledTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion,
|
||||||
} while (NextTile() || (mTextureState != Valid));
|
} while (NextTile() || (mTextureState != Valid));
|
||||||
mCurrentImage = oldCurrentImage;
|
mCurrentImage = oldCurrentImage;
|
||||||
|
|
||||||
mShaderType = mImages[0]->GetShaderProgramType();
|
mTextureFormat = mImages[0]->GetTextureFormat();
|
||||||
mTextureState = Valid;
|
mTextureState = Valid;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ TiledTextureImage::EndUpdate()
|
||||||
mImages[mCurrentImage]->EndUpdate();
|
mImages[mCurrentImage]->EndUpdate();
|
||||||
mInUpdate = false;
|
mInUpdate = false;
|
||||||
mTextureState = Valid;
|
mTextureState = Valid;
|
||||||
mShaderType = mImages[mCurrentImage]->GetShaderProgramType();
|
mTextureFormat = mImages[mCurrentImage]->GetTextureFormat();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ TiledTextureImage::EndUpdate()
|
||||||
|
|
||||||
mUpdateSurface = nullptr;
|
mUpdateSurface = nullptr;
|
||||||
mInUpdate = false;
|
mInUpdate = false;
|
||||||
mShaderType = mImages[0]->GetShaderProgramType();
|
mTextureFormat = mImages[0]->GetTextureFormat();
|
||||||
mTextureState = Valid;
|
mTextureState = Valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ class GLContext;
|
||||||
class TextureImage
|
class TextureImage
|
||||||
{
|
{
|
||||||
NS_INLINE_DECL_REFCOUNTING(TextureImage)
|
NS_INLINE_DECL_REFCOUNTING(TextureImage)
|
||||||
|
protected:
|
||||||
|
typedef gfxASurface::gfxImageFormat ImageFormat;
|
||||||
public:
|
public:
|
||||||
enum TextureState
|
enum TextureState
|
||||||
{
|
{
|
||||||
|
@ -201,13 +203,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the shader program type that should be used to render
|
* Returns the image format of the texture. Only valid after a matching
|
||||||
* this texture. Only valid after a matching BeginUpdate/EndUpdate
|
* BeginUpdate/EndUpdate pair have been called.
|
||||||
* pair have been called.
|
|
||||||
*/
|
*/
|
||||||
virtual ShaderProgramType GetShaderProgramType()
|
virtual gfx::SurfaceFormat GetTextureFormat() {
|
||||||
{
|
return mTextureFormat;
|
||||||
return mShaderType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Can be called safely at any time. */
|
/** Can be called safely at any time. */
|
||||||
|
@ -258,7 +258,7 @@ protected:
|
||||||
nsIntSize mSize;
|
nsIntSize mSize;
|
||||||
GLenum mWrapMode;
|
GLenum mWrapMode;
|
||||||
ContentType mContentType;
|
ContentType mContentType;
|
||||||
ShaderProgramType mShaderType;
|
gfx::SurfaceFormat mTextureFormat;
|
||||||
gfxPattern::GraphicsFilter mFilter;
|
gfxPattern::GraphicsFilter mFilter;
|
||||||
Flags mFlags;
|
Flags mFlags;
|
||||||
};
|
};
|
||||||
|
@ -276,7 +276,6 @@ class BasicTextureImage
|
||||||
: public TextureImage
|
: public TextureImage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef gfxASurface::gfxImageFormat ImageFormat;
|
|
||||||
virtual ~BasicTextureImage();
|
virtual ~BasicTextureImage();
|
||||||
|
|
||||||
BasicTextureImage(GLuint aTexture,
|
BasicTextureImage(GLuint aTexture,
|
||||||
|
|
|
@ -131,11 +131,7 @@ CanvasLayerOGL::Initialize(const Data& aData)
|
||||||
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(aData.mSurface);
|
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(aData.mSurface);
|
||||||
mPixmap = xsurf->GetGLXPixmap();
|
mPixmap = xsurf->GetGLXPixmap();
|
||||||
if (mPixmap) {
|
if (mPixmap) {
|
||||||
if (aData.mSurface->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA) {
|
mLayerProgram = ShaderProgramFromContentType(aData.mSurface->GetContentType());
|
||||||
mLayerProgram = gl::RGBALayerProgramType;
|
|
||||||
} else {
|
|
||||||
mLayerProgram = gl::RGBXLayerProgramType;
|
|
||||||
}
|
|
||||||
MakeTextureIfNeeded(gl(), mUploadTexture);
|
MakeTextureIfNeeded(gl(), mUploadTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,7 +232,7 @@ CanvasLayerOGL::UpdateSurface()
|
||||||
gfx::NATIVE_SURFACE_CGCONTEXT_ACCELERATED),
|
gfx::NATIVE_SURFACE_CGCONTEXT_ACCELERATED),
|
||||||
gl());
|
gl());
|
||||||
mTextureTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
|
mTextureTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
|
||||||
mLayerProgram = gl::RGBARectLayerProgramType;
|
mLayerProgram = RGBARectLayerProgramType;
|
||||||
}
|
}
|
||||||
mDrawTarget->Flush();
|
mDrawTarget->Flush();
|
||||||
return;
|
return;
|
||||||
|
@ -249,11 +245,13 @@ CanvasLayerOGL::UpdateSurface()
|
||||||
|
|
||||||
if (updatedSurface) {
|
if (updatedSurface) {
|
||||||
mOGLManager->MakeCurrent();
|
mOGLManager->MakeCurrent();
|
||||||
mLayerProgram = gl()->UploadSurfaceToTexture(updatedSurface,
|
gfx::SurfaceFormat format =
|
||||||
mBounds,
|
gl()->UploadSurfaceToTexture(updatedSurface,
|
||||||
mUploadTexture,
|
mBounds,
|
||||||
true,//false,
|
mUploadTexture,
|
||||||
nsIntPoint(0, 0));
|
true,//false,
|
||||||
|
nsIntPoint(0, 0));
|
||||||
|
mLayerProgram = ShaderProgramFromSurfaceFormat(format);
|
||||||
mTexture = mUploadTexture;
|
mTexture = mUploadTexture;
|
||||||
|
|
||||||
if (temporarySurface)
|
if (temporarySurface)
|
||||||
|
@ -294,12 +292,13 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
||||||
|
|
||||||
drawRect.IntersectRect(drawRect, GetEffectiveVisibleRegion().GetBounds());
|
drawRect.IntersectRect(drawRect, GetEffectiveVisibleRegion().GetBounds());
|
||||||
|
|
||||||
mLayerProgram =
|
gfx::SurfaceFormat format =
|
||||||
gl()->UploadSurfaceToTexture(mCanvasSurface,
|
gl()->UploadSurfaceToTexture(mCanvasSurface,
|
||||||
nsIntRect(0, 0, drawRect.width, drawRect.height),
|
nsIntRect(0, 0, drawRect.width, drawRect.height),
|
||||||
mUploadTexture,
|
mUploadTexture,
|
||||||
true,
|
true,
|
||||||
drawRect.TopLeft());
|
drawRect.TopLeft());
|
||||||
|
mLayerProgram = ShaderProgramFromSurfaceFormat(format);
|
||||||
mTexture = mUploadTexture;
|
mTexture = mUploadTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +315,7 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
||||||
gl()->ApplyFilterToBoundTexture(mFilter);
|
gl()->ApplyFilterToBoundTexture(mFilter);
|
||||||
|
|
||||||
program->Activate();
|
program->Activate();
|
||||||
if (mLayerProgram == gl::RGBARectLayerProgramType) {
|
if (mLayerProgram == RGBARectLayerProgramType) {
|
||||||
// This is used by IOSurface that use 0,0...w,h coordinate rather then 0,0..1,1.
|
// This is used by IOSurface that use 0,0...w,h coordinate rather then 0,0..1,1.
|
||||||
program->SetTexCoordMultiplier(mDrawTarget->GetSize().width, mDrawTarget->GetSize().height);
|
program->SetTexCoordMultiplier(mDrawTarget->GetSize().width, mDrawTarget->GetSize().height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
CanvasLayerOGL(LayerManagerOGL *aManager)
|
CanvasLayerOGL(LayerManagerOGL *aManager)
|
||||||
: CanvasLayer(aManager, NULL)
|
: CanvasLayer(aManager, NULL)
|
||||||
, LayerOGL(aManager)
|
, LayerOGL(aManager)
|
||||||
, mLayerProgram(gl::RGBALayerProgramType)
|
, mLayerProgram(RGBALayerProgramType)
|
||||||
, mTexture(0)
|
, mTexture(0)
|
||||||
, mTextureTarget(LOCAL_GL_TEXTURE_2D)
|
, mTextureTarget(LOCAL_GL_TEXTURE_2D)
|
||||||
, mDelayedUpdates(false)
|
, mDelayedUpdates(false)
|
||||||
|
@ -61,7 +61,7 @@ protected:
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> mCanvasSurface;
|
nsRefPtr<gfxASurface> mCanvasSurface;
|
||||||
nsRefPtr<GLContext> mGLContext;
|
nsRefPtr<GLContext> mGLContext;
|
||||||
gl::ShaderProgramType mLayerProgram;
|
ShaderProgramType mLayerProgram;
|
||||||
RefPtr<gfx::DrawTarget> mDrawTarget;
|
RefPtr<gfx::DrawTarget> mDrawTarget;
|
||||||
|
|
||||||
GLuint mTexture;
|
GLuint mTexture;
|
||||||
|
|
|
@ -34,7 +34,7 @@ RenderColorLayer(ColorLayer* aLayer, LayerManagerOGL *aManager,
|
||||||
color.b *= opacity;
|
color.b *= opacity;
|
||||||
color.a = opacity;
|
color.a = opacity;
|
||||||
|
|
||||||
ShaderProgramOGL *program = aManager->GetProgram(gl::ColorLayerProgramType,
|
ShaderProgramOGL *program = aManager->GetProgram(ColorLayerProgramType,
|
||||||
aLayer->GetMaskLayer());
|
aLayer->GetMaskLayer());
|
||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetLayerQuadRect(visibleRect);
|
program->SetLayerQuadRect(visibleRect);
|
||||||
|
|
|
@ -160,7 +160,7 @@ public:
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mInitParams.mStatus == InitParams::INITIALIZED);
|
MOZ_ASSERT(mInitParams.mStatus == InitParams::INITIALIZED);
|
||||||
CompositorOGL* compositorOGL = static_cast<CompositorOGL*>(aCompositor);
|
CompositorOGL* compositorOGL = static_cast<CompositorOGL*>(aCompositor);
|
||||||
return mGL->GetTexImage(mTextureHandle, true, compositorOGL->GetFBOLayerProgramType());
|
return mGL->GetTexImage(mTextureHandle, true, compositorOGL->GetFBOFormat());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ CompositorOGL::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialise a common shader to check that we can actually compile a shader
|
// initialise a common shader to check that we can actually compile a shader
|
||||||
if (!mPrograms[gl::RGBALayerProgramType].mVariations[MaskNone]->Initialize()) {
|
if (!mPrograms[RGBALayerProgramType].mVariations[MaskNone]->Initialize()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,12 +952,12 @@ CompositorOGL::CreateFBOWithTexture(const IntRect& aRect, SurfaceInitMode aInit,
|
||||||
*aTexture = tex;
|
*aTexture = tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl::ShaderProgramType
|
ShaderProgramType
|
||||||
CompositorOGL::GetProgramTypeForEffect(Effect *aEffect) const
|
CompositorOGL::GetProgramTypeForEffect(Effect *aEffect) const
|
||||||
{
|
{
|
||||||
switch(aEffect->mType) {
|
switch(aEffect->mType) {
|
||||||
case EFFECT_SOLID_COLOR:
|
case EFFECT_SOLID_COLOR:
|
||||||
return gl::ColorLayerProgramType;
|
return ColorLayerProgramType;
|
||||||
case EFFECT_RGBA:
|
case EFFECT_RGBA:
|
||||||
case EFFECT_RGBX:
|
case EFFECT_RGBX:
|
||||||
case EFFECT_BGRA:
|
case EFFECT_BGRA:
|
||||||
|
@ -966,14 +966,16 @@ CompositorOGL::GetProgramTypeForEffect(Effect *aEffect) const
|
||||||
TexturedEffect* texturedEffect =
|
TexturedEffect* texturedEffect =
|
||||||
static_cast<TexturedEffect*>(aEffect);
|
static_cast<TexturedEffect*>(aEffect);
|
||||||
TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
|
TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
|
||||||
return source->GetShaderProgram();
|
|
||||||
|
return ShaderProgramFromTargetAndFormat(source->GetTextureTarget(),
|
||||||
|
source->GetTextureFormat());
|
||||||
}
|
}
|
||||||
case EFFECT_YCBCR:
|
case EFFECT_YCBCR:
|
||||||
return gl::YCbCrLayerProgramType;
|
return YCbCrLayerProgramType;
|
||||||
case EFFECT_RENDER_TARGET:
|
case EFFECT_RENDER_TARGET:
|
||||||
return GetFBOLayerProgramType();
|
return GetFBOLayerProgramType();
|
||||||
default:
|
default:
|
||||||
return gl::RGBALayerProgramType;
|
return RGBALayerProgramType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,10 +1048,10 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
|
||||||
maskType = MaskNone;
|
maskType = MaskNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl::ShaderProgramType programType = GetProgramTypeForEffect(aEffectChain.mPrimaryEffect);
|
ShaderProgramType programType = GetProgramTypeForEffect(aEffectChain.mPrimaryEffect);
|
||||||
ShaderProgramOGL *program = GetProgram(programType, maskType);
|
ShaderProgramOGL *program = GetProgram(programType, maskType);
|
||||||
program->Activate();
|
program->Activate();
|
||||||
if (programType == gl::RGBARectLayerProgramType) {
|
if (programType == RGBARectLayerProgramType) {
|
||||||
TexturedEffect* texturedEffect =
|
TexturedEffect* texturedEffect =
|
||||||
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
|
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
|
||||||
TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
|
TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
|
||||||
|
@ -1105,7 +1107,7 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoBindTexture bindSource(source->AsSourceOGL(), LOCAL_GL_TEXTURE0);
|
AutoBindTexture bindSource(source->AsSourceOGL(), LOCAL_GL_TEXTURE0);
|
||||||
if (programType == gl::RGBALayerExternalProgramType) {
|
if (programType == RGBALayerExternalProgramType) {
|
||||||
program->SetTextureTransform(source->AsSourceOGL()->GetTextureTransform());
|
program->SetTextureTransform(source->AsSourceOGL()->GetTextureTransform());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1213,11 +1215,11 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
|
||||||
for (int32_t pass = 1; pass <=2; ++pass) {
|
for (int32_t pass = 1; pass <=2; ++pass) {
|
||||||
ShaderProgramOGL* program;
|
ShaderProgramOGL* program;
|
||||||
if (pass == 1) {
|
if (pass == 1) {
|
||||||
program = GetProgram(gl::ComponentAlphaPass1ProgramType, maskType);
|
program = GetProgram(ComponentAlphaPass1ProgramType, maskType);
|
||||||
gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_ONE_MINUS_SRC_COLOR,
|
gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_ONE_MINUS_SRC_COLOR,
|
||||||
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
||||||
} else {
|
} else {
|
||||||
program = GetProgram(gl::ComponentAlphaPass2ProgramType, maskType);
|
program = GetProgram(ComponentAlphaPass2ProgramType, maskType);
|
||||||
gl()->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE,
|
gl()->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE,
|
||||||
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class GLManagerCompositor;
|
||||||
class CompositorOGL : public Compositor
|
class CompositorOGL : public Compositor
|
||||||
{
|
{
|
||||||
typedef mozilla::gl::GLContext GLContext;
|
typedef mozilla::gl::GLContext GLContext;
|
||||||
typedef mozilla::gl::ShaderProgramType ProgramType;
|
typedef ShaderProgramType ProgramType;
|
||||||
|
|
||||||
friend class GLManagerCompositor;
|
friend class GLManagerCompositor;
|
||||||
|
|
||||||
|
@ -130,9 +130,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
GLContext* gl() const { return mGLContext; }
|
GLContext* gl() const { return mGLContext; }
|
||||||
gl::ShaderProgramType GetFBOLayerProgramType() const {
|
ShaderProgramType GetFBOLayerProgramType() const {
|
||||||
return mFBOTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB ?
|
return mFBOTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB ?
|
||||||
gl::RGBARectLayerProgramType : gl::RGBALayerProgramType;
|
RGBARectLayerProgramType : RGBALayerProgramType;
|
||||||
|
}
|
||||||
|
gfx::SurfaceFormat GetFBOFormat() const {
|
||||||
|
return gfx::FORMAT_R8G8B8A8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,7 +219,7 @@ private:
|
||||||
gfx::Rect *aClipRectOut = nullptr,
|
gfx::Rect *aClipRectOut = nullptr,
|
||||||
gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE;
|
gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE;
|
||||||
|
|
||||||
gl::ShaderProgramType GetProgramTypeForEffect(Effect* aEffect) const;
|
ShaderProgramType GetProgramTypeForEffect(Effect* aEffect) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates all layer programs with a new projection matrix.
|
* Updates all layer programs with a new projection matrix.
|
||||||
|
@ -227,9 +230,9 @@ private:
|
||||||
* Helper method for Initialize, creates all valid variations of a program
|
* Helper method for Initialize, creates all valid variations of a program
|
||||||
* and adds them to mPrograms
|
* and adds them to mPrograms
|
||||||
*/
|
*/
|
||||||
void AddPrograms(gl::ShaderProgramType aType);
|
void AddPrograms(ShaderProgramType aType);
|
||||||
|
|
||||||
ShaderProgramOGL* GetProgram(gl::ShaderProgramType aType,
|
ShaderProgramOGL* GetProgram(ShaderProgramType aType,
|
||||||
MaskType aMask = MaskNone) {
|
MaskType aMask = MaskNone) {
|
||||||
MOZ_ASSERT(ProgramProfileOGL::ProgramExists(aType, aMask),
|
MOZ_ASSERT(ProgramProfileOGL::ProgramExists(aType, aMask),
|
||||||
"Invalid program type.");
|
"Invalid program type.");
|
||||||
|
|
|
@ -287,7 +287,7 @@ ContainerRender(Container* aContainer,
|
||||||
#ifdef MOZ_DUMP_PAINTING
|
#ifdef MOZ_DUMP_PAINTING
|
||||||
if (gfxUtils::sDumpPainting) {
|
if (gfxUtils::sDumpPainting) {
|
||||||
nsRefPtr<gfxImageSurface> surf =
|
nsRefPtr<gfxImageSurface> surf =
|
||||||
aContainer->gl()->GetTexImage(containerSurface, true, aManager->GetFBOLayerProgramType());
|
aContainer->gl()->GetTexImage(containerSurface, true, aManager->GetFBOTextureFormat());
|
||||||
|
|
||||||
WriteSnapshotToDumpFile(aContainer, surf);
|
WriteSnapshotToDumpFile(aContainer, surf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
return mImpl->gl();
|
return mImpl->gl();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ShaderProgramOGL* GetProgram(gl::ShaderProgramType aType) MOZ_OVERRIDE
|
virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
return mImpl->GetProgram(aType);
|
return mImpl->GetProgram(aType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,12 @@ public:
|
||||||
virtual ~GLManager() {}
|
virtual ~GLManager() {}
|
||||||
|
|
||||||
virtual gl::GLContext* gl() const = 0;
|
virtual gl::GLContext* gl() const = 0;
|
||||||
virtual ShaderProgramOGL* GetProgram(gl::ShaderProgramType aType) = 0;
|
virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) = 0;
|
||||||
virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) = 0;
|
virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) = 0;
|
||||||
|
|
||||||
|
ShaderProgramOGL* GetProgram(gfx::SurfaceFormat aFormat) {
|
||||||
|
return GetProgram(ShaderProgramFromSurfaceFormat(aFormat));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,8 +288,7 @@ ImageLayerOGL::RenderLayer(int,
|
||||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, data->mTexture.GetTextureID());
|
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, data->mTexture.GetTextureID());
|
||||||
|
|
||||||
ShaderProgramOGL *program =
|
ShaderProgramOGL *program = mOGLManager->GetProgram(data->mLayerProgram, GetMaskLayer());
|
||||||
mOGLManager->GetProgram(data->mLayerProgram, GetMaskLayer());
|
|
||||||
|
|
||||||
gl()->ApplyFilterToBoundTexture(mFilter);
|
gl()->ApplyFilterToBoundTexture(mFilter);
|
||||||
|
|
||||||
|
@ -314,10 +313,13 @@ ImageLayerOGL::RenderLayer(int,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderProgramOGL* program = mOGLManager->GetProgram(handleDetails.mProgramType, GetMaskLayer());
|
ShaderProgramType programType =
|
||||||
|
ShaderProgramFromTargetAndFormat(handleDetails.mTarget,
|
||||||
|
handleDetails.mTextureFormat);
|
||||||
|
ShaderProgramOGL* program = mOGLManager->GetProgram(programType, GetMaskLayer());
|
||||||
|
|
||||||
program->Activate();
|
program->Activate();
|
||||||
if (handleDetails.mProgramType == gl::RGBARectLayerProgramType) {
|
if (programType == RGBARectLayerProgramType) {
|
||||||
// 2DRect case, get the multiplier right for a sampler2DRect
|
// 2DRect case, get the multiplier right for a sampler2DRect
|
||||||
program->SetTexCoordMultiplier(data->mSize.width, data->mSize.height);
|
program->SetTexCoordMultiplier(data->mSize.width, data->mSize.height);
|
||||||
}
|
}
|
||||||
|
@ -459,12 +461,7 @@ ImageLayerOGL::AllocateTexturesCairo(CairoImage *aImage)
|
||||||
static_cast<gfxXlibSurface*>(aImage->mSurface.get());
|
static_cast<gfxXlibSurface*>(aImage->mSurface.get());
|
||||||
GLXPixmap pixmap = xsurf->GetGLXPixmap();
|
GLXPixmap pixmap = xsurf->GetGLXPixmap();
|
||||||
if (pixmap) {
|
if (pixmap) {
|
||||||
if (aImage->mSurface->GetContentType()
|
backendData->mLayerProgram = ShaderProgramFromContentType(aImage->mSurface->GetContentType());
|
||||||
== gfxASurface::CONTENT_COLOR_ALPHA) {
|
|
||||||
backendData->mLayerProgram = gl::RGBALayerProgramType;
|
|
||||||
} else {
|
|
||||||
backendData->mLayerProgram = gl::RGBXLayerProgramType;
|
|
||||||
}
|
|
||||||
|
|
||||||
aImage->SetBackendData(LAYERS_OPENGL, backendData.forget());
|
aImage->SetBackendData(LAYERS_OPENGL, backendData.forget());
|
||||||
|
|
||||||
|
@ -474,10 +471,11 @@ ImageLayerOGL::AllocateTexturesCairo(CairoImage *aImage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
backendData->mLayerProgram =
|
gfx::SurfaceFormat format =
|
||||||
gl->UploadSurfaceToTexture(aImage->mSurface,
|
gl->UploadSurfaceToTexture(aImage->mSurface,
|
||||||
nsIntRect(0,0, aImage->mSize.width, aImage->mSize.height),
|
nsIntRect(0,0, aImage->mSize.width, aImage->mSize.height),
|
||||||
tex, true);
|
tex, true);
|
||||||
|
backendData->mLayerProgram = ShaderProgramFromSurfaceFormat(format);
|
||||||
|
|
||||||
aImage->SetBackendData(LAYERS_OPENGL, backendData.forget());
|
aImage->SetBackendData(LAYERS_OPENGL, backendData.forget());
|
||||||
}
|
}
|
||||||
|
@ -547,13 +545,14 @@ ImageLayerOGL::LoadAsTexture(GLuint aTextureUnit, gfxIntSize* aSize)
|
||||||
|
|
||||||
GLuint texID = texture.GetTextureID();
|
GLuint texID = texture.GetTextureID();
|
||||||
|
|
||||||
data->mLayerProgram =
|
gfx::SurfaceFormat format =
|
||||||
texGL->UploadSurfaceToTexture(cairoImage->mSurface,
|
texGL->UploadSurfaceToTexture(cairoImage->mSurface,
|
||||||
nsIntRect(0,0,
|
nsIntRect(0,0,
|
||||||
data->mTextureSize.width,
|
data->mTextureSize.width,
|
||||||
data->mTextureSize.height),
|
data->mTextureSize.height),
|
||||||
texID, true, nsIntPoint(0,0), false,
|
texID, true, nsIntPoint(0,0), false,
|
||||||
aTextureUnit);
|
aTextureUnit);
|
||||||
|
data->mLayerProgram = ShaderProgramFromSurfaceFormat(format);
|
||||||
|
|
||||||
cairoImage->SetBackendData(LAYERS_OPENGL, data);
|
cairoImage->SetBackendData(LAYERS_OPENGL, data);
|
||||||
|
|
||||||
|
|
|
@ -147,9 +147,9 @@ struct PlanarYCbCrOGLBackendData : public ImageBackendData
|
||||||
|
|
||||||
struct CairoOGLBackendData : public ImageBackendData
|
struct CairoOGLBackendData : public ImageBackendData
|
||||||
{
|
{
|
||||||
CairoOGLBackendData() : mLayerProgram(gl::RGBALayerProgramType) {}
|
CairoOGLBackendData() : mLayerProgram(RGBALayerProgramType) {}
|
||||||
GLTexture mTexture;
|
GLTexture mTexture;
|
||||||
gl::ShaderProgramType mLayerProgram;
|
ShaderProgramType mLayerProgram;
|
||||||
gfxIntSize mTextureSize;
|
gfxIntSize mTextureSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ LayerManagerOGL::Initialize(bool force)
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialise a common shader to check that we can actually compile a shader
|
// initialise a common shader to check that we can actually compile a shader
|
||||||
if (!mPrograms[gl::RGBALayerProgramType].mVariations[MaskNone]->Initialize()) {
|
if (!mPrograms[RGBALayerProgramType].mVariations[MaskNone]->Initialize()) {
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
NS_RUNTIMEABORT("Shader initialization failed");
|
NS_RUNTIMEABORT("Shader initialization failed");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,7 +46,6 @@ struct FPSState;
|
||||||
class LayerManagerOGL : public LayerManager
|
class LayerManagerOGL : public LayerManager
|
||||||
{
|
{
|
||||||
typedef mozilla::gl::GLContext GLContext;
|
typedef mozilla::gl::GLContext GLContext;
|
||||||
typedef mozilla::gl::ShaderProgramType ProgramType;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LayerManagerOGL(nsIWidget *aWidget, int aSurfaceWidth = -1, int aSurfaceHeight = -1,
|
LayerManagerOGL(nsIWidget *aWidget, int aSurfaceWidth = -1, int aSurfaceHeight = -1,
|
||||||
|
@ -125,29 +124,29 @@ public:
|
||||||
ShaderProgramOGL* GetBasicLayerProgram(bool aOpaque, bool aIsRGB,
|
ShaderProgramOGL* GetBasicLayerProgram(bool aOpaque, bool aIsRGB,
|
||||||
MaskType aMask = MaskNone)
|
MaskType aMask = MaskNone)
|
||||||
{
|
{
|
||||||
gl::ShaderProgramType format = gl::BGRALayerProgramType;
|
ShaderProgramType format = BGRALayerProgramType;
|
||||||
if (aIsRGB) {
|
if (aIsRGB) {
|
||||||
if (aOpaque) {
|
if (aOpaque) {
|
||||||
format = gl::RGBXLayerProgramType;
|
format = RGBXLayerProgramType;
|
||||||
} else {
|
} else {
|
||||||
format = gl::RGBALayerProgramType;
|
format = RGBALayerProgramType;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (aOpaque) {
|
if (aOpaque) {
|
||||||
format = gl::BGRXLayerProgramType;
|
format = BGRXLayerProgramType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GetProgram(format, aMask);
|
return GetProgram(format, aMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderProgramOGL* GetProgram(gl::ShaderProgramType aType,
|
ShaderProgramOGL* GetProgram(ShaderProgramType aType,
|
||||||
Layer* aMaskLayer) {
|
Layer* aMaskLayer) {
|
||||||
if (aMaskLayer)
|
if (aMaskLayer)
|
||||||
return GetProgram(aType, Mask2d);
|
return GetProgram(aType, Mask2d);
|
||||||
return GetProgram(aType, MaskNone);
|
return GetProgram(aType, MaskNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderProgramOGL* GetProgram(gl::ShaderProgramType aType,
|
ShaderProgramOGL* GetProgram(ShaderProgramType aType,
|
||||||
MaskType aMask = MaskNone) {
|
MaskType aMask = MaskNone) {
|
||||||
NS_ASSERTION(ProgramProfileOGL::ProgramExists(aType, aMask),
|
NS_ASSERTION(ProgramProfileOGL::ProgramExists(aType, aMask),
|
||||||
"Invalid program type.");
|
"Invalid program type.");
|
||||||
|
@ -158,10 +157,14 @@ public:
|
||||||
return GetProgram(GetFBOLayerProgramType(), aMask);
|
return GetProgram(GetFBOLayerProgramType(), aMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
gl::ShaderProgramType GetFBOLayerProgramType() {
|
ShaderProgramType GetFBOLayerProgramType() {
|
||||||
if (mFBOTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB)
|
if (mFBOTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB)
|
||||||
return gl::RGBARectLayerProgramType;
|
return RGBARectLayerProgramType;
|
||||||
return gl::RGBALayerProgramType;
|
return RGBALayerProgramType;
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::SurfaceFormat GetFBOTextureFormat() {
|
||||||
|
return gfx::FORMAT_R8G8B8A8;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLContext* gl() const { return mGLContext; }
|
GLContext* gl() const { return mGLContext; }
|
||||||
|
@ -395,7 +398,7 @@ private:
|
||||||
* Helper method for Initialize, creates all valid variations of a program
|
* Helper method for Initialize, creates all valid variations of a program
|
||||||
* and adds them to mPrograms
|
* and adds them to mPrograms
|
||||||
*/
|
*/
|
||||||
void AddPrograms(gl::ShaderProgramType aType);
|
void AddPrograms(ShaderProgramType aType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursive helper method for use by ComputeRenderIntegrity. Subtracts
|
* Recursive helper method for use by ComputeRenderIntegrity. Subtracts
|
||||||
|
|
|
@ -36,14 +36,14 @@ AddCommonTextureArgs(ProgramProfileOGL& aProfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ ProgramProfileOGL
|
/* static */ ProgramProfileOGL
|
||||||
ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
ProgramProfileOGL::GetProfileFor(ShaderProgramType aType,
|
||||||
MaskType aMask)
|
MaskType aMask)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(ProgramExists(aType, aMask), "Invalid program type.");
|
NS_ASSERTION(ProgramExists(aType, aMask), "Invalid program type.");
|
||||||
ProgramProfileOGL result;
|
ProgramProfileOGL result;
|
||||||
|
|
||||||
switch (aType) {
|
switch (aType) {
|
||||||
case gl::RGBALayerProgramType:
|
case RGBALayerProgramType:
|
||||||
if (aMask == Mask3d) {
|
if (aMask == Mask3d) {
|
||||||
result.mVertexShaderString = sLayerMask3DVS;
|
result.mVertexShaderString = sLayerMask3DVS;
|
||||||
result.mFragmentShaderString = sRGBATextureLayerMask3DFS;
|
result.mFragmentShaderString = sRGBATextureLayerMask3DFS;
|
||||||
|
@ -58,7 +58,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
AddCommonTextureArgs(result);
|
AddCommonTextureArgs(result);
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case gl::RGBALayerExternalProgramType:
|
case RGBALayerExternalProgramType:
|
||||||
if (aMask == Mask3d) {
|
if (aMask == Mask3d) {
|
||||||
result.mVertexShaderString = sLayerMask3DVS;
|
result.mVertexShaderString = sLayerMask3DVS;
|
||||||
result.mFragmentShaderString = sRGBATextureLayerExternalMask3DFS;
|
result.mFragmentShaderString = sRGBATextureLayerExternalMask3DFS;
|
||||||
|
@ -75,7 +75,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
result.mHasTextureTransform = true;
|
result.mHasTextureTransform = true;
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case gl::BGRALayerProgramType:
|
case BGRALayerProgramType:
|
||||||
if (aMask == Mask2d) {
|
if (aMask == Mask2d) {
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
result.mVertexShaderString = sLayerMaskVS;
|
||||||
result.mFragmentShaderString = sBGRATextureLayerMaskFS;
|
result.mFragmentShaderString = sBGRATextureLayerMaskFS;
|
||||||
|
@ -87,7 +87,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
AddCommonTextureArgs(result);
|
AddCommonTextureArgs(result);
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case gl::RGBXLayerProgramType:
|
case RGBXLayerProgramType:
|
||||||
if (aMask == Mask2d) {
|
if (aMask == Mask2d) {
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
result.mVertexShaderString = sLayerMaskVS;
|
||||||
result.mFragmentShaderString = sRGBXTextureLayerMaskFS;
|
result.mFragmentShaderString = sRGBXTextureLayerMaskFS;
|
||||||
|
@ -99,7 +99,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
AddCommonTextureArgs(result);
|
AddCommonTextureArgs(result);
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case gl::BGRXLayerProgramType:
|
case BGRXLayerProgramType:
|
||||||
if (aMask == Mask2d) {
|
if (aMask == Mask2d) {
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
result.mVertexShaderString = sLayerMaskVS;
|
||||||
result.mFragmentShaderString = sBGRXTextureLayerMaskFS;
|
result.mFragmentShaderString = sBGRXTextureLayerMaskFS;
|
||||||
|
@ -111,7 +111,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
AddCommonTextureArgs(result);
|
AddCommonTextureArgs(result);
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case gl::RGBARectLayerProgramType:
|
case RGBARectLayerProgramType:
|
||||||
if (aMask == Mask3d) {
|
if (aMask == Mask3d) {
|
||||||
result.mVertexShaderString = sLayerMask3DVS;
|
result.mVertexShaderString = sLayerMask3DVS;
|
||||||
result.mFragmentShaderString = sRGBARectTextureLayerMask3DFS;
|
result.mFragmentShaderString = sRGBARectTextureLayerMask3DFS;
|
||||||
|
@ -126,7 +126,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
AddCommonTextureArgs(result);
|
AddCommonTextureArgs(result);
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case gl::RGBAExternalLayerProgramType:
|
case RGBAExternalLayerProgramType:
|
||||||
if (aMask == Mask3d) {
|
if (aMask == Mask3d) {
|
||||||
result.mVertexShaderString = sLayerMask3DVS;
|
result.mVertexShaderString = sLayerMask3DVS;
|
||||||
result.mFragmentShaderString = sRGBAExternalTextureLayerMask3DFS;
|
result.mFragmentShaderString = sRGBAExternalTextureLayerMask3DFS;
|
||||||
|
@ -141,7 +141,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
AddCommonTextureArgs(result);
|
AddCommonTextureArgs(result);
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case gl::ColorLayerProgramType:
|
case ColorLayerProgramType:
|
||||||
if (aMask == Mask2d) {
|
if (aMask == Mask2d) {
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
result.mVertexShaderString = sLayerMaskVS;
|
||||||
result.mFragmentShaderString = sSolidColorLayerMaskFS;
|
result.mFragmentShaderString = sSolidColorLayerMaskFS;
|
||||||
|
@ -152,7 +152,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
AddCommonArgs(result);
|
AddCommonArgs(result);
|
||||||
result.mUniforms.AppendElement(Argument("uRenderColor"));
|
result.mUniforms.AppendElement(Argument("uRenderColor"));
|
||||||
break;
|
break;
|
||||||
case gl::YCbCrLayerProgramType:
|
case YCbCrLayerProgramType:
|
||||||
if (aMask == Mask2d) {
|
if (aMask == Mask2d) {
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
result.mVertexShaderString = sLayerMaskVS;
|
||||||
result.mFragmentShaderString = sYCbCrTextureLayerMaskFS;
|
result.mFragmentShaderString = sYCbCrTextureLayerMaskFS;
|
||||||
|
@ -168,7 +168,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
result.mAttributes.AppendElement(Argument("aTexCoord"));
|
result.mAttributes.AppendElement(Argument("aTexCoord"));
|
||||||
result.mTextureCount = 3;
|
result.mTextureCount = 3;
|
||||||
break;
|
break;
|
||||||
case gl::ComponentAlphaPass1ProgramType:
|
case ComponentAlphaPass1ProgramType:
|
||||||
if (aMask == Mask2d) {
|
if (aMask == Mask2d) {
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
result.mVertexShaderString = sLayerMaskVS;
|
||||||
result.mFragmentShaderString = sComponentPassMask1FS;
|
result.mFragmentShaderString = sComponentPassMask1FS;
|
||||||
|
@ -183,7 +183,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
result.mAttributes.AppendElement(Argument("aTexCoord"));
|
result.mAttributes.AppendElement(Argument("aTexCoord"));
|
||||||
result.mTextureCount = 2;
|
result.mTextureCount = 2;
|
||||||
break;
|
break;
|
||||||
case gl::ComponentAlphaPass2ProgramType:
|
case ComponentAlphaPass2ProgramType:
|
||||||
if (aMask == Mask2d) {
|
if (aMask == Mask2d) {
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
result.mVertexShaderString = sLayerMaskVS;
|
||||||
result.mFragmentShaderString = sComponentPassMask2FS;
|
result.mFragmentShaderString = sComponentPassMask2FS;
|
||||||
|
@ -198,7 +198,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
result.mAttributes.AppendElement(Argument("aTexCoord"));
|
result.mAttributes.AppendElement(Argument("aTexCoord"));
|
||||||
result.mTextureCount = 2;
|
result.mTextureCount = 2;
|
||||||
break;
|
break;
|
||||||
case gl::Copy2DProgramType:
|
case Copy2DProgramType:
|
||||||
NS_ASSERTION(!aMask, "Program does not have masked variant.");
|
NS_ASSERTION(!aMask, "Program does not have masked variant.");
|
||||||
result.mVertexShaderString = sCopyVS;
|
result.mVertexShaderString = sCopyVS;
|
||||||
result.mFragmentShaderString = sCopy2DFS;
|
result.mFragmentShaderString = sCopy2DFS;
|
||||||
|
@ -207,7 +207,7 @@ ProgramProfileOGL::GetProfileFor(gl::ShaderProgramType aType,
|
||||||
result.mAttributes.AppendElement(Argument("aTexCoord"));
|
result.mAttributes.AppendElement(Argument("aTexCoord"));
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case gl::Copy2DRectProgramType:
|
case Copy2DRectProgramType:
|
||||||
NS_ASSERTION(!aMask, "Program does not have masked variant.");
|
NS_ASSERTION(!aMask, "Program does not have masked variant.");
|
||||||
result.mVertexShaderString = sCopyVS;
|
result.mVertexShaderString = sCopyVS;
|
||||||
result.mFragmentShaderString = sCopy2DRectFS;
|
result.mFragmentShaderString = sCopy2DRectFS;
|
||||||
|
|
|
@ -13,11 +13,13 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "GLContextTypes.h"
|
#include "GLContextTypes.h"
|
||||||
|
#include "GLDefs.h"
|
||||||
#include "gfx3DMatrix.h"
|
#include "gfx3DMatrix.h"
|
||||||
#include "mozilla/layers/LayersTypes.h"
|
#include "mozilla/layers/LayersTypes.h"
|
||||||
#include "gfxColor.h"
|
#include "gfxColor.h"
|
||||||
#include "mozilla/gfx/Matrix.h"
|
#include "mozilla/gfx/Matrix.h"
|
||||||
#include "mozilla/RefPtr.h"
|
#include "mozilla/RefPtr.h"
|
||||||
|
#include "gfxASurface.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace gl {
|
namespace gl {
|
||||||
|
@ -27,6 +29,67 @@ namespace layers {
|
||||||
|
|
||||||
class Layer;
|
class Layer;
|
||||||
|
|
||||||
|
enum ShaderProgramType {
|
||||||
|
RGBALayerProgramType,
|
||||||
|
RGBALayerExternalProgramType,
|
||||||
|
BGRALayerProgramType,
|
||||||
|
RGBXLayerProgramType,
|
||||||
|
BGRXLayerProgramType,
|
||||||
|
RGBARectLayerProgramType,
|
||||||
|
RGBAExternalLayerProgramType,
|
||||||
|
ColorLayerProgramType,
|
||||||
|
YCbCrLayerProgramType,
|
||||||
|
ComponentAlphaPass1ProgramType,
|
||||||
|
ComponentAlphaPass2ProgramType,
|
||||||
|
Copy2DProgramType,
|
||||||
|
Copy2DRectProgramType,
|
||||||
|
NumProgramTypes
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline ShaderProgramType
|
||||||
|
ShaderProgramFromSurfaceFormat(gfx::SurfaceFormat aFormat)
|
||||||
|
{
|
||||||
|
switch (aFormat) {
|
||||||
|
case gfx::FORMAT_B8G8R8A8:
|
||||||
|
return BGRALayerProgramType;
|
||||||
|
case gfx::FORMAT_B8G8R8X8:
|
||||||
|
return BGRXLayerProgramType;
|
||||||
|
case gfx::FORMAT_R8G8B8A8:
|
||||||
|
return RGBALayerProgramType;
|
||||||
|
case gfx::FORMAT_R8G8B8X8:
|
||||||
|
case gfx::FORMAT_R5G6B5:
|
||||||
|
return RGBXLayerProgramType;
|
||||||
|
case gfx::FORMAT_A8:
|
||||||
|
// We don't have a specific luminance shader
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
NS_ASSERTION(false, "Unhandled surface format!");
|
||||||
|
}
|
||||||
|
return ShaderProgramType(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ShaderProgramType
|
||||||
|
ShaderProgramFromTargetAndFormat(GLenum aTarget,
|
||||||
|
gfx::SurfaceFormat aFormat)
|
||||||
|
{
|
||||||
|
switch(aTarget) {
|
||||||
|
case LOCAL_GL_TEXTURE_EXTERNAL:
|
||||||
|
return RGBALayerExternalProgramType;
|
||||||
|
case LOCAL_GL_TEXTURE_RECTANGLE_ARB:
|
||||||
|
return RGBARectLayerProgramType;
|
||||||
|
default:
|
||||||
|
return ShaderProgramFromSurfaceFormat(aFormat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ShaderProgramType
|
||||||
|
ShaderProgramFromContentType(gfxASurface::gfxContentType aContentType)
|
||||||
|
{
|
||||||
|
if (aContentType == gfxASurface::CONTENT_COLOR_ALPHA)
|
||||||
|
return RGBALayerProgramType;
|
||||||
|
return RGBXLayerProgramType;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This struct represents the shaders that make up a program and the uniform
|
* This struct represents the shaders that make up a program and the uniform
|
||||||
* and attribute parmeters that those shaders take.
|
* and attribute parmeters that those shaders take.
|
||||||
|
@ -39,16 +102,16 @@ struct ProgramProfileOGL
|
||||||
* Factory method; creates an instance of this class for the given
|
* Factory method; creates an instance of this class for the given
|
||||||
* ShaderProgramType
|
* ShaderProgramType
|
||||||
*/
|
*/
|
||||||
static ProgramProfileOGL GetProfileFor(gl::ShaderProgramType aType,
|
static ProgramProfileOGL GetProfileFor(ShaderProgramType aType,
|
||||||
MaskType aMask);
|
MaskType aMask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true if such a shader program exists
|
* returns true if such a shader program exists
|
||||||
*/
|
*/
|
||||||
static bool ProgramExists(gl::ShaderProgramType aType, MaskType aMask)
|
static bool ProgramExists(ShaderProgramType aType, MaskType aMask)
|
||||||
{
|
{
|
||||||
if (aType < 0 ||
|
if (aType < 0 ||
|
||||||
aType >= gl::NumProgramTypes)
|
aType >= NumProgramTypes)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (aMask < MaskNone ||
|
if (aMask < MaskNone ||
|
||||||
|
@ -56,13 +119,13 @@ struct ProgramProfileOGL
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (aMask == Mask2d &&
|
if (aMask == Mask2d &&
|
||||||
(aType == gl::Copy2DProgramType ||
|
(aType == Copy2DProgramType ||
|
||||||
aType == gl::Copy2DRectProgramType))
|
aType == Copy2DRectProgramType))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return aMask != Mask3d ||
|
return aMask != Mask3d ||
|
||||||
aType == gl::RGBARectLayerProgramType ||
|
aType == RGBARectLayerProgramType ||
|
||||||
aType == gl::RGBALayerProgramType;
|
aType == RGBALayerProgramType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -99,26 +99,6 @@ WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
|
||||||
return LOCAL_GL_CLAMP_TO_EDGE;
|
return LOCAL_GL_CLAMP_TO_EDGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::SurfaceFormat
|
|
||||||
FormatFromShaderType(ShaderProgramType aShaderType)
|
|
||||||
{
|
|
||||||
switch (aShaderType) {
|
|
||||||
case RGBALayerProgramType:
|
|
||||||
case RGBALayerExternalProgramType:
|
|
||||||
case RGBARectLayerProgramType:
|
|
||||||
case RGBAExternalLayerProgramType:
|
|
||||||
return FORMAT_R8G8B8A8;
|
|
||||||
case RGBXLayerProgramType:
|
|
||||||
return FORMAT_R8G8B8X8;
|
|
||||||
case BGRALayerProgramType:
|
|
||||||
return FORMAT_B8G8R8A8;
|
|
||||||
case BGRXLayerProgramType:
|
|
||||||
return FORMAT_B8G8R8X8;
|
|
||||||
default:
|
|
||||||
MOZ_CRASH("Unsupported texture shader type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureImageTextureHostOGL::~TextureImageTextureHostOGL()
|
TextureImageTextureHostOGL::~TextureImageTextureHostOGL()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(TextureImageTextureHostOGL);
|
MOZ_COUNT_DTOR(TextureImageTextureHostOGL);
|
||||||
|
@ -221,7 +201,7 @@ TextureImageTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||||
offset = *aOffset;
|
offset = *aOffset;
|
||||||
}
|
}
|
||||||
mTexture->DirectUpdate(surf.Get(), updateRegion, offset);
|
mTexture->DirectUpdate(surf.Get(), updateRegion, offset);
|
||||||
mFormat = FormatFromShaderType(mTexture->GetShaderProgramType());
|
mFormat = mTexture->GetTextureFormat();
|
||||||
|
|
||||||
if (mTexture->InUpdate()) {
|
if (mTexture->InUpdate()) {
|
||||||
mTexture->EndUpdate();
|
mTexture->EndUpdate();
|
||||||
|
@ -239,7 +219,7 @@ TextureImageTextureHostOGL::Lock()
|
||||||
NS_ASSERTION(mTexture->GetContentType() != gfxASurface::CONTENT_ALPHA,
|
NS_ASSERTION(mTexture->GetContentType() != gfxASurface::CONTENT_ALPHA,
|
||||||
"Image layer has alpha image");
|
"Image layer has alpha image");
|
||||||
|
|
||||||
mFormat = FormatFromShaderType(mTexture->GetShaderProgramType());
|
mFormat = mTexture->GetTextureFormat();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -303,8 +283,7 @@ SharedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||||
GLContext::SharedHandleDetails handleDetails;
|
GLContext::SharedHandleDetails handleDetails;
|
||||||
if (mSharedHandle && mGL->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails)) {
|
if (mSharedHandle && mGL->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails)) {
|
||||||
mTextureTarget = handleDetails.mTarget;
|
mTextureTarget = handleDetails.mTarget;
|
||||||
mShaderProgram = handleDetails.mProgramType;
|
mFormat = handleDetails.mTextureFormat;
|
||||||
mFormat = FormatFromShaderType(mShaderProgram);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,8 +389,8 @@ SurfaceStreamHostOGL::Lock()
|
||||||
glTexSurf->SetConsumerGL(mGL);
|
glTexSurf->SetConsumerGL(mGL);
|
||||||
mTextureHandle = glTexSurf->Texture();
|
mTextureHandle = glTexSurf->Texture();
|
||||||
MOZ_ASSERT(mTextureHandle);
|
MOZ_ASSERT(mTextureHandle);
|
||||||
mShaderProgram = sharedSurf->HasAlpha() ? RGBALayerProgramType
|
mFormat = sharedSurf->HasAlpha() ? FORMAT_R8G8B8A8
|
||||||
: RGBXLayerProgramType;
|
: FORMAT_R8G8B8X8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SharedSurfaceType::EGLImageShare: {
|
case SharedSurfaceType::EGLImageShare: {
|
||||||
|
@ -423,8 +402,8 @@ SurfaceStreamHostOGL::Lock()
|
||||||
toUpload = eglImageSurf->GetPixels();
|
toUpload = eglImageSurf->GetPixels();
|
||||||
MOZ_ASSERT(toUpload);
|
MOZ_ASSERT(toUpload);
|
||||||
} else {
|
} else {
|
||||||
mShaderProgram = sharedSurf->HasAlpha() ? RGBALayerProgramType
|
mFormat = sharedSurf->HasAlpha() ? FORMAT_R8G8B8A8
|
||||||
: RGBXLayerProgramType;
|
: FORMAT_R8G8B8X8;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -442,15 +421,13 @@ SurfaceStreamHostOGL::Lock()
|
||||||
nsIntSize size(toUpload->GetSize());
|
nsIntSize size(toUpload->GetSize());
|
||||||
nsIntRect rect(nsIntPoint(0,0), size);
|
nsIntRect rect(nsIntPoint(0,0), size);
|
||||||
nsIntRegion bounds(rect);
|
nsIntRegion bounds(rect);
|
||||||
mShaderProgram = mGL->UploadSurfaceToTexture(toUpload,
|
mFormat = mGL->UploadSurfaceToTexture(toUpload,
|
||||||
bounds,
|
bounds,
|
||||||
mUploadTexture,
|
mUploadTexture,
|
||||||
true);
|
true);
|
||||||
mTextureHandle = mUploadTexture;
|
mTextureHandle = mUploadTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
mFormat = FormatFromShaderType(mShaderProgram);
|
|
||||||
|
|
||||||
MOZ_ASSERT(mTextureHandle);
|
MOZ_ASSERT(mTextureHandle);
|
||||||
mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, mTextureHandle);
|
mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, mTextureHandle);
|
||||||
mGL->fTexParameteri(LOCAL_GL_TEXTURE_2D,
|
mGL->fTexParameteri(LOCAL_GL_TEXTURE_2D,
|
||||||
|
@ -891,7 +868,7 @@ TextureImageTextureHostOGL::GetAsSurface() {
|
||||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||||
mGL->GetTexImage(mTexture->GetTextureID(),
|
mGL->GetTexImage(mTexture->GetTextureID(),
|
||||||
false,
|
false,
|
||||||
mTexture->GetShaderProgramType())
|
mTexture->GetTextureFormat())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
@ -901,7 +878,7 @@ YCbCrTextureHostOGL::GetAsSurface() {
|
||||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||||
mGL->GetTexImage(mYTexture->mTexImage->GetTextureID(),
|
mGL->GetTexImage(mYTexture->mTexImage->GetTextureID(),
|
||||||
false,
|
false,
|
||||||
mYTexture->mTexImage->GetShaderProgramType())
|
mYTexture->mTexImage->GetTextureFormat())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
@ -911,7 +888,7 @@ SharedTextureHostOGL::GetAsSurface() {
|
||||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||||
mGL->GetTexImage(GetTextureHandle(),
|
mGL->GetTexImage(GetTextureHandle(),
|
||||||
false,
|
false,
|
||||||
GetShaderProgram())
|
GetTextureFormat())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
@ -921,7 +898,7 @@ SurfaceStreamHostOGL::GetAsSurface() {
|
||||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||||
mGL->GetTexImage(mTextureHandle,
|
mGL->GetTexImage(mTextureHandle,
|
||||||
false,
|
false,
|
||||||
GetShaderProgram())
|
GetTextureFormat())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
@ -931,7 +908,7 @@ TiledTextureHostOGL::GetAsSurface() {
|
||||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||||
mGL->GetTexImage(mTextureHandle,
|
mGL->GetTexImage(mTextureHandle,
|
||||||
false,
|
false,
|
||||||
GetShaderProgram())
|
GetTextureFormat())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
@ -952,7 +929,7 @@ GrallocTextureHostOGL::GetAsSurface() {
|
||||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||||
gl()->GetTexImage(tex,
|
gl()->GetTexImage(tex,
|
||||||
false,
|
false,
|
||||||
GetShaderProgram())
|
GetTextureFormat())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef MOZILLA_GFX_TEXTUREOGL_H
|
#ifndef MOZILLA_GFX_TEXTUREOGL_H
|
||||||
#define MOZILLA_GFX_TEXTUREOGL_H
|
#define MOZILLA_GFX_TEXTUREOGL_H
|
||||||
|
@ -49,8 +49,8 @@ public:
|
||||||
virtual void BindTexture(GLenum aTextureUnit) = 0;
|
virtual void BindTexture(GLenum aTextureUnit) = 0;
|
||||||
virtual void ReleaseTexture() = 0;
|
virtual void ReleaseTexture() = 0;
|
||||||
virtual gfx::IntSize GetSize() const = 0;
|
virtual gfx::IntSize GetSize() const = 0;
|
||||||
virtual gl::ShaderProgramType GetShaderProgram() const {
|
virtual gfx::SurfaceFormat GetTextureFormat() const {
|
||||||
MOZ_CRASH("unhandled shader type");
|
MOZ_CRASH("unhandled texture format");
|
||||||
}
|
}
|
||||||
// TODO: Noone's implementing this anymore, should see if we need this.
|
// TODO: Noone's implementing this anymore, should see if we need this.
|
||||||
virtual GLenum GetTextureTarget() const { return LOCAL_GL_TEXTURE_2D; }
|
virtual GLenum GetTextureTarget() const { return LOCAL_GL_TEXTURE_2D; }
|
||||||
|
@ -60,18 +60,18 @@ public:
|
||||||
virtual TextureImageTextureHostOGL* AsTextureImageTextureHost() { return nullptr; }
|
virtual TextureImageTextureHostOGL* AsTextureImageTextureHost() { return nullptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline gl::ShaderProgramType
|
inline ShaderProgramType
|
||||||
GetProgramTypeForTexture(const TextureHost *aTextureHost)
|
GetProgramTypeForTexture(const TextureHost *aTextureHost)
|
||||||
{
|
{
|
||||||
switch (aTextureHost->GetFormat()) {
|
switch (aTextureHost->GetFormat()) {
|
||||||
case gfx::FORMAT_B8G8R8A8:
|
case gfx::FORMAT_B8G8R8A8:
|
||||||
return gl::BGRALayerProgramType;;
|
return BGRALayerProgramType;;
|
||||||
case gfx::FORMAT_B8G8R8X8:
|
case gfx::FORMAT_B8G8R8X8:
|
||||||
return gl::BGRXLayerProgramType;;
|
return BGRXLayerProgramType;;
|
||||||
case gfx::FORMAT_R8G8B8X8:
|
case gfx::FORMAT_R8G8B8X8:
|
||||||
return gl::RGBXLayerProgramType;;
|
return RGBXLayerProgramType;;
|
||||||
case gfx::FORMAT_R8G8B8A8:
|
case gfx::FORMAT_R8G8B8A8:
|
||||||
return gl::RGBALayerProgramType;;
|
return RGBALayerProgramType;;
|
||||||
default:
|
default:
|
||||||
MOZ_CRASH("unhandled program type");
|
MOZ_CRASH("unhandled program type");
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,9 @@ public:
|
||||||
|
|
||||||
gfx::IntSize GetSize() const MOZ_OVERRIDE;
|
gfx::IntSize GetSize() const MOZ_OVERRIDE;
|
||||||
|
|
||||||
gl::ShaderProgramType GetShaderProgram() const MOZ_OVERRIDE
|
gfx::SurfaceFormat GetTextureFormat() const MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
return GetProgramTypeForTexture(this);
|
return GetFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum GetWrapMode() const MOZ_OVERRIDE
|
GLenum GetWrapMode() const MOZ_OVERRIDE
|
||||||
|
@ -368,9 +368,14 @@ public:
|
||||||
virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return mWrapMode; }
|
virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return mWrapMode; }
|
||||||
virtual void SetWrapMode(GLenum aMode) { mWrapMode = aMode; }
|
virtual void SetWrapMode(GLenum aMode) { mWrapMode = aMode; }
|
||||||
|
|
||||||
gl::ShaderProgramType GetShaderProgram() const MOZ_OVERRIDE
|
gfx::SurfaceFormat GetTextureFormat() const MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
return mShaderProgram;
|
return mFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual GLenum GetTextureTarget() const MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
return mTextureTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::IntSize GetSize() const MOZ_OVERRIDE {
|
gfx::IntSize GetSize() const MOZ_OVERRIDE {
|
||||||
|
@ -409,7 +414,6 @@ protected:
|
||||||
GLenum mWrapMode;
|
GLenum mWrapMode;
|
||||||
GLenum mTextureTarget;
|
GLenum mTextureTarget;
|
||||||
gl::SharedTextureHandle mSharedHandle;
|
gl::SharedTextureHandle mSharedHandle;
|
||||||
gl::ShaderProgramType mShaderProgram;
|
|
||||||
gl::GLContext::SharedTextureShareType mShareType;
|
gl::GLContext::SharedTextureShareType mShareType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -451,9 +455,9 @@ public:
|
||||||
mWrapMode = aMode;
|
mWrapMode = aMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl::ShaderProgramType GetShaderProgram() const MOZ_OVERRIDE
|
gfx::SurfaceFormat GetTextureFormat() const MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
return mShaderProgram;
|
return mFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::IntSize GetSize() const MOZ_OVERRIDE {
|
gfx::IntSize GetSize() const MOZ_OVERRIDE {
|
||||||
|
@ -500,7 +504,6 @@ protected:
|
||||||
GLuint mTextureHandle;
|
GLuint mTextureHandle;
|
||||||
GLuint mUploadTexture;
|
GLuint mUploadTexture;
|
||||||
GLenum mWrapMode;
|
GLenum mWrapMode;
|
||||||
gl::ShaderProgramType mShaderProgram;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TiledTextureHostOGL : public TextureHost
|
class TiledTextureHostOGL : public TextureHost
|
||||||
|
@ -534,9 +537,9 @@ public:
|
||||||
return mSize;
|
return mSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl::ShaderProgramType GetShaderProgram() const MOZ_OVERRIDE
|
gfx::SurfaceFormat GetTextureFormat() const MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
return GetProgramTypeForTexture(this);
|
return GetFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
virtual void SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||||
|
@ -599,15 +602,13 @@ public:
|
||||||
return mGraphicBuffer.get() ? gfx::IntSize(mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight()) : gfx::IntSize(0, 0);
|
return mGraphicBuffer.get() ? gfx::IntSize(mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight()) : gfx::IntSize(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gl::ShaderProgramType GetShaderProgram() const MOZ_OVERRIDE
|
gfx::SurfaceFormat GetTextureFormat() const MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
if (mTextureTarget == LOCAL_GL_TEXTURE_EXTERNAL) {
|
if (mTextureTarget == LOCAL_GL_TEXTURE_EXTERNAL) {
|
||||||
return gl::RGBAExternalLayerProgramType;
|
return gfx::FORMAT_R8G8B8A8;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(mTextureTarget == LOCAL_GL_TEXTURE_2D);
|
MOZ_ASSERT(mTextureTarget == LOCAL_GL_TEXTURE_2D);
|
||||||
return mFormat == gfx::FORMAT_B8G8R8A8 || mFormat == gfx::FORMAT_B8G8R8X8
|
return mFormat;
|
||||||
? gl::BGRALayerProgramType
|
|
||||||
: gl::RGBALayerProgramType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum GetWrapMode() const MOZ_OVERRIDE
|
GLenum GetWrapMode() const MOZ_OVERRIDE
|
||||||
|
|
|
@ -134,7 +134,7 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset,
|
||||||
#ifdef MOZ_DUMP_PAINTING
|
#ifdef MOZ_DUMP_PAINTING
|
||||||
if (gfxUtils::sDumpPainting) {
|
if (gfxUtils::sDumpPainting) {
|
||||||
nsRefPtr<gfxImageSurface> surf =
|
nsRefPtr<gfxImageSurface> surf =
|
||||||
gl()->GetTexImage(mTexImage->GetTextureID(), false, mTexImage->GetShaderProgramType());
|
gl()->GetTexImage(mTexImage->GetTextureID(), false, mTexImage->GetTextureFormat());
|
||||||
|
|
||||||
WriteSnapshotToDumpFile(mLayer, surf);
|
WriteSnapshotToDumpFile(mLayer, surf);
|
||||||
}
|
}
|
||||||
|
@ -147,12 +147,12 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset,
|
||||||
if (passes == 2) {
|
if (passes == 2) {
|
||||||
ShaderProgramOGL* alphaProgram;
|
ShaderProgramOGL* alphaProgram;
|
||||||
if (pass == 1) {
|
if (pass == 1) {
|
||||||
alphaProgram = aManager->GetProgram(gl::ComponentAlphaPass1ProgramType,
|
alphaProgram = aManager->GetProgram(ComponentAlphaPass1ProgramType,
|
||||||
mLayer->GetMaskLayer());
|
mLayer->GetMaskLayer());
|
||||||
gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_ONE_MINUS_SRC_COLOR,
|
gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_ONE_MINUS_SRC_COLOR,
|
||||||
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
||||||
} else {
|
} else {
|
||||||
alphaProgram = aManager->GetProgram(gl::ComponentAlphaPass2ProgramType,
|
alphaProgram = aManager->GetProgram(ComponentAlphaPass2ProgramType,
|
||||||
mLayer->GetMaskLayer());
|
mLayer->GetMaskLayer());
|
||||||
gl()->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE,
|
gl()->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE,
|
||||||
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
||||||
|
@ -166,7 +166,7 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset,
|
||||||
// Note BGR: Cairo's image surfaces are always in what
|
// Note BGR: Cairo's image surfaces are always in what
|
||||||
// OpenGL and our shaders consider BGR format.
|
// OpenGL and our shaders consider BGR format.
|
||||||
ShaderProgramOGL* basicProgram =
|
ShaderProgramOGL* basicProgram =
|
||||||
aManager->GetProgram(mTexImage->GetShaderProgramType(),
|
aManager->GetProgram(ShaderProgramFromSurfaceFormat(mTexImage->GetTextureFormat()),
|
||||||
mLayer->GetMaskLayer());
|
mLayer->GetMaskLayer());
|
||||||
|
|
||||||
basicProgram->Activate();
|
basicProgram->Activate();
|
||||||
|
|
|
@ -2015,7 +2015,7 @@ nsChildView::MaybeDrawResizeIndicator(GLManager* aManager, const nsIntRect& aRec
|
||||||
TextureImage::ScopedBindTexture texBind(mResizerImage, LOCAL_GL_TEXTURE0);
|
TextureImage::ScopedBindTexture texBind(mResizerImage, LOCAL_GL_TEXTURE0);
|
||||||
|
|
||||||
ShaderProgramOGL *program =
|
ShaderProgramOGL *program =
|
||||||
aManager->GetProgram(mResizerImage->GetShaderProgramType());
|
aManager->GetProgram(mResizerImage->GetTextureFormat());
|
||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetLayerQuadRect(nsIntRect(bottomX - resizeIndicatorWidth,
|
program->SetLayerQuadRect(nsIntRect(bottomX - resizeIndicatorWidth,
|
||||||
bottomY - resizeIndicatorHeight,
|
bottomY - resizeIndicatorHeight,
|
||||||
|
@ -2217,7 +2217,7 @@ nsChildView::MaybeDrawTitlebar(GLManager* aManager, const nsIntRect& aRect)
|
||||||
TextureImage::ScopedBindTexture texBind(mTitlebarImage, LOCAL_GL_TEXTURE0);
|
TextureImage::ScopedBindTexture texBind(mTitlebarImage, LOCAL_GL_TEXTURE0);
|
||||||
|
|
||||||
ShaderProgramOGL *program =
|
ShaderProgramOGL *program =
|
||||||
aManager->GetProgram(mTitlebarImage->GetShaderProgramType());
|
aManager->GetProgram(mTitlebarImage->GetTextureFormat());
|
||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetLayerQuadRect(nsIntRect(nsIntPoint(0, 0),
|
program->SetLayerQuadRect(nsIntRect(nsIntPoint(0, 0),
|
||||||
mTitlebarImage->GetSize()));
|
mTitlebarImage->GetSize()));
|
||||||
|
@ -2285,7 +2285,7 @@ nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const nsIntRect& aRect
|
||||||
|
|
||||||
TextureImage::ScopedBindTexture texBind(mCornerMaskImage, LOCAL_GL_TEXTURE0);
|
TextureImage::ScopedBindTexture texBind(mCornerMaskImage, LOCAL_GL_TEXTURE0);
|
||||||
|
|
||||||
ShaderProgramOGL *program = aManager->GetProgram(mCornerMaskImage->GetShaderProgramType());
|
ShaderProgramOGL *program = aManager->GetProgram(mCornerMaskImage->GetTextureFormat());
|
||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetLayerQuadRect(nsIntRect(nsIntPoint(0, 0),
|
program->SetLayerQuadRect(nsIntRect(nsIntPoint(0, 0),
|
||||||
mCornerMaskImage->GetSize()));
|
mCornerMaskImage->GetSize()));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче