Bug 1352092 - Get the max texture size from WR. r=nical

The gecko side just queries the max texture size from gl context[1]. We
should query that size from WR.

[1]
https://dxr.mozilla.org/mozilla-central/rev/4c5fbf49376351679dcc49f4cff26c3c2e055ccc/gfx/webrender_bindings/WebRenderAPI.cpp#72

MozReview-Commit-ID: 6RQ8ZW9mWSE
This commit is contained in:
JerryShih 2017-08-12 13:41:56 +08:00
Родитель b77ceb27cd
Коммит 7b702f3d00
4 изменённых файлов: 51 добавлений и 47 удалений

Просмотреть файл

@ -24,7 +24,7 @@ class NewRenderer : public RendererEvent
{
public:
NewRenderer(wr::DocumentHandle** aDocHandle, layers::CompositorBridgeParentBase* aBridge,
GLint* aMaxTextureSize,
uint32_t* aMaxTextureSize,
bool* aUseANGLE,
RefPtr<widget::CompositorWidget>&& aWidget,
layers::SynchronousTask* aTask,
@ -69,13 +69,13 @@ public:
return;
}
gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, mMaxTextureSize);
*mUseANGLE = gl->IsANGLE();
wr::Renderer* wrRenderer = nullptr;
if (!wr_window_new(aWindowId, mSize.width, mSize.height, gl.get(),
aRenderThread.ThreadPool().Raw(),
this->mEnableProfiler, mDocHandle, &wrRenderer)) {
this->mEnableProfiler, mDocHandle, &wrRenderer,
mMaxTextureSize)) {
// wr_window_new puts a message into gfxCriticalNote if it returns false
return;
}
@ -105,7 +105,7 @@ public:
private:
wr::DocumentHandle** mDocHandle;
GLint* mMaxTextureSize;
uint32_t* mMaxTextureSize;
bool* mUseANGLE;
layers::CompositorBridgeParentBase* mBridge;
RefPtr<widget::CompositorWidget> mCompositorWidget;
@ -154,7 +154,7 @@ WebRenderAPI::Create(bool aEnableProfiler,
auto id = NewWindowId(sNextId++);
wr::DocumentHandle* docHandle = nullptr;
GLint maxTextureSize = 0;
uint32_t maxTextureSize = 0;
bool useANGLE = false;
layers::SyncHandle syncHandle = 0;

Просмотреть файл

@ -123,12 +123,12 @@ public:
bool Resume();
wr::WrIdNamespace GetNamespace();
GLint GetMaxTextureSize() const { return mMaxTextureSize; }
uint32_t GetMaxTextureSize() const { return mMaxTextureSize; }
bool GetUseANGLE() const { return mUseANGLE; }
layers::SyncHandle GetSyncHandle() const { return mSyncHandle; }
protected:
WebRenderAPI(wr::DocumentHandle* aHandle, wr::WindowId aId, GLint aMaxTextureSize, bool aUseANGLE, layers::SyncHandle aSyncHandle)
WebRenderAPI(wr::DocumentHandle* aHandle, wr::WindowId aId, uint32_t aMaxTextureSize, bool aUseANGLE, layers::SyncHandle aSyncHandle)
: mDocHandle(aHandle)
, mId(aId)
, mMaxTextureSize(aMaxTextureSize)
@ -142,7 +142,7 @@ protected:
wr::DocumentHandle* mDocHandle;
wr::WindowId mId;
GLint mMaxTextureSize;
uint32_t mMaxTextureSize;
bool mUseANGLE;
layers::SyncHandle mSyncHandle;
RefPtr<wr::WebRenderAPI> mRootApi;

Просмотреть файл

@ -552,7 +552,8 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
thread_pool: *mut WrThreadPool,
enable_profiler: bool,
out_handle: &mut *mut DocumentHandle,
out_renderer: &mut *mut Renderer)
out_renderer: &mut *mut Renderer,
out_max_texture_size: *mut u32)
-> bool {
assert!(unsafe { is_in_render_thread() });
@ -608,7 +609,9 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
renderer.set_render_notifier(Box::new(CppNotifier {
window_id: window_id,
}));
unsafe {
*out_max_texture_size = renderer.get_max_texture_size();
}
let window_size = DeviceUintSize::new(window_width, window_height);
*out_handle = Box::into_raw(Box::new(
DocumentHandle::new(sender.create_api(), window_size)));

Просмотреть файл

@ -406,6 +406,42 @@ typedef TypedRect_f32__LayerPixel LayerRect;
typedef LayerRect LayoutRect;
struct BorderRadius {
LayoutSize top_left;
LayoutSize top_right;
LayoutSize bottom_left;
LayoutSize bottom_right;
bool operator==(const BorderRadius& aOther) const {
return top_left == aOther.top_left &&
top_right == aOther.top_right &&
bottom_left == aOther.bottom_left &&
bottom_right == aOther.bottom_right;
}
};
struct WrComplexClipRegion {
LayoutRect rect;
BorderRadius radii;
bool operator==(const WrComplexClipRegion& aOther) const {
return rect == aOther.rect &&
radii == aOther.radii;
}
};
struct WrImageMask {
WrImageKey image;
LayoutRect rect;
bool repeat;
bool operator==(const WrImageMask& aOther) const {
return image == aOther.image &&
rect == aOther.rect &&
repeat == aOther.repeat;
}
};
struct BorderWidths {
float left;
float top;
@ -430,20 +466,6 @@ struct BorderSide {
}
};
struct BorderRadius {
LayoutSize top_left;
LayoutSize top_right;
LayoutSize bottom_left;
LayoutSize bottom_right;
bool operator==(const BorderRadius& aOther) const {
return top_left == aOther.top_left &&
top_right == aOther.top_right &&
bottom_left == aOther.bottom_left &&
bottom_right == aOther.bottom_right;
}
};
typedef TypedPoint2D_f32__LayerPixel LayerPoint;
typedef LayerPoint LayoutPoint;
@ -512,28 +534,6 @@ typedef TypedVector2D_f32__LayerPixel LayerVector2D;
typedef LayerVector2D LayoutVector2D;
struct WrComplexClipRegion {
LayoutRect rect;
BorderRadius radii;
bool operator==(const WrComplexClipRegion& aOther) const {
return rect == aOther.rect &&
radii == aOther.radii;
}
};
struct WrImageMask {
WrImageKey image;
LayoutRect rect;
bool repeat;
bool operator==(const WrImageMask& aOther) const {
return image == aOther.image &&
rect == aOther.rect &&
repeat == aOther.repeat;
}
};
struct WrFilterOp {
WrFilterOpType filter_type;
float argument;
@ -1077,7 +1077,8 @@ bool wr_window_new(WrWindowId aWindowId,
WrThreadPool *aThreadPool,
bool aEnableProfiler,
DocumentHandle **aOutHandle,
Renderer **aOutRenderer)
Renderer **aOutRenderer,
uint32_t *aOutMaxTextureSize)
WR_FUNC;
} // namespace wr