Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: ui/surface/accelerated_surface_win.cc

Issue 10837015: Use occlusion query to test if blit is finished (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/surface/accelerated_surface_win.cc
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc
index f4e6c9cbee6c14a7adeb0304aebdc46efa372e9d..1dc36d3922df4a518f1a4178ce2d7ac6c4685222 100644
--- a/ui/surface/accelerated_surface_win.cc
+++ b/ui/surface/accelerated_surface_win.cc
@@ -37,6 +37,7 @@ const wchar_t kD3D9ModuleName[] = L"d3d9.dll";
const char kCreate3D9DeviceExName[] = "Direct3DCreate9Ex";
const char kGpuBlitDelay[] = "gpu-blit-delay";
+const char kUseOcclusionQuery[] = "use-occlusion-query";
struct Vertex {
float x, y, z, w;
@@ -120,6 +121,10 @@ UINT GetPresentationInterval() {
return D3DPRESENT_INTERVAL_ONE;
}
+bool UsingOcclusionQuery() {
+ return CommandLine::ForCurrentProcess()->HasSwitch(kUseOcclusionQuery);
+}
+
// Calculate the number necessary to transform |src_subrect| into |dst_size|
// by repeating downsampling of the image of |src_subrect| by a factor no more
// than 2.
@@ -297,10 +302,18 @@ void PresentThread::ResetDevice() {
if (FAILED(hr))
return;
- hr = device_->CreateQuery(D3DQUERYTYPE_EVENT, query_.Receive());
- if (FAILED(hr)) {
- device_ = NULL;
- return;
+ if (UsingOcclusionQuery()) {
+ hr = device_->CreateQuery(D3DQUERYTYPE_OCCLUSION, query_.Receive());
+ if (FAILED(hr)) {
+ device_ = NULL;
+ return;
+ }
+ } else {
+ hr = device_->CreateQuery(D3DQUERYTYPE_EVENT, query_.Receive());
+ if (FAILED(hr)) {
+ device_ = NULL;
+ return;
+ }
}
base::win::ScopedComPtr<IDirect3DVertexShader9> vertex_shader;
@@ -801,6 +814,10 @@ void AcceleratedPresenter::DoPresentAndAcknowledge(
{ halfPixelX - 1, halfPixelY - 1, 0.5f, 1, 0, 0 }
};
+ if (UsingOcclusionQuery()) {
+ present_thread_->query()->Issue(D3DISSUE_BEGIN);
+ }
+
present_thread_->device()->BeginScene();
present_thread_->device()->DrawPrimitiveUP(D3DPT_TRIANGLEFAN,
arraysize(vertices),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698