Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
angle
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
angle
Commits
18b7b5b5
Commit
18b7b5b5
authored
May 17, 2011
by
daniel@transgaming.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve robustness of Context::finish and flush
Trac #16690 Signed-off-by: Nicolas Capens git-svn-id:
https://angleproject.googlecode.com/svn/trunk@652
736b8ea6-26fd-11df-bfd4-992fa37f6226
parent
2b720c92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
47 deletions
+83
-47
version.h
src/common/version.h
+1
-1
Context.cpp
src/libGLESv2/Context.cpp
+82
-46
No files found.
src/common/version.h
View file @
18b7b5b5
#define MAJOR_VERSION 0
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 65
1
#define BUILD_REVISION 65
2
#define STRINGIFY(x) #x
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define MACRO_STRINGIFY(x) STRINGIFY(x)
...
...
src/libGLESv2/Context.cpp
View file @
18b7b5b5
...
@@ -2697,48 +2697,77 @@ void Context::finish()
...
@@ -2697,48 +2697,77 @@ void Context::finish()
egl
::
Display
*
display
=
getDisplay
();
egl
::
Display
*
display
=
getDisplay
();
IDirect3DDevice9
*
device
=
getDevice
();
IDirect3DDevice9
*
device
=
getDevice
();
IDirect3DQuery9
*
occlusionQuery
=
NULL
;
IDirect3DQuery9
*
occlusionQuery
=
NULL
;
HRESULT
result
;
HRESULT
result
=
device
->
CreateQuery
(
D3DQUERYTYPE_OCCLUSION
,
&
occlusionQuery
);
result
=
device
->
CreateQuery
(
D3DQUERYTYPE_OCCLUSION
,
&
occlusionQuery
);
if
(
FAILED
(
result
))
if
(
result
==
D3DERR_OUTOFVIDEOMEMORY
||
result
==
E_OUTOFMEMORY
)
{
{
return
error
(
GL_OUT_OF_MEMORY
);
ERR
(
"CreateQuery failed hr=%x
\n
"
,
result
);
if
(
result
==
D3DERR_OUTOFVIDEOMEMORY
||
result
==
E_OUTOFMEMORY
)
{
return
error
(
GL_OUT_OF_MEMORY
);
}
ASSERT
(
false
);
return
;
}
}
ASSERT
(
SUCCEEDED
(
result
))
;
IDirect3DStateBlock9
*
savedState
=
NULL
;
result
=
device
->
CreateStateBlock
(
D3DSBT_ALL
,
&
savedState
);
if
(
occlusionQuery
)
if
(
FAILED
(
result
)
)
{
{
IDirect3DStateBlock9
*
savedState
=
NULL
;
ERR
(
"CreateStateBlock failed hr=%x
\n
"
,
result
);
device
->
CreateStateBlock
(
D3DSBT_ALL
,
&
savedState
);
occlusionQuery
->
Release
();
HRESULT
result
=
occlusionQuery
->
Issue
(
D3DISSUE_BEGIN
);
ASSERT
(
SUCCEEDED
(
result
));
// Render something outside the render target
device
->
SetPixelShader
(
NULL
);
device
->
SetVertexShader
(
NULL
);
device
->
SetFVF
(
D3DFVF_XYZRHW
);
float
data
[
4
]
=
{
-
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
};
display
->
startScene
();
device
->
DrawPrimitiveUP
(
D3DPT_POINTLIST
,
1
,
data
,
sizeof
(
data
));
result
=
occlusionQuery
->
Issue
(
D3DISSUE_END
);
ASSERT
(
SUCCEEDED
(
result
));
while
(
occlusionQuery
->
GetData
(
NULL
,
0
,
D3DGETDATA_FLUSH
)
==
S_FALSE
)
if
(
result
==
D3DERR_OUTOFVIDEOMEMORY
||
result
==
E_OUTOFMEMORY
)
{
{
// Keep polling, but allow other threads to do something useful first
return
error
(
GL_OUT_OF_MEMORY
);
Sleep
(
0
);
}
}
ASSERT
(
false
);
return
;
}
result
=
occlusionQuery
->
Issue
(
D3DISSUE_BEGIN
);
if
(
FAILED
(
result
))
{
ERR
(
"occlusionQuery->Issue(BEGIN) failed hr=%x
\n
"
,
result
);
occlusionQuery
->
Release
();
occlusionQuery
->
Release
();
savedState
->
Release
();
ASSERT
(
false
);
return
;
}
if
(
savedState
)
// Render something outside the render target
{
device
->
SetPixelShader
(
NULL
);
savedState
->
Apply
();
device
->
SetVertexShader
(
NULL
);
savedState
->
Release
();
device
->
SetFVF
(
D3DFVF_XYZRHW
);
}
float
data
[
4
]
=
{
-
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
};
display
->
startScene
();
device
->
DrawPrimitiveUP
(
D3DPT_POINTLIST
,
1
,
data
,
sizeof
(
data
));
result
=
occlusionQuery
->
Issue
(
D3DISSUE_END
);
if
(
FAILED
(
result
))
{
ERR
(
"occlusionQuery->Issue(END) failed hr=%x
\n
"
,
result
);
occlusionQuery
->
Release
();
savedState
->
Apply
();
savedState
->
Release
();
ASSERT
(
false
);
return
;
}
while
((
result
=
occlusionQuery
->
GetData
(
NULL
,
0
,
D3DGETDATA_FLUSH
))
==
S_FALSE
)
{
// Keep polling, but allow other threads to do something useful first
Sleep
(
0
);
}
occlusionQuery
->
Release
();
savedState
->
Apply
();
savedState
->
Release
();
if
(
result
==
D3DERR_DEVICELOST
)
{
error
(
GL_OUT_OF_MEMORY
);
}
}
}
}
...
@@ -2746,28 +2775,35 @@ void Context::flush()
...
@@ -2746,28 +2775,35 @@ void Context::flush()
{
{
IDirect3DDevice9
*
device
=
getDevice
();
IDirect3DDevice9
*
device
=
getDevice
();
IDirect3DQuery9
*
eventQuery
=
NULL
;
IDirect3DQuery9
*
eventQuery
=
NULL
;
HRESULT
result
;
HRESULT
result
=
device
->
CreateQuery
(
D3DQUERYTYPE_EVENT
,
&
eventQuery
);
result
=
device
->
CreateQuery
(
D3DQUERYTYPE_EVENT
,
&
eventQuery
);
if
(
FAILED
(
result
))
if
(
result
==
D3DERR_OUTOFVIDEOMEMORY
||
result
==
E_OUTOFMEMORY
)
{
{
return
error
(
GL_OUT_OF_MEMORY
);
ERR
(
"CreateQuery failed hr=%x
\n
"
,
result
);
if
(
result
==
D3DERR_OUTOFVIDEOMEMORY
||
result
==
E_OUTOFMEMORY
)
{
return
error
(
GL_OUT_OF_MEMORY
);
}
ASSERT
(
false
);
return
;
}
}
ASSERT
(
SUCCEEDED
(
result
));
result
=
eventQuery
->
Issue
(
D3DISSUE_END
);
if
(
FAILED
(
result
))
if
(
eventQuery
)
{
{
HRESULT
result
=
eventQuery
->
Issue
(
D3DISSUE_END
);
ERR
(
"eventQuery->Issue(END) failed hr=%x
\n
"
,
result
);
ASSERT
(
SUCCEEDED
(
result
));
ASSERT
(
false
);
result
=
eventQuery
->
GetData
(
NULL
,
0
,
D3DGETDATA_FLUSH
);
eventQuery
->
Release
();
eventQuery
->
Release
();
return
;
}
if
(
result
==
D3DERR_DEVICELOST
)
result
=
eventQuery
->
GetData
(
NULL
,
0
,
D3DGETDATA_FLUSH
);
{
eventQuery
->
Release
();
error
(
GL_OUT_OF_MEMORY
);
}
if
(
result
==
D3DERR_DEVICELOST
)
{
error
(
GL_OUT_OF_MEMORY
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment