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
721b7f26
Commit
721b7f26
authored
Feb 11, 2011
by
vladimirv@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue=91 -- implement pbuffers in ANGLE; add D3D share handle support
git-svn-id:
https://angleproject.googlecode.com/svn/trunk@558
736b8ea6-26fd-11df-bfd4-992fa37f6226
parent
9e83b593
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
232 additions
and
28 deletions
+232
-28
eglext.h
include/EGL/eglext.h
+13
-0
Config.cpp
src/libEGL/Config.cpp
+11
-8
Config.h
src/libEGL/Config.h
+3
-3
Display.cpp
src/libEGL/Display.cpp
+39
-3
Display.h
src/libEGL/Display.h
+7
-0
Surface.cpp
src/libEGL/Surface.cpp
+57
-6
Surface.h
src/libEGL/Surface.h
+6
-0
libEGL.cpp
src/libEGL/libEGL.cpp
+95
-8
main.h
src/libEGL/main.h
+1
-0
No files found.
include/EGL/eglext.h
View file @
721b7f26
...
@@ -215,6 +215,19 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenu
...
@@ -215,6 +215,19 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenu
typedef
EGLBoolean
(
EGLAPIENTRYP
PFNEGLGETSYNCATTRIBNVPROC
)
(
EGLSyncNV
sync
,
EGLint
attribute
,
EGLint
*
value
);
typedef
EGLBoolean
(
EGLAPIENTRYP
PFNEGLGETSYNCATTRIBNVPROC
)
(
EGLSyncNV
sync
,
EGLint
attribute
,
EGLint
*
value
);
#endif
#endif
#ifndef EGL_ANGLE_query_surface_pointer
#define EGL_ANGLE_query_surface_pointer 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI
EGLBoolean
eglQuerySurfacePointerANGLE
(
EGLDisplay
dpy
,
EGLSurface
surface
,
EGLint
attribute
,
void
**
value
);
#endif
typedef
EGLBoolean
(
EGLAPIENTRYP
PFNEGLQUERYSURFACEPOINTERANGLEPROC
)
(
EGLDisplay
dpy
,
EGLSurface
surface
,
EGLint
attribute
,
void
**
value
);
#endif
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
#endif
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
src/libEGL/Config.cpp
View file @
721b7f26
...
@@ -19,10 +19,10 @@ using namespace std;
...
@@ -19,10 +19,10 @@ using namespace std;
namespace
egl
namespace
egl
{
{
Config
::
Config
(
D3DDISPLAYMODE
displayMode
,
EGLint
minInterval
,
EGLint
maxInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
)
Config
::
Config
(
D3DDISPLAYMODE
displayMode
,
EGLint
minInterval
,
EGLint
maxInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
,
EGLint
texWidth
,
EGLint
texHeight
)
:
mDisplayMode
(
displayMode
),
mRenderTargetFormat
(
renderTargetFormat
),
mDepthStencilFormat
(
depthStencilFormat
),
mMultiSample
(
multiSample
)
:
mDisplayMode
(
displayMode
),
mRenderTargetFormat
(
renderTargetFormat
),
mDepthStencilFormat
(
depthStencilFormat
),
mMultiSample
(
multiSample
)
{
{
set
(
displayMode
,
minInterval
,
maxInterval
,
renderTargetFormat
,
depthStencilFormat
,
multiSample
);
set
(
displayMode
,
minInterval
,
maxInterval
,
renderTargetFormat
,
depthStencilFormat
,
multiSample
,
texWidth
,
texHeight
);
}
}
void
Config
::
setDefaults
()
void
Config
::
setDefaults
()
...
@@ -62,7 +62,7 @@ void Config::setDefaults()
...
@@ -62,7 +62,7 @@ void Config::setDefaults()
mTransparentBlueValue
=
EGL_DONT_CARE
;
mTransparentBlueValue
=
EGL_DONT_CARE
;
}
}
void
Config
::
set
(
D3DDISPLAYMODE
displayMode
,
EGLint
minInterval
,
EGLint
maxInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
)
void
Config
::
set
(
D3DDISPLAYMODE
displayMode
,
EGLint
minInterval
,
EGLint
maxInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
,
EGLint
texWidth
,
EGLint
texHeight
)
{
{
switch
(
renderTargetFormat
)
switch
(
renderTargetFormat
)
{
{
...
@@ -158,9 +158,9 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter
...
@@ -158,9 +158,9 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter
mLevel
=
0
;
mLevel
=
0
;
mMatchNativePixmap
=
EGL_NONE
;
mMatchNativePixmap
=
EGL_NONE
;
mMaxPBufferWidth
=
0
;
mMaxPBufferWidth
=
texWidth
;
mMaxPBufferHeight
=
0
;
mMaxPBufferHeight
=
texHeight
;
mMaxPBufferPixels
=
0
;
mMaxPBufferPixels
=
texWidth
*
texHeight
;
mMaxSwapInterval
=
maxInterval
;
mMaxSwapInterval
=
maxInterval
;
mMinSwapInterval
=
minInterval
;
mMinSwapInterval
=
minInterval
;
mNativeRenderable
=
EGL_FALSE
;
mNativeRenderable
=
EGL_FALSE
;
...
@@ -282,9 +282,9 @@ ConfigSet::ConfigSet()
...
@@ -282,9 +282,9 @@ ConfigSet::ConfigSet()
{
{
}
}
void
ConfigSet
::
add
(
D3DDISPLAYMODE
displayMode
,
EGLint
minSwapInterval
,
EGLint
maxSwapInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
)
void
ConfigSet
::
add
(
D3DDISPLAYMODE
displayMode
,
EGLint
minSwapInterval
,
EGLint
maxSwapInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
,
EGLint
texWidth
,
EGLint
texHeight
)
{
{
Config
config
(
displayMode
,
minSwapInterval
,
maxSwapInterval
,
renderTargetFormat
,
depthStencilFormat
,
multiSample
);
Config
config
(
displayMode
,
minSwapInterval
,
maxSwapInterval
,
renderTargetFormat
,
depthStencilFormat
,
multiSample
,
texWidth
,
texHeight
);
mSet
.
insert
(
config
);
mSet
.
insert
(
config
);
}
}
...
@@ -337,6 +337,9 @@ bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint
...
@@ -337,6 +337,9 @@ bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint
case
EGL_RENDERABLE_TYPE
:
match
=
(
config
->
mRenderableType
&
attribute
[
1
])
==
attribute
[
1
];
break
;
case
EGL_RENDERABLE_TYPE
:
match
=
(
config
->
mRenderableType
&
attribute
[
1
])
==
attribute
[
1
];
break
;
case
EGL_MATCH_NATIVE_PIXMAP
:
match
=
false
;
UNIMPLEMENTED
();
break
;
case
EGL_MATCH_NATIVE_PIXMAP
:
match
=
false
;
UNIMPLEMENTED
();
break
;
case
EGL_CONFORMANT
:
match
=
(
config
->
mConformant
&
attribute
[
1
])
==
attribute
[
1
];
break
;
case
EGL_CONFORMANT
:
match
=
(
config
->
mConformant
&
attribute
[
1
])
==
attribute
[
1
];
break
;
case
EGL_MAX_PBUFFER_WIDTH
:
match
=
config
->
mMaxPBufferWidth
>=
attribute
[
1
];
break
;
case
EGL_MAX_PBUFFER_HEIGHT
:
match
=
config
->
mMaxPBufferHeight
>=
attribute
[
1
];
break
;
case
EGL_MAX_PBUFFER_PIXELS
:
match
=
config
->
mMaxPBufferPixels
>=
attribute
[
1
];
break
;
default
:
default
:
return
false
;
return
false
;
}
}
...
...
src/libEGL/Config.h
View file @
721b7f26
...
@@ -26,10 +26,10 @@ class Display;
...
@@ -26,10 +26,10 @@ class Display;
class
Config
class
Config
{
{
public
:
public
:
Config
(
D3DDISPLAYMODE
displayMode
,
EGLint
minSwapInterval
,
EGLint
maxSwapInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
);
Config
(
D3DDISPLAYMODE
displayMode
,
EGLint
minSwapInterval
,
EGLint
maxSwapInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
,
EGLint
texWidth
,
EGLint
texHeight
);
void
setDefaults
();
void
setDefaults
();
void
set
(
D3DDISPLAYMODE
displayMode
,
EGLint
minSwapInterval
,
EGLint
maxSwapInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
);
void
set
(
D3DDISPLAYMODE
displayMode
,
EGLint
minSwapInterval
,
EGLint
maxSwapInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
,
EGLint
texWidth
,
EGLint
texHeight
);
EGLConfig
getHandle
()
const
;
EGLConfig
getHandle
()
const
;
const
D3DDISPLAYMODE
mDisplayMode
;
const
D3DDISPLAYMODE
mDisplayMode
;
...
@@ -99,7 +99,7 @@ class ConfigSet
...
@@ -99,7 +99,7 @@ class ConfigSet
public
:
public
:
ConfigSet
();
ConfigSet
();
void
add
(
D3DDISPLAYMODE
displayMode
,
EGLint
minSwapInterval
,
EGLint
maxSwapInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
);
void
add
(
D3DDISPLAYMODE
displayMode
,
EGLint
minSwapInterval
,
EGLint
maxSwapInterval
,
D3DFORMAT
renderTargetFormat
,
D3DFORMAT
depthStencilFormat
,
EGLint
multiSample
,
EGLint
texWidth
,
EGLint
texHeight
);
size_t
size
()
const
;
size_t
size
()
const
;
bool
getConfigs
(
EGLConfig
*
configs
,
const
EGLint
*
attribList
,
EGLint
configSize
,
EGLint
*
numConfig
);
bool
getConfigs
(
EGLConfig
*
configs
,
const
EGLint
*
attribList
,
EGLint
configSize
,
EGLint
*
numConfig
);
const
egl
::
Config
*
get
(
EGLConfig
configHandle
);
const
egl
::
Config
*
get
(
EGLConfig
configHandle
);
...
...
src/libEGL/Display.cpp
View file @
721b7f26
...
@@ -181,7 +181,8 @@ bool Display::initialize()
...
@@ -181,7 +181,8 @@ bool Display::initialize()
{
{
// FIXME: enumerate multi-sampling
// FIXME: enumerate multi-sampling
configSet
.
add
(
currentDisplayMode
,
mMinSwapInterval
,
mMaxSwapInterval
,
renderTargetFormat
,
depthStencilFormat
,
0
);
configSet
.
add
(
currentDisplayMode
,
mMinSwapInterval
,
mMaxSwapInterval
,
renderTargetFormat
,
depthStencilFormat
,
0
,
mDeviceCaps
.
MaxTextureWidth
,
mDeviceCaps
.
MaxTextureHeight
);
}
}
}
}
}
}
...
@@ -207,6 +208,8 @@ bool Display::initialize()
...
@@ -207,6 +208,8 @@ bool Display::initialize()
return
false
;
return
false
;
}
}
initExtensionString
();
static
const
TCHAR
windowName
[]
=
TEXT
(
"AngleHiddenWindow"
);
static
const
TCHAR
windowName
[]
=
TEXT
(
"AngleHiddenWindow"
);
static
const
TCHAR
className
[]
=
TEXT
(
"STATIC"
);
static
const
TCHAR
className
[]
=
TEXT
(
"STATIC"
);
...
@@ -329,6 +332,9 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
...
@@ -329,6 +332,9 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
case
EGL_RENDERABLE_TYPE
:
*
value
=
configuration
->
mRenderableType
;
break
;
case
EGL_RENDERABLE_TYPE
:
*
value
=
configuration
->
mRenderableType
;
break
;
case
EGL_MATCH_NATIVE_PIXMAP
:
*
value
=
false
;
UNIMPLEMENTED
();
break
;
case
EGL_MATCH_NATIVE_PIXMAP
:
*
value
=
false
;
UNIMPLEMENTED
();
break
;
case
EGL_CONFORMANT
:
*
value
=
configuration
->
mConformant
;
break
;
case
EGL_CONFORMANT
:
*
value
=
configuration
->
mConformant
;
break
;
case
EGL_MAX_PBUFFER_WIDTH
:
*
value
=
configuration
->
mMaxPBufferWidth
;
break
;
case
EGL_MAX_PBUFFER_HEIGHT
:
*
value
=
configuration
->
mMaxPBufferHeight
;
break
;
case
EGL_MAX_PBUFFER_PIXELS
:
*
value
=
configuration
->
mMaxPBufferPixels
;
break
;
default
:
default
:
return
false
;
return
false
;
}
}
...
@@ -406,6 +412,16 @@ Surface *Display::createWindowSurface(HWND window, EGLConfig config)
...
@@ -406,6 +412,16 @@ Surface *Display::createWindowSurface(HWND window, EGLConfig config)
return
surface
;
return
surface
;
}
}
Surface
*
Display
::
createOffscreenSurface
(
int
width
,
int
height
,
EGLConfig
config
)
{
const
Config
*
configuration
=
mConfigSet
.
get
(
config
);
Surface
*
surface
=
new
Surface
(
this
,
configuration
,
width
,
height
);
mSurfaceSet
.
insert
(
surface
);
return
surface
;
}
EGLContext
Display
::
createContext
(
EGLConfig
configHandle
,
const
gl
::
Context
*
shareContext
)
EGLContext
Display
::
createContext
(
EGLConfig
configHandle
,
const
gl
::
Context
*
shareContext
)
{
{
if
(
!
mDevice
)
if
(
!
mDevice
)
...
@@ -671,4 +687,25 @@ D3DPRESENT_PARAMETERS Display::getDefaultPresentParameters()
...
@@ -671,4 +687,25 @@ D3DPRESENT_PARAMETERS Display::getDefaultPresentParameters()
return
presentParameters
;
return
presentParameters
;
}
}
}
\ No newline at end of file
void
Display
::
initExtensionString
()
{
mExtensionString
+=
"EGL_ANGLE_query_surface_pointer "
;
if
(
isD3d9ExDevice
())
{
mExtensionString
+=
"EGL_ANGLE_surface_d3d_texture_2d_share_handle "
;
}
std
::
string
::
size_type
end
=
mExtensionString
.
find_last_not_of
(
' '
);
if
(
end
!=
std
::
string
::
npos
)
{
mExtensionString
.
resize
(
end
+
1
);
}
}
const
char
*
Display
::
getExtensionString
()
const
{
return
mExtensionString
.
c_str
();
}
}
src/libEGL/Display.h
View file @
721b7f26
...
@@ -43,6 +43,7 @@ class Display
...
@@ -43,6 +43,7 @@ class Display
bool
getConfigAttrib
(
EGLConfig
config
,
EGLint
attribute
,
EGLint
*
value
);
bool
getConfigAttrib
(
EGLConfig
config
,
EGLint
attribute
,
EGLint
*
value
);
egl
::
Surface
*
createWindowSurface
(
HWND
window
,
EGLConfig
config
);
egl
::
Surface
*
createWindowSurface
(
HWND
window
,
EGLConfig
config
);
egl
::
Surface
*
createOffscreenSurface
(
int
width
,
int
height
,
EGLConfig
config
);
EGLContext
createContext
(
EGLConfig
configHandle
,
const
gl
::
Context
*
shareContext
);
EGLContext
createContext
(
EGLConfig
configHandle
,
const
gl
::
Context
*
shareContext
);
void
destroySurface
(
egl
::
Surface
*
surface
);
void
destroySurface
(
egl
::
Surface
*
surface
);
...
@@ -69,6 +70,9 @@ class Display
...
@@ -69,6 +70,9 @@ class Display
virtual
bool
getLuminanceAlphaTextureSupport
();
virtual
bool
getLuminanceAlphaTextureSupport
();
virtual
D3DPOOL
getBufferPool
(
DWORD
usage
)
const
;
virtual
D3DPOOL
getBufferPool
(
DWORD
usage
)
const
;
bool
isD3d9ExDevice
()
{
return
mD3d9Ex
!=
NULL
;
}
const
char
*
getExtensionString
()
const
;
private
:
private
:
DISALLOW_COPY_AND_ASSIGN
(
Display
);
DISALLOW_COPY_AND_ASSIGN
(
Display
);
...
@@ -101,6 +105,9 @@ class Display
...
@@ -101,6 +105,9 @@ class Display
bool
createDevice
();
bool
createDevice
();
bool
resetDevice
();
bool
resetDevice
();
void
initExtensionString
();
std
::
string
mExtensionString
;
};
};
}
}
...
...
src/libEGL/Surface.cpp
View file @
721b7f26
...
@@ -25,6 +25,8 @@ Surface::Surface(Display *display, const Config *config, HWND window)
...
@@ -25,6 +25,8 @@ Surface::Surface(Display *display, const Config *config, HWND window)
mSwapChain
=
NULL
;
mSwapChain
=
NULL
;
mDepthStencil
=
NULL
;
mDepthStencil
=
NULL
;
mRenderTarget
=
NULL
;
mRenderTarget
=
NULL
;
mOffscreenTexture
=
NULL
;
mShareHandle
=
NULL
;
mPixelAspectRatio
=
(
EGLint
)(
1.0
*
EGL_DISPLAY_SCALING
);
// FIXME: Determine actual pixel aspect ratio
mPixelAspectRatio
=
(
EGLint
)(
1.0
*
EGL_DISPLAY_SCALING
);
// FIXME: Determine actual pixel aspect ratio
mRenderBuffer
=
EGL_BACK_BUFFER
;
mRenderBuffer
=
EGL_BACK_BUFFER
;
...
@@ -36,6 +38,25 @@ Surface::Surface(Display *display, const Config *config, HWND window)
...
@@ -36,6 +38,25 @@ Surface::Surface(Display *display, const Config *config, HWND window)
resetSwapChain
();
resetSwapChain
();
}
}
Surface
::
Surface
(
Display
*
display
,
const
Config
*
config
,
EGLint
width
,
EGLint
height
)
:
mDisplay
(
display
),
mWindow
(
NULL
),
mConfig
(
config
),
mWidth
(
width
),
mHeight
(
height
)
{
mSwapChain
=
NULL
;
mDepthStencil
=
NULL
;
mRenderTarget
=
NULL
;
mOffscreenTexture
=
NULL
;
mShareHandle
=
NULL
;
mWindowSubclassed
=
false
;
mPixelAspectRatio
=
(
EGLint
)(
1.0
*
EGL_DISPLAY_SCALING
);
// FIXME: Determine actual pixel aspect ratio
mRenderBuffer
=
EGL_BACK_BUFFER
;
mSwapBehavior
=
EGL_BUFFER_PRESERVED
;
mSwapInterval
=
-
1
;
setSwapInterval
(
1
);
resetSwapChain
(
width
,
height
);
}
Surface
::~
Surface
()
Surface
::~
Surface
()
{
{
unsubclassWindow
();
unsubclassWindow
();
...
@@ -61,10 +82,21 @@ void Surface::release()
...
@@ -61,10 +82,21 @@ void Surface::release()
mRenderTarget
->
Release
();
mRenderTarget
->
Release
();
mRenderTarget
=
NULL
;
mRenderTarget
=
NULL
;
}
}
if
(
mOffscreenTexture
)
{
mOffscreenTexture
->
Release
();
mOffscreenTexture
=
NULL
;
}
}
}
void
Surface
::
resetSwapChain
()
void
Surface
::
resetSwapChain
()
{
{
if
(
!
mWindow
)
{
resetSwapChain
(
mWidth
,
mHeight
);
return
;
}
RECT
windowRect
;
RECT
windowRect
;
if
(
!
GetClientRect
(
getWindowHandle
(),
&
windowRect
))
if
(
!
GetClientRect
(
getWindowHandle
(),
&
windowRect
))
{
{
...
@@ -90,8 +122,9 @@ void Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
...
@@ -90,8 +122,9 @@ void Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
// before reallocating them to free up as much video memory as possible.
// before reallocating them to free up as much video memory as possible.
device
->
EvictManagedResources
();
device
->
EvictManagedResources
();
release
();
release
();
D3DPRESENT_PARAMETERS
presentParameters
=
{
0
};
D3DPRESENT_PARAMETERS
presentParameters
=
{
0
};
HRESULT
result
;
presentParameters
.
AutoDepthStencilFormat
=
mConfig
->
mDepthStencilFormat
;
presentParameters
.
AutoDepthStencilFormat
=
mConfig
->
mDepthStencilFormat
;
presentParameters
.
BackBufferCount
=
1
;
presentParameters
.
BackBufferCount
=
1
;
...
@@ -107,13 +140,24 @@ void Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
...
@@ -107,13 +140,24 @@ void Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
presentParameters
.
BackBufferWidth
=
backbufferWidth
;
presentParameters
.
BackBufferWidth
=
backbufferWidth
;
presentParameters
.
BackBufferHeight
=
backbufferHeight
;
presentParameters
.
BackBufferHeight
=
backbufferHeight
;
HRESULT
result
=
device
->
CreateAdditionalSwapChain
(
&
presentParameters
,
&
mSwapChain
);
if
(
mWindow
)
{
result
=
device
->
CreateAdditionalSwapChain
(
&
presentParameters
,
&
mSwapChain
);
}
else
{
HANDLE
*
pShareHandle
=
NULL
;
if
(
mDisplay
->
isD3d9ExDevice
())
{
pShareHandle
=
&
mShareHandle
;
}
result
=
device
->
CreateTexture
(
presentParameters
.
BackBufferWidth
,
presentParameters
.
BackBufferHeight
,
1
,
D3DUSAGE_RENDERTARGET
,
presentParameters
.
BackBufferFormat
,
D3DPOOL_DEFAULT
,
&
mOffscreenTexture
,
pShareHandle
);
}
if
(
FAILED
(
result
))
if
(
FAILED
(
result
))
{
{
ASSERT
(
result
==
D3DERR_OUTOFVIDEOMEMORY
||
result
==
E_OUTOFMEMORY
);
ASSERT
(
result
==
D3DERR_OUTOFVIDEOMEMORY
||
result
==
E_OUTOFMEMORY
);
ERR
(
"Could not create additional swap chains: %08lX"
,
result
);
ERR
(
"Could not create additional swap chains
or offscreen surfaces
: %08lX"
,
result
);
release
();
release
();
return
error
(
EGL_BAD_ALLOC
);
return
error
(
EGL_BAD_ALLOC
);
}
}
...
@@ -131,13 +175,17 @@ void Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
...
@@ -131,13 +175,17 @@ void Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
return
error
(
EGL_BAD_ALLOC
);
return
error
(
EGL_BAD_ALLOC
);
}
}
mSwapChain
->
GetBackBuffer
(
0
,
D3DBACKBUFFER_TYPE_MONO
,
&
mRenderTarget
);
if
(
mWindow
)
{
mSwapChain
->
GetBackBuffer
(
0
,
D3DBACKBUFFER_TYPE_MONO
,
&
mRenderTarget
);
InvalidateRect
(
mWindow
,
NULL
,
FALSE
);
}
else
{
mOffscreenTexture
->
GetSurfaceLevel
(
0
,
&
mRenderTarget
);
}
mWidth
=
presentParameters
.
BackBufferWidth
;
mWidth
=
presentParameters
.
BackBufferWidth
;
mHeight
=
presentParameters
.
BackBufferHeight
;
mHeight
=
presentParameters
.
BackBufferHeight
;
mPresentIntervalDirty
=
false
;
mPresentIntervalDirty
=
false
;
InvalidateRect
(
mWindow
,
NULL
,
FALSE
);
}
}
HWND
Surface
::
getWindowHandle
()
HWND
Surface
::
getWindowHandle
()
...
@@ -162,6 +210,9 @@ static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam
...
@@ -162,6 +210,9 @@ static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam
void
Surface
::
subclassWindow
()
void
Surface
::
subclassWindow
()
{
{
if
(
!
mWindow
)
return
;
SetLastError
(
0
);
SetLastError
(
0
);
LONG
oldWndProc
=
SetWindowLong
(
mWindow
,
GWL_WNDPROC
,
reinterpret_cast
<
LONG
>
(
SurfaceWindowProc
));
LONG
oldWndProc
=
SetWindowLong
(
mWindow
,
GWL_WNDPROC
,
reinterpret_cast
<
LONG
>
(
SurfaceWindowProc
));
if
(
oldWndProc
==
0
&&
GetLastError
()
!=
ERROR_SUCCESS
)
{
if
(
oldWndProc
==
0
&&
GetLastError
()
!=
ERROR_SUCCESS
)
{
...
...
src/libEGL/Surface.h
View file @
721b7f26
...
@@ -26,6 +26,7 @@ class Surface
...
@@ -26,6 +26,7 @@ class Surface
{
{
public
:
public
:
Surface
(
Display
*
display
,
const
egl
::
Config
*
config
,
HWND
window
);
Surface
(
Display
*
display
,
const
egl
::
Config
*
config
,
HWND
window
);
Surface
(
Display
*
display
,
const
egl
::
Config
*
config
,
EGLint
width
,
EGLint
height
);
~
Surface
();
~
Surface
();
...
@@ -41,6 +42,8 @@ class Surface
...
@@ -41,6 +42,8 @@ class Surface
virtual
IDirect3DSurface9
*
getRenderTarget
();
virtual
IDirect3DSurface9
*
getRenderTarget
();
virtual
IDirect3DSurface9
*
getDepthStencil
();
virtual
IDirect3DSurface9
*
getDepthStencil
();
HANDLE
getShareHandle
()
{
return
mShareHandle
;
}
void
setSwapInterval
(
EGLint
interval
);
void
setSwapInterval
(
EGLint
interval
);
bool
checkForOutOfDateSwapChain
();
// Returns true if swapchain changed due to resize or interval update
bool
checkForOutOfDateSwapChain
();
// Returns true if swapchain changed due to resize or interval update
...
@@ -51,6 +54,9 @@ private:
...
@@ -51,6 +54,9 @@ private:
IDirect3DSwapChain9
*
mSwapChain
;
IDirect3DSwapChain9
*
mSwapChain
;
IDirect3DSurface9
*
mDepthStencil
;
IDirect3DSurface9
*
mDepthStencil
;
IDirect3DSurface9
*
mRenderTarget
;
IDirect3DSurface9
*
mRenderTarget
;
IDirect3DTexture9
*
mOffscreenTexture
;
HANDLE
mShareHandle
;
void
subclassWindow
();
void
subclassWindow
();
void
unsubclassWindow
();
void
unsubclassWindow
();
...
...
src/libEGL/libEGL.cpp
View file @
721b7f26
...
@@ -194,7 +194,7 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
...
@@ -194,7 +194,7 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
case
EGL_CLIENT_APIS
:
case
EGL_CLIENT_APIS
:
return
success
(
"OpenGL_ES"
);
return
success
(
"OpenGL_ES"
);
case
EGL_EXTENSIONS
:
case
EGL_EXTENSIONS
:
return
success
(
""
);
return
display
->
getExtensionString
(
);
case
EGL_VENDOR
:
case
EGL_VENDOR
:
return
success
(
"Google Inc."
);
return
success
(
"Google Inc."
);
case
EGL_VERSION
:
case
EGL_VERSION
:
...
@@ -391,15 +391,61 @@ EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, c
...
@@ -391,15 +391,61 @@ EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, c
try
try
{
{
egl
::
Display
*
display
=
static_cast
<
egl
::
Display
*>
(
dpy
);
egl
::
Display
*
display
=
static_cast
<
egl
::
Display
*>
(
dpy
);
EGLint
width
=
0
,
height
=
0
;
if
(
!
validate
(
display
,
config
))
if
(
!
validate
(
display
,
config
))
{
{
return
EGL_NO_SURFACE
;
return
EGL_NO_SURFACE
;
}
}
UNIMPLEMENTED
();
// FIXME
if
(
attrib_list
)
{
while
(
*
attrib_list
!=
EGL_NONE
)
{
switch
(
attrib_list
[
0
])
{
case
EGL_WIDTH
:
width
=
attrib_list
[
1
];
break
;
case
EGL_HEIGHT
:
height
=
attrib_list
[
1
];
break
;
case
EGL_LARGEST_PBUFFER
:
if
(
attrib_list
[
1
]
!=
EGL_FALSE
)
UNIMPLEMENTED
();
// FIXME
break
;
case
EGL_TEXTURE_FORMAT
:
case
EGL_TEXTURE_TARGET
:
switch
(
attrib_list
[
1
])
{
case
EGL_NO_TEXTURE
:
break
;
default
:
return
error
(
EGL_BAD_ATTRIBUTE
,
EGL_NO_SURFACE
);
}
break
;
case
EGL_MIPMAP_TEXTURE
:
if
(
attrib_list
[
1
]
!=
EGL_FALSE
)
return
error
(
EGL_BAD_ATTRIBUTE
,
EGL_NO_SURFACE
);
break
;
case
EGL_VG_COLORSPACE
:
return
error
(
EGL_BAD_MATCH
,
EGL_NO_SURFACE
);
case
EGL_VG_ALPHA_FORMAT
:
return
error
(
EGL_BAD_MATCH
,
EGL_NO_SURFACE
);
default
:
return
error
(
EGL_BAD_ATTRIBUTE
,
EGL_NO_SURFACE
);
}
attrib_list
+=
2
;
}
}
if
(
width
==
0
||
height
==
0
)
return
error
(
EGL_BAD_ATTRIBUTE
,
EGL_NO_SURFACE
);
EGLSurface
surface
=
(
EGLSurface
)
display
->
createOffscreenSurface
(
width
,
height
,
config
);
return
success
(
EGL_NO_DISPLAY
);
return
success
(
surface
);
}
}
catch
(
std
::
bad_alloc
&
)
catch
(
std
::
bad_alloc
&
)
{
{
...
@@ -425,7 +471,7 @@ EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EG
...
@@ -425,7 +471,7 @@ EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EG
UNIMPLEMENTED
();
// FIXME
UNIMPLEMENTED
();
// FIXME
return
success
(
EGL_NO_
DISPLAY
);
return
success
(
EGL_NO_
SURFACE
);
}
}
catch
(
std
::
bad_alloc
&
)
catch
(
std
::
bad_alloc
&
)
{
{
...
@@ -550,6 +596,46 @@ EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint
...
@@ -550,6 +596,46 @@ EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint
return
EGL_FALSE
;
return
EGL_FALSE
;
}
}
EGLBoolean
__stdcall
eglQuerySurfacePointerANGLE
(
EGLDisplay
dpy
,
EGLSurface
surface
,
EGLint
attribute
,
void
**
value
)
{
TRACE
(
"(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, void **value = 0x%0.8p)"
,
dpy
,
surface
,
attribute
,
value
);
try
{
egl
::
Display
*
display
=
static_cast
<
egl
::
Display
*>
(
dpy
);
if
(
!
validate
(
display
))
{
return
EGL_FALSE
;
}
if
(
surface
==
EGL_NO_SURFACE
)
{
return
error
(
EGL_BAD_SURFACE
,
EGL_FALSE
);
}
egl
::
Surface
*
eglSurface
=
(
egl
::
Surface
*
)
surface
;
switch
(
attribute
)
{
case
EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE
:
*
value
=
(
void
*
)
eglSurface
->
getShareHandle
();
break
;
default
:
return
error
(
EGL_BAD_ATTRIBUTE
,
EGL_FALSE
);
}
return
success
(
EGL_TRUE
);
}
catch
(
std
::
bad_alloc
&
)
{
return
error
(
EGL_BAD_ALLOC
,
EGL_FALSE
);
}
return
EGL_FALSE
;
}
EGLBoolean
__stdcall
eglBindAPI
(
EGLenum
api
)
EGLBoolean
__stdcall
eglBindAPI
(
EGLenum
api
)
{
{
EVENT
(
"(EGLenum api = 0x%X)"
,
api
);
EVENT
(
"(EGLenum api = 0x%X)"
,
api
);
...
@@ -699,9 +785,9 @@ EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint
...
@@ -699,9 +785,9 @@ EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint
return
EGL_FALSE
;
return
EGL_FALSE
;
}
}
UNIMPLEMENTED
();
// FIXME
// FIXME - need implementation
return
success
(
EGL_
TRU
E
);
return
success
(
EGL_
FALS
E
);
}
}
catch
(
std
::
bad_alloc
&
)
catch
(
std
::
bad_alloc
&
)
{
{
...
@@ -724,9 +810,9 @@ EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLi
...
@@ -724,9 +810,9 @@ EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLi
return
EGL_FALSE
;
return
EGL_FALSE
;
}
}
UNIMPLEMENTED
();
// FIXME
// FIXME - need implementation
return
success
(
EGL_
TRU
E
);
return
success
(
EGL_
FALS
E
);
}
}
catch
(
std
::
bad_alloc
&
)
catch
(
std
::
bad_alloc
&
)
{
{
...
@@ -1093,6 +1179,7 @@ __eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char
...
@@ -1093,6 +1179,7 @@ __eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char
static
const
Extension
eglExtensions
[]
=
static
const
Extension
eglExtensions
[]
=
{
{
{
"eglQuerySurfacePointerANGLE"
,
(
__eglMustCastToProperFunctionPointerType
)
eglQuerySurfacePointerANGLE
},
{
""
,
NULL
},
{
""
,
NULL
},
};
};
...
...
src/libEGL/main.h
View file @
721b7f26
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#define EGLAPI
#define EGLAPI
#include <EGL/egl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
namespace
egl
namespace
egl
{
{
...
...
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