Bug 1340871 - Add CompositorUseANGLE info to TextureFactoryIdentifier. r=nical
MozReview-Commit-ID: GjlZS6T2i0p
This commit is contained in:
@@ -922,6 +922,7 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
|
||||
WriteParam(aMsg, aParam.mParentBackend);
|
||||
WriteParam(aMsg, aParam.mParentProcessType);
|
||||
WriteParam(aMsg, aParam.mMaxTextureSize);
|
||||
WriteParam(aMsg, aParam.mCompositorUseANGLE);
|
||||
WriteParam(aMsg, aParam.mSupportsTextureBlitting);
|
||||
WriteParam(aMsg, aParam.mSupportsPartialUploads);
|
||||
WriteParam(aMsg, aParam.mSupportsComponentAlpha);
|
||||
@@ -933,6 +934,7 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
|
||||
bool result = ReadParam(aMsg, aIter, &aResult->mParentBackend) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mParentProcessType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCompositorUseANGLE) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsComponentAlpha) &&
|
||||
|
||||
@@ -168,6 +168,7 @@ struct TextureFactoryIdentifier
|
||||
LayersBackend mParentBackend;
|
||||
GeckoProcessType mParentProcessType;
|
||||
int32_t mMaxTextureSize;
|
||||
bool mCompositorUseANGLE;
|
||||
bool mSupportsTextureBlitting;
|
||||
bool mSupportsPartialUploads;
|
||||
bool mSupportsComponentAlpha;
|
||||
@@ -176,6 +177,7 @@ struct TextureFactoryIdentifier
|
||||
explicit TextureFactoryIdentifier(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE,
|
||||
GeckoProcessType aParentProcessType = GeckoProcessType_Default,
|
||||
int32_t aMaxTextureSize = 4096,
|
||||
bool aCompositorUseANGLE = false,
|
||||
bool aSupportsTextureBlitting = false,
|
||||
bool aSupportsPartialUploads = false,
|
||||
bool aSupportsComponentAlpha = true,
|
||||
@@ -183,6 +185,7 @@ struct TextureFactoryIdentifier
|
||||
: mParentBackend(aLayersBackend)
|
||||
, mParentProcessType(aParentProcessType)
|
||||
, mMaxTextureSize(aMaxTextureSize)
|
||||
, mCompositorUseANGLE(aCompositorUseANGLE)
|
||||
, mSupportsTextureBlitting(aSupportsTextureBlitting)
|
||||
, mSupportsPartialUploads(aSupportsPartialUploads)
|
||||
, mSupportsComponentAlpha(aSupportsComponentAlpha)
|
||||
|
||||
@@ -62,6 +62,11 @@ public:
|
||||
return mTextureFactoryIdentifier.mSupportsComponentAlpha;
|
||||
}
|
||||
|
||||
bool GetCompositorUseANGLE() const
|
||||
{
|
||||
return mTextureFactoryIdentifier.mCompositorUseANGLE;
|
||||
}
|
||||
|
||||
const TextureFactoryIdentifier& GetTextureFactoryIdentifier() const
|
||||
{
|
||||
return mTextureFactoryIdentifier;
|
||||
|
||||
@@ -141,6 +141,7 @@ public:
|
||||
TextureFactoryIdentifier(LayersBackend::LAYERS_OPENGL,
|
||||
XRE_GetProcessType(),
|
||||
GetMaxTextureSize(),
|
||||
false,
|
||||
mFBOTextureTarget == LOCAL_GL_TEXTURE_2D,
|
||||
SupportsPartialTextureUpdate());
|
||||
return result;
|
||||
|
||||
@@ -696,7 +696,8 @@ WebRenderBridgeParent::GetTextureFactoryIdentifier()
|
||||
|
||||
return TextureFactoryIdentifier(LayersBackend::LAYERS_WR,
|
||||
XRE_GetProcessType(),
|
||||
mApi->GetMaxTextureSize());
|
||||
mApi->GetMaxTextureSize(),
|
||||
mApi->GetUseANGLE());
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
|
||||
@@ -18,11 +18,13 @@ class NewRenderer : public RendererEvent
|
||||
public:
|
||||
NewRenderer(WrAPI** aApi, layers::CompositorBridgeParentBase* aBridge,
|
||||
GLint* aMaxTextureSize,
|
||||
bool* aUseANGLE,
|
||||
RefPtr<widget::CompositorWidget>&& aWidget,
|
||||
layers::SynchronousTask* aTask,
|
||||
bool aEnableProfiler)
|
||||
: mWrApi(aApi)
|
||||
, mMaxTextureSize(aMaxTextureSize)
|
||||
, mUseANGLE(aUseANGLE)
|
||||
, mBridge(aBridge)
|
||||
, mCompositorWidget(Move(aWidget))
|
||||
, mTask(aTask)
|
||||
@@ -46,6 +48,7 @@ public:
|
||||
}
|
||||
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, mMaxTextureSize);
|
||||
*mUseANGLE = gl->IsANGLE();
|
||||
|
||||
WrRenderer* wrRenderer = nullptr;
|
||||
if (!wr_window_new(aWindowId, gl.get(), this->mEnableProfiler, nullptr, mWrApi, &wrRenderer)) {
|
||||
@@ -67,6 +70,7 @@ public:
|
||||
private:
|
||||
WrAPI** mWrApi;
|
||||
GLint* mMaxTextureSize;
|
||||
bool* mUseANGLE;
|
||||
layers::CompositorBridgeParentBase* mBridge;
|
||||
RefPtr<widget::CompositorWidget> mCompositorWidget;
|
||||
layers::SynchronousTask* mTask;
|
||||
@@ -112,12 +116,13 @@ WebRenderAPI::Create(bool aEnableProfiler,
|
||||
|
||||
WrAPI* wrApi = nullptr;
|
||||
GLint maxTextureSize = 0;
|
||||
bool useANGLE = false;
|
||||
|
||||
// Dispatch a synchronous task because the WrApi object needs to be created
|
||||
// on the render thread. If need be we could delay waiting on this task until
|
||||
// the next time we need to access the WrApi object.
|
||||
layers::SynchronousTask task("Create Renderer");
|
||||
auto event = MakeUnique<NewRenderer>(&wrApi, aBridge, &maxTextureSize,
|
||||
auto event = MakeUnique<NewRenderer>(&wrApi, aBridge, &maxTextureSize, &useANGLE,
|
||||
Move(aWidget), &task, aEnableProfiler);
|
||||
RenderThread::Get()->RunEvent(id, Move(event));
|
||||
|
||||
@@ -127,7 +132,7 @@ WebRenderAPI::Create(bool aEnableProfiler,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return RefPtr<WebRenderAPI>(new WebRenderAPI(wrApi, id, maxTextureSize)).forget();
|
||||
return RefPtr<WebRenderAPI>(new WebRenderAPI(wrApi, id, maxTextureSize, useANGLE)).forget();
|
||||
}
|
||||
|
||||
WebRenderAPI::~WebRenderAPI()
|
||||
|
||||
@@ -71,12 +71,14 @@ public:
|
||||
void Readback(gfx::IntSize aSize, uint8_t *aBuffer, uint32_t aBufferSize);
|
||||
|
||||
GLint GetMaxTextureSize() const { return mMaxTextureSize; }
|
||||
bool GetUseANGLE() const { return mUseANGLE; }
|
||||
|
||||
protected:
|
||||
WebRenderAPI(WrAPI* aRawApi, wr::WindowId aId, GLint aMaxTextureSize)
|
||||
WebRenderAPI(WrAPI* aRawApi, wr::WindowId aId, GLint aMaxTextureSize, bool aUseANGLE)
|
||||
: mWrApi(aRawApi)
|
||||
, mId(aId)
|
||||
, mMaxTextureSize(aMaxTextureSize)
|
||||
, mUseANGLE(aUseANGLE)
|
||||
{}
|
||||
|
||||
~WebRenderAPI();
|
||||
@@ -84,6 +86,7 @@ protected:
|
||||
WrAPI* mWrApi;
|
||||
wr::WindowId mId;
|
||||
GLint mMaxTextureSize;
|
||||
bool mUseANGLE;
|
||||
|
||||
friend class DisplayListBuilder;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user