Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftshader
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
swiftshader
Commits
2f24de32
Commit
2f24de32
authored
May 07, 2014
by
Nicolas Capens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only open an X11 display when not provided by the application through eglGetDisplay().
parent
49e3cb5f
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
62 additions
and
63 deletions
+62
-63
Version.h
src/Common/Version.h
+1
-1
Surface.cpp
src/GLES2/libEGL/Surface.cpp
+1
-1
main.cpp
src/GLES2/libEGL/main.cpp
+2
-2
main.h
src/GLES2/libEGL/main.h
+1
-1
FrameBuffer.cpp
src/Main/FrameBuffer.cpp
+2
-41
FrameBuffer.hpp
src/Main/FrameBuffer.hpp
+0
-12
FrameBufferWin.cpp
src/Main/FrameBufferWin.cpp
+29
-0
FrameBufferWin.hpp
src/Main/FrameBufferWin.hpp
+5
-0
FrameBufferX11.cpp
src/Main/FrameBufferX11.cpp
+18
-3
FrameBufferX11.hpp
src/Main/FrameBufferX11.hpp
+3
-2
No files found.
src/Common/Version.h
View file @
2f24de32
#define MAJOR_VERSION 3
#define MAJOR_VERSION 3
#define MINOR_VERSION 2
#define MINOR_VERSION 2
#define BUILD_VERSION 6
#define BUILD_VERSION 6
#define BUILD_REVISION 47
125
#define BUILD_REVISION 47
297
#define STRINGIFY(x) #x
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define MACRO_STRINGIFY(x) STRINGIFY(x)
...
...
src/GLES2/libEGL/Surface.cpp
View file @
2f24de32
...
@@ -144,7 +144,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
...
@@ -144,7 +144,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
if
(
mWindow
)
if
(
mWindow
)
{
{
frameBuffer
=
gl
::
createFrameBuffer
(
mWindow
,
backBufferWidth
,
backBufferHeight
);
frameBuffer
=
gl
::
createFrameBuffer
(
m
Display
->
getNativeDisplay
(),
m
Window
,
backBufferWidth
,
backBufferHeight
);
if
(
!
frameBuffer
)
if
(
!
frameBuffer
)
{
{
...
...
src/GLES2/libEGL/main.cpp
View file @
2f24de32
...
@@ -95,7 +95,7 @@ CONSTRUCTOR static bool eglAttachProcess()
...
@@ -95,7 +95,7 @@ CONSTRUCTOR static bool eglAttachProcess()
gl
::
getCurrentContext
=
(
gl
::
Context
*
(
*
)())
getProcAddress
(
libGLESv2
,
"glGetCurrentContext"
);
gl
::
getCurrentContext
=
(
gl
::
Context
*
(
*
)())
getProcAddress
(
libGLESv2
,
"glGetCurrentContext"
);
gl
::
getProcAddress
=
(
__eglMustCastToProperFunctionPointerType
(
*
)(
const
char
*
))
getProcAddress
(
libGLESv2
,
"glGetProcAddress"
);
gl
::
getProcAddress
=
(
__eglMustCastToProperFunctionPointerType
(
*
)(
const
char
*
))
getProcAddress
(
libGLESv2
,
"glGetProcAddress"
);
gl
::
createBackBuffer
=
(
gl
::
Image
*
(
*
)(
int
,
int
,
const
egl
::
Config
*
))
getProcAddress
(
libGLESv2
,
"createBackBuffer"
);
gl
::
createBackBuffer
=
(
gl
::
Image
*
(
*
)(
int
,
int
,
const
egl
::
Config
*
))
getProcAddress
(
libGLESv2
,
"createBackBuffer"
);
gl
::
createFrameBuffer
=
(
sw
::
FrameBuffer
*
(
*
)(
EGLNativeWindowType
,
int
,
int
))
getProcAddress
(
libGLESv2
,
"createFrameBuffer"
);
gl
::
createFrameBuffer
=
(
sw
::
FrameBuffer
*
(
*
)(
EGLNative
DisplayType
,
EGLNative
WindowType
,
int
,
int
))
getProcAddress
(
libGLESv2
,
"createFrameBuffer"
);
return
libGLESv2
!=
0
;
return
libGLESv2
!=
0
;
}
}
...
@@ -255,7 +255,7 @@ namespace gl
...
@@ -255,7 +255,7 @@ namespace gl
Context
*
(
*
getCurrentContext
)()
=
0
;
Context
*
(
*
getCurrentContext
)()
=
0
;
__eglMustCastToProperFunctionPointerType
(
*
getProcAddress
)(
const
char
*
procname
)
=
0
;
__eglMustCastToProperFunctionPointerType
(
*
getProcAddress
)(
const
char
*
procname
)
=
0
;
Image
*
(
*
createBackBuffer
)(
int
width
,
int
height
,
const
egl
::
Config
*
config
)
=
0
;
Image
*
(
*
createBackBuffer
)(
int
width
,
int
height
,
const
egl
::
Config
*
config
)
=
0
;
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNativeWindowType
window
,
int
width
,
int
height
)
=
0
;
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNative
DisplayType
display
,
EGLNative
WindowType
window
,
int
width
,
int
height
)
=
0
;
}
}
void
*
libGLESv2
=
0
;
// Handle to the libGLESv2 module
void
*
libGLESv2
=
0
;
// Handle to the libGLESv2 module
src/GLES2/libEGL/main.h
View file @
2f24de32
...
@@ -90,7 +90,7 @@ namespace gl
...
@@ -90,7 +90,7 @@ namespace gl
extern
Context
*
(
*
getCurrentContext
)();
extern
Context
*
(
*
getCurrentContext
)();
extern
__eglMustCastToProperFunctionPointerType
(
*
getProcAddress
)(
const
char
*
procname
);
extern
__eglMustCastToProperFunctionPointerType
(
*
getProcAddress
)(
const
char
*
procname
);
extern
Image
*
(
*
createBackBuffer
)(
int
width
,
int
height
,
const
egl
::
Config
*
config
);
extern
Image
*
(
*
createBackBuffer
)(
int
width
,
int
height
,
const
egl
::
Config
*
config
);
extern
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNativeWindowType
window
,
int
width
,
int
height
);
extern
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNative
DisplayType
display
,
EGLNative
WindowType
window
,
int
width
,
int
height
);
}
}
extern
void
*
libGLESv2
;
// Handle to the libGLESv2 module
extern
void
*
libGLESv2
;
// Handle to the libGLESv2 module
...
...
src/Main/FrameBuffer.cpp
View file @
2f24de32
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
#include "Register.hpp"
#include "Register.hpp"
#include "Renderer/Surface.hpp"
#include "Renderer/Surface.hpp"
#include "Reactor/Reactor.hpp"
#include "Reactor/Reactor.hpp"
#include "Common/Configurator.hpp"
#include "Common/Debug.hpp"
#include "Common/Debug.hpp"
#include <stdio.h>
#include <stdio.h>
...
@@ -515,43 +514,4 @@ namespace sw
...
@@ -515,43 +514,4 @@ namespace sw
}
}
#endif
#endif
}
}
}
}
\ No newline at end of file
#if defined(_WIN32)
#include "FrameBufferDD.hpp"
#include "FrameBufferGDI.hpp"
#else
#include "FrameBufferX11.hpp"
#endif
extern
"C"
{
#if defined(_WIN32)
sw
::
FrameBuffer
*
createFrameBuffer
(
HWND
window
,
int
width
,
int
height
)
{
return
createFrameBufferWin
(
window
,
width
,
height
,
false
,
false
);
}
sw
::
FrameBufferWin
*
createFrameBufferWin
(
HWND
windowHandle
,
int
width
,
int
height
,
bool
fullscreen
,
bool
topLeftOrigin
)
{
sw
::
Configurator
ini
(
"SwiftShader.ini"
);
int
api
=
ini
.
getInteger
(
"Testing"
,
"FrameBufferAPI"
,
0
);
if
(
api
==
0
&&
topLeftOrigin
)
{
return
new
sw
::
FrameBufferDD
(
windowHandle
,
width
,
height
,
fullscreen
,
topLeftOrigin
);
}
else
{
return
new
sw
::
FrameBufferGDI
(
windowHandle
,
width
,
height
,
fullscreen
,
topLeftOrigin
);
}
return
0
;
}
#else
sw
::
FrameBuffer
*
createFrameBuffer
(
Window
window
,
int
width
,
int
height
)
{
return
new
sw
::
FrameBufferX11
(
window
,
width
,
height
);
}
#endif
}
src/Main/FrameBuffer.hpp
View file @
2f24de32
...
@@ -100,18 +100,6 @@ namespace sw
...
@@ -100,18 +100,6 @@ namespace sw
static
bool
topLeftOrigin
;
static
bool
topLeftOrigin
;
};
};
class
FrameBufferWin
;
}
extern
"C"
{
#if defined(_WIN32)
sw
::
FrameBuffer
*
createFrameBuffer
(
HWND
windowHandle
,
int
width
,
int
height
);
sw
::
FrameBufferWin
*
createFrameBufferWin
(
HWND
windowHandle
,
int
width
,
int
height
,
bool
fullscreen
,
bool
topLeftOrigin
);
#else
sw
::
FrameBuffer
*
createFrameBuffer
(
unsigned
long
window
,
int
width
,
int
height
);
#endif
}
}
#endif // sw_FrameBuffer_hpp
#endif // sw_FrameBuffer_hpp
src/Main/FrameBufferWin.cpp
View file @
2f24de32
...
@@ -47,3 +47,32 @@ namespace sw
...
@@ -47,3 +47,32 @@ namespace sw
}
}
}
}
}
}
#include "FrameBufferDD.hpp"
#include "FrameBufferGDI.hpp"
#include "Common/Configurator.hpp"
extern
"C"
{
sw
::
FrameBufferWin
*
createFrameBufferWin
(
HWND
windowHandle
,
int
width
,
int
height
,
bool
fullscreen
,
bool
topLeftOrigin
)
{
sw
::
Configurator
ini
(
"SwiftShader.ini"
);
int
api
=
ini
.
getInteger
(
"Testing"
,
"FrameBufferAPI"
,
0
);
if
(
api
==
0
&&
topLeftOrigin
)
{
return
new
sw
::
FrameBufferDD
(
windowHandle
,
width
,
height
,
fullscreen
,
topLeftOrigin
);
}
else
{
return
new
sw
::
FrameBufferGDI
(
windowHandle
,
width
,
height
,
fullscreen
,
topLeftOrigin
);
}
return
0
;
}
sw
::
FrameBuffer
*
createFrameBuffer
(
HDC
display
,
HWND
window
,
int
width
,
int
height
)
{
return
createFrameBufferWin
(
window
,
width
,
height
,
false
,
false
);
}
}
src/Main/FrameBufferWin.hpp
View file @
2f24de32
...
@@ -54,4 +54,9 @@ namespace sw
...
@@ -54,4 +54,9 @@ namespace sw
};
};
}
}
extern
"C"
{
sw
::
FrameBufferWin
*
createFrameBufferWin
(
HWND
windowHandle
,
int
width
,
int
height
,
bool
fullscreen
,
bool
topLeftOrigin
);
}
#endif // sw_FrameBufferWin_hpp
#endif // sw_FrameBufferWin_hpp
src/Main/FrameBufferX11.cpp
View file @
2f24de32
...
@@ -38,9 +38,13 @@ namespace sw
...
@@ -38,9 +38,13 @@ namespace sw
}
}
}
}
FrameBufferX11
::
FrameBufferX11
(
Window
window
,
int
width
,
int
height
)
:
FrameBuffer
(
width
,
height
,
false
,
false
),
x_window
(
window
)
FrameBufferX11
::
FrameBufferX11
(
Display
*
display
,
Window
window
,
int
width
,
int
height
)
:
FrameBuffer
(
width
,
height
,
false
,
false
),
x_window
(
window
),
x_display
(
display
),
ownX11
(
!
display
)
{
{
x_display
=
XOpenDisplay
(
0
);
if
(
!
x_display
)
{
x_display
=
XOpenDisplay
(
0
);
}
int
screen
=
DefaultScreen
(
x_display
);
int
screen
=
DefaultScreen
(
x_display
);
x_gc
=
XDefaultGC
(
x_display
,
screen
);
x_gc
=
XDefaultGC
(
x_display
,
screen
);
Visual
*
x_visual
=
XDefaultVisual
(
x_display
,
screen
);
Visual
*
x_visual
=
XDefaultVisual
(
x_display
,
screen
);
...
@@ -98,7 +102,10 @@ namespace sw
...
@@ -98,7 +102,10 @@ namespace sw
shmctl
(
shminfo
.
shmid
,
IPC_RMID
,
0
);
shmctl
(
shminfo
.
shmid
,
IPC_RMID
,
0
);
}
}
XCloseDisplay
(
x_display
);
if
(
ownX11
)
{
XCloseDisplay
(
x_display
);
}
}
}
void
*
FrameBufferX11
::
lock
()
void
*
FrameBufferX11
::
lock
()
...
@@ -130,3 +137,11 @@ namespace sw
...
@@ -130,3 +137,11 @@ namespace sw
XSync
(
x_display
,
False
);
XSync
(
x_display
,
False
);
}
}
}
}
extern
"C"
{
sw
::
FrameBuffer
*
createFrameBuffer
(
void
*
display
,
Window
window
,
int
width
,
int
height
)
{
return
new
sw
::
FrameBufferX11
((
Display
*
)
display
,
window
,
width
,
height
);
}
}
src/Main/FrameBufferX11.hpp
View file @
2f24de32
...
@@ -28,7 +28,7 @@ namespace sw
...
@@ -28,7 +28,7 @@ namespace sw
class
FrameBufferX11
:
public
FrameBuffer
class
FrameBufferX11
:
public
FrameBuffer
{
{
public
:
public
:
FrameBufferX11
(
Window
window
,
int
width
,
int
height
);
FrameBufferX11
(
Display
*
display
,
Window
window
,
int
width
,
int
height
);
~
FrameBufferX11
();
~
FrameBufferX11
();
...
@@ -38,7 +38,8 @@ namespace sw
...
@@ -38,7 +38,8 @@ namespace sw
virtual
void
*
lock
();
virtual
void
*
lock
();
virtual
void
unlock
();
virtual
void
unlock
();
private
:
private
:
bool
ownX11
;
Display
*
x_display
;
Display
*
x_display
;
Window
x_window
;
Window
x_window
;
XImage
*
x_image
;
XImage
*
x_image
;
...
...
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