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
10219e72
Commit
10219e72
authored
May 07, 2014
by
Nicolas Capens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the full format to specify frame buffer blits.
parent
6296dbb3
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
93 additions
and
89 deletions
+93
-89
Version.h
src/Common/Version.h
+1
-1
Surface.cpp
src/GLES2/libEGL/Surface.cpp
+1
-2
Surface.h
src/GLES2/libEGL/Surface.h
+1
-1
Context.cpp
src/GLES2/libGLESv2/Context.cpp
+0
-8
Context.h
src/GLES2/libGLESv2/Context.h
+1
-1
FrameBuffer.cpp
src/Main/FrameBuffer.cpp
+32
-26
FrameBuffer.hpp
src/Main/FrameBuffer.hpp
+7
-7
FrameBufferDD.cpp
src/Main/FrameBufferDD.cpp
+23
-16
FrameBufferDD.hpp
src/Main/FrameBufferDD.hpp
+4
-4
FrameBufferGDI.cpp
src/Main/FrameBufferGDI.cpp
+9
-9
FrameBufferGDI.hpp
src/Main/FrameBufferGDI.hpp
+4
-4
FrameBufferWin.hpp
src/Main/FrameBufferWin.hpp
+6
-6
FrameBufferX11.cpp
src/Main/FrameBufferX11.cpp
+2
-2
FrameBufferX11.hpp
src/Main/FrameBufferX11.hpp
+2
-2
No files found.
src/Common/Version.h
View file @
10219e72
#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
507
#define BUILD_REVISION 47
654
#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 @
10219e72
...
@@ -186,9 +186,8 @@ void Surface::swap()
...
@@ -186,9 +186,8 @@ void Surface::swap()
if
(
backBuffer
)
if
(
backBuffer
)
{
{
bool
HDR
=
backBuffer
->
getInternalFormat
()
==
sw
::
FORMAT_A16B16G16R16
;
void
*
source
=
backBuffer
->
lockInternal
(
0
,
0
,
0
,
sw
::
LOCK_READONLY
,
sw
::
PUBLIC
);
void
*
source
=
backBuffer
->
lockInternal
(
0
,
0
,
0
,
sw
::
LOCK_READONLY
,
sw
::
PUBLIC
);
frameBuffer
->
flip
(
source
,
HDR
);
frameBuffer
->
flip
(
source
,
backBuffer
->
getInternalFormat
()
);
backBuffer
->
unlockInternal
();
backBuffer
->
unlockInternal
();
checkForResize
();
checkForResize
();
...
...
src/GLES2/libEGL/Surface.h
View file @
10219e72
...
@@ -40,7 +40,7 @@ public:
...
@@ -40,7 +40,7 @@ public:
Surface
(
Display
*
display
,
const
egl
::
Config
*
config
,
EGLNativeWindowType
window
);
Surface
(
Display
*
display
,
const
egl
::
Config
*
config
,
EGLNativeWindowType
window
);
Surface
(
Display
*
display
,
const
egl
::
Config
*
config
,
EGLint
width
,
EGLint
height
,
EGLenum
textureFormat
,
EGLenum
textureTarget
);
Surface
(
Display
*
display
,
const
egl
::
Config
*
config
,
EGLint
width
,
EGLint
height
,
EGLenum
textureFormat
,
EGLenum
textureTarget
);
~
Surface
();
virtual
~
Surface
();
bool
initialize
();
bool
initialize
();
void
swap
();
void
swap
();
...
...
src/GLES2/libGLESv2/Context.cpp
View file @
10219e72
...
@@ -222,14 +222,6 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
...
@@ -222,14 +222,6 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
mVertexDataManager
=
new
VertexDataManager
(
this
);
mVertexDataManager
=
new
VertexDataManager
(
this
);
mIndexDataManager
=
new
IndexDataManager
();
mIndexDataManager
=
new
IndexDataManager
();
const
sw
::
Format
renderBufferFormats
[]
=
{
sw
::
FORMAT_A8R8G8B8
,
sw
::
FORMAT_X8R8G8B8
,
sw
::
FORMAT_R5G6B5
,
sw
::
FORMAT_D24S8
};
initExtensionString
();
initExtensionString
();
mState
.
viewportX
=
0
;
mState
.
viewportX
=
0
;
...
...
src/GLES2/libGLESv2/Context.h
View file @
10219e72
...
@@ -239,7 +239,7 @@ class Context
...
@@ -239,7 +239,7 @@ class Context
public
:
public
:
Context
(
const
egl
::
Config
*
config
,
const
Context
*
shareContext
);
Context
(
const
egl
::
Config
*
config
,
const
Context
*
shareContext
);
~
Context
();
virtual
~
Context
();
void
makeCurrent
(
egl
::
Display
*
display
,
egl
::
Surface
*
surface
);
void
makeCurrent
(
egl
::
Display
*
display
,
egl
::
Surface
*
surface
);
...
...
src/Main/FrameBuffer.cpp
View file @
10219e72
...
@@ -58,8 +58,8 @@ namespace sw
...
@@ -58,8 +58,8 @@ namespace sw
this
->
width
=
width
;
this
->
width
=
width
;
this
->
height
=
height
;
this
->
height
=
height
;
bitDepth
=
32
;
destFormat
=
FORMAT_X8R8G8B8
;
HDRdisplay
=
false
;
sourceFormat
=
FORMAT_X8R8G8B8
;
stride
=
0
;
stride
=
0
;
if
(
forceWindowed
)
if
(
forceWindowed
)
...
@@ -74,7 +74,8 @@ namespace sw
...
@@ -74,7 +74,8 @@ namespace sw
blitState
.
width
=
0
;
blitState
.
width
=
0
;
blitState
.
height
=
0
;
blitState
.
height
=
0
;
blitState
.
depth
=
0
;
blitState
.
destFormat
=
FORMAT_X8R8G8B8
;
blitState
.
sourceFormat
=
FORMAT_X8R8G8B8
;
blitState
.
cursorWidth
=
0
;
blitState
.
cursorWidth
=
0
;
blitState
.
cursorHeight
=
0
;
blitState
.
cursorHeight
=
0
;
...
@@ -145,7 +146,7 @@ namespace sw
...
@@ -145,7 +146,7 @@ namespace sw
cursorPositionY
=
y
;
cursorPositionY
=
y
;
}
}
void
FrameBuffer
::
copy
(
void
*
source
,
bool
HDR
)
void
FrameBuffer
::
copy
(
void
*
source
,
Format
format
)
{
{
if
(
!
source
)
if
(
!
source
)
{
{
...
@@ -164,13 +165,13 @@ namespace sw
...
@@ -164,13 +165,13 @@ namespace sw
else
else
{
{
const
int
width2
=
(
width
+
1
)
&
~
1
;
const
int
width2
=
(
width
+
1
)
&
~
1
;
const
int
sBytes
=
HDR
?
8
:
4
;
const
int
sBytes
=
Surface
::
bytes
(
sourceFormat
)
;
const
int
sStride
=
sBytes
*
width2
;
const
int
sStride
=
sBytes
*
width2
;
target
=
(
byte
*
)
source
+
(
height
-
1
)
*
sStride
;
target
=
(
byte
*
)
source
+
(
height
-
1
)
*
sStride
;
}
}
HDRdisplay
=
HDR
;
sourceFormat
=
format
;
cursorX
=
cursorPositionX
-
cursorHotspotX
;
cursorX
=
cursorPositionX
-
cursorHotspotX
;
cursorY
=
cursorPositionY
-
cursorHotspotY
;
cursorY
=
cursorPositionY
-
cursorHotspotY
;
...
@@ -194,9 +195,9 @@ namespace sw
...
@@ -194,9 +195,9 @@ namespace sw
update
.
width
=
width
;
update
.
width
=
width
;
update
.
height
=
height
;
update
.
height
=
height
;
update
.
depth
=
bitDepth
;
update
.
destFormat
=
destFormat
;
update
.
sourceFormat
=
sourceFormat
;
update
.
stride
=
stride
;
update
.
stride
=
stride
;
update
.
HDR
=
HDRdisplay
;
update
.
cursorWidth
=
cursorWidth
;
update
.
cursorWidth
=
cursorWidth
;
update
.
cursorHeight
=
cursorHeight
;
update
.
cursorHeight
=
cursorHeight
;
...
@@ -219,9 +220,9 @@ namespace sw
...
@@ -219,9 +220,9 @@ namespace sw
const
int
width
=
state
.
width
;
const
int
width
=
state
.
width
;
const
int
height
=
state
.
height
;
const
int
height
=
state
.
height
;
const
int
width2
=
(
state
.
width
+
1
)
&
~
1
;
const
int
width2
=
(
state
.
width
+
1
)
&
~
1
;
const
int
dBytes
=
state
.
depth
/
8
;
const
int
dBytes
=
Surface
::
bytes
(
state
.
destFormat
)
;
const
int
dStride
=
state
.
stride
;
const
int
dStride
=
state
.
stride
;
const
int
sBytes
=
state
.
HDR
?
8
:
4
;
const
int
sBytes
=
Surface
::
bytes
(
state
.
sourceFormat
)
;
const
int
sStride
=
topLeftOrigin
?
(
sBytes
*
width2
)
:
-
(
sBytes
*
width2
);
const
int
sStride
=
topLeftOrigin
?
(
sBytes
*
width2
)
:
-
(
sBytes
*
width2
);
// char compareApp[32] = SCRAMBLE31(validationApp, APPNAME_SCRAMBLE);
// char compareApp[32] = SCRAMBLE31(validationApp, APPNAME_SCRAMBLE);
...
@@ -272,11 +273,11 @@ namespace sw
...
@@ -272,11 +273,11 @@ namespace sw
}
}
#endif
#endif
if
(
state
.
de
pth
==
32
)
if
(
state
.
de
stFormat
==
FORMAT_X8R8G8B8
)
{
{
Int
x
=
x0
;
Int
x
=
x0
;
if
(
!
state
.
HDR
)
if
(
state
.
sourceFormat
==
FORMAT_X8R8G8B8
||
state
.
sourceFormat
==
FORMAT_A8R8G8B8
)
{
{
For
(,
x
<
width
-
3
,
x
+=
4
)
For
(,
x
<
width
-
3
,
x
+=
4
)
{
{
...
@@ -286,7 +287,7 @@ namespace sw
...
@@ -286,7 +287,7 @@ namespace sw
d
+=
4
*
dBytes
;
d
+=
4
*
dBytes
;
}
}
}
}
else
else
if
(
state
.
sourceFormat
==
FORMAT_A16B16G16R16
)
{
{
For
(,
x
<
width
-
1
,
x
+=
2
)
For
(,
x
<
width
-
1
,
x
+=
2
)
{
{
...
@@ -299,61 +300,65 @@ namespace sw
...
@@ -299,61 +300,65 @@ namespace sw
d
+=
2
*
dBytes
;
d
+=
2
*
dBytes
;
}
}
}
}
else
ASSERT
(
false
);
For
(,
x
<
width
,
x
++
)
For
(,
x
<
width
,
x
++
)
{
{
if
(
!
state
.
HDR
)
if
(
state
.
sourceFormat
==
FORMAT_X8R8G8B8
||
state
.
sourceFormat
==
FORMAT_A8R8G8B8
)
{
{
*
Pointer
<
Int
>
(
d
)
=
*
Pointer
<
Int
>
(
s
);
*
Pointer
<
Int
>
(
d
)
=
*
Pointer
<
Int
>
(
s
);
}
}
else
else
if
(
state
.
sourceFormat
==
FORMAT_A16B16G16R16
)
{
{
UShort4
c
=
As
<
UShort4
>
(
Swizzle
(
*
Pointer
<
Short4
>
(
s
),
0xC6
))
>>
8
;
UShort4
c
=
As
<
UShort4
>
(
Swizzle
(
*
Pointer
<
Short4
>
(
s
),
0xC6
))
>>
8
;
*
Pointer
<
Int
>
(
d
)
=
Int
(
As
<
Int2
>
(
Pack
(
c
,
c
)));
*
Pointer
<
Int
>
(
d
)
=
Int
(
As
<
Int2
>
(
Pack
(
c
,
c
)));
}
}
else
ASSERT
(
false
);
s
+=
sBytes
;
s
+=
sBytes
;
d
+=
dBytes
;
d
+=
dBytes
;
}
}
}
}
else
if
(
state
.
de
pth
==
24
)
else
if
(
state
.
de
stFormat
==
FORMAT_R8G8B8
)
{
{
For
(
Int
x
=
x0
,
x
<
width
,
x
++
)
For
(
Int
x
=
x0
,
x
<
width
,
x
++
)
{
{
if
(
!
state
.
HDR
)
if
(
state
.
sourceFormat
==
FORMAT_X8R8G8B8
||
state
.
sourceFormat
==
FORMAT_A8R8G8B8
)
{
{
*
Pointer
<
Byte
>
(
d
+
0
)
=
*
Pointer
<
Byte
>
(
s
+
0
);
*
Pointer
<
Byte
>
(
d
+
0
)
=
*
Pointer
<
Byte
>
(
s
+
0
);
*
Pointer
<
Byte
>
(
d
+
1
)
=
*
Pointer
<
Byte
>
(
s
+
1
);
*
Pointer
<
Byte
>
(
d
+
1
)
=
*
Pointer
<
Byte
>
(
s
+
1
);
*
Pointer
<
Byte
>
(
d
+
2
)
=
*
Pointer
<
Byte
>
(
s
+
2
);
*
Pointer
<
Byte
>
(
d
+
2
)
=
*
Pointer
<
Byte
>
(
s
+
2
);
}
}
else
else
if
(
state
.
sourceFormat
==
FORMAT_A16B16G16R16
)
{
{
*
Pointer
<
Byte
>
(
d
+
0
)
=
*
Pointer
<
Byte
>
(
s
+
5
);
*
Pointer
<
Byte
>
(
d
+
0
)
=
*
Pointer
<
Byte
>
(
s
+
5
);
*
Pointer
<
Byte
>
(
d
+
1
)
=
*
Pointer
<
Byte
>
(
s
+
3
);
*
Pointer
<
Byte
>
(
d
+
1
)
=
*
Pointer
<
Byte
>
(
s
+
3
);
*
Pointer
<
Byte
>
(
d
+
2
)
=
*
Pointer
<
Byte
>
(
s
+
1
);
*
Pointer
<
Byte
>
(
d
+
2
)
=
*
Pointer
<
Byte
>
(
s
+
1
);
}
}
else
ASSERT
(
false
);
s
+=
sBytes
;
s
+=
sBytes
;
d
+=
dBytes
;
d
+=
dBytes
;
}
}
}
}
else
if
(
state
.
de
pth
==
16
)
else
if
(
state
.
de
stFormat
==
FORMAT_R5G6B5
)
{
{
For
(
Int
x
=
x0
,
x
<
width
,
x
++
)
For
(
Int
x
=
x0
,
x
<
width
,
x
++
)
{
{
Int
c
;
Int
c
;
if
(
!
state
.
HDR
)
if
(
state
.
sourceFormat
==
FORMAT_X8R8G8B8
||
state
.
sourceFormat
==
FORMAT_A8R8G8B8
)
{
{
c
=
*
Pointer
<
Int
>
(
s
);
c
=
*
Pointer
<
Int
>
(
s
);
}
}
else
else
if
(
state
.
sourceFormat
==
FORMAT_A16B16G16R16
)
{
{
UShort4
cc
=
As
<
UShort4
>
(
Swizzle
(
*
Pointer
<
Short4
>
(
s
+
0
),
0xC6
))
>>
8
;
UShort4
cc
=
As
<
UShort4
>
(
Swizzle
(
*
Pointer
<
Short4
>
(
s
+
0
),
0xC6
))
>>
8
;
c
=
Int
(
As
<
Int2
>
(
Pack
(
cc
,
cc
)));
c
=
Int
(
As
<
Int2
>
(
Pack
(
cc
,
cc
)));
}
}
else
ASSERT
(
false
);
*
Pointer
<
Short
>
(
d
)
=
Short
((
c
&
0x00F80000
)
>>
8
|
*
Pointer
<
Short
>
(
d
)
=
Short
((
c
&
0x00F80000
)
>>
8
|
(
c
&
0x0000FC00
)
>>
5
|
(
c
&
0x0000FC00
)
>>
5
|
...
@@ -439,14 +444,15 @@ namespace sw
...
@@ -439,14 +444,15 @@ namespace sw
c1
=
UnpackLow
(
As
<
Byte8
>
(
c1
),
*
Pointer
<
Byte8
>
(
c
));
c1
=
UnpackLow
(
As
<
Byte8
>
(
c1
),
*
Pointer
<
Byte8
>
(
c
));
if
(
!
state
.
HDR
)
if
(
state
.
sourceFormat
==
FORMAT_X8R8G8B8
||
state
.
sourceFormat
==
FORMAT_A8R8G8B8
)
{
{
c2
=
UnpackLow
(
As
<
Byte8
>
(
c2
),
*
Pointer
<
Byte8
>
(
s
));
c2
=
UnpackLow
(
As
<
Byte8
>
(
c2
),
*
Pointer
<
Byte8
>
(
s
));
}
}
else
else
if
(
state
.
sourceFormat
==
FORMAT_A16B16G16R16
)
{
{
c2
=
Swizzle
(
*
Pointer
<
Short4
>
(
s
+
0
),
0xC6
);
c2
=
Swizzle
(
*
Pointer
<
Short4
>
(
s
+
0
),
0xC6
);
}
}
else
ASSERT
(
false
);
c1
=
As
<
Short4
>
(
As
<
UShort4
>
(
c1
)
>>
9
);
c1
=
As
<
Short4
>
(
As
<
UShort4
>
(
c1
)
>>
9
);
c2
=
As
<
Short4
>
(
As
<
UShort4
>
(
c2
)
>>
9
);
c2
=
As
<
Short4
>
(
As
<
UShort4
>
(
c2
)
>>
9
);
...
@@ -460,11 +466,11 @@ namespace sw
...
@@ -460,11 +466,11 @@ namespace sw
c1
=
As
<
Short4
>
(
Pack
(
As
<
UShort4
>
(
c1
),
As
<
UShort4
>
(
c1
)));
c1
=
As
<
Short4
>
(
Pack
(
As
<
UShort4
>
(
c1
),
As
<
UShort4
>
(
c1
)));
if
(
state
.
de
pth
==
32
)
if
(
state
.
de
stFormat
==
FORMAT_X8R8G8B8
)
{
{
*
Pointer
<
UInt
>
(
d
)
=
UInt
(
As
<
Long
>
(
c1
));
*
Pointer
<
UInt
>
(
d
)
=
UInt
(
As
<
Long
>
(
c1
));
}
}
else
if
(
state
.
de
pth
==
24
)
else
if
(
state
.
de
stFormat
==
FORMAT_R8G8B8
)
{
{
Int
c
=
Int
(
As
<
Int2
>
(
c1
));
Int
c
=
Int
(
As
<
Int2
>
(
c1
));
...
@@ -472,7 +478,7 @@ namespace sw
...
@@ -472,7 +478,7 @@ namespace sw
*
Pointer
<
Byte
>
(
d
+
1
)
=
Byte
(
c
>>
8
);
*
Pointer
<
Byte
>
(
d
+
1
)
=
Byte
(
c
>>
8
);
*
Pointer
<
Byte
>
(
d
+
2
)
=
Byte
(
c
>>
16
);
*
Pointer
<
Byte
>
(
d
+
2
)
=
Byte
(
c
>>
16
);
}
}
else
if
(
state
.
de
pth
==
16
)
else
if
(
state
.
de
stFormat
==
FORMAT_R5G6B5
)
{
{
Int
c
=
Int
(
As
<
Int2
>
(
c1
));
Int
c
=
Int
(
As
<
Int2
>
(
c1
));
...
...
src/Main/FrameBuffer.hpp
View file @
10219e72
...
@@ -24,9 +24,9 @@ namespace sw
...
@@ -24,9 +24,9 @@ namespace sw
{
{
int
width
;
int
width
;
int
height
;
int
height
;
int
depth
;
// Display bit depth; 32 = X8R8G8B8, 24 = R8G8B8, 16 = R5G6B5
Format
destFormat
;
Format
sourceFormat
;
int
stride
;
int
stride
;
bool
HDR
;
// A16B16G16R16 source color buffer
int
cursorWidth
;
int
cursorWidth
;
int
cursorHeight
;
int
cursorHeight
;
};
};
...
@@ -42,8 +42,8 @@ namespace sw
...
@@ -42,8 +42,8 @@ namespace sw
int
getHeight
()
const
;
int
getHeight
()
const
;
int
getStride
()
const
;
int
getStride
()
const
;
virtual
void
flip
(
void
*
source
,
bool
HDR
)
=
0
;
virtual
void
flip
(
void
*
source
,
Format
format
)
=
0
;
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
)
=
0
;
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
)
=
0
;
virtual
void
*
lock
()
=
0
;
virtual
void
*
lock
()
=
0
;
virtual
void
unlock
()
=
0
;
virtual
void
unlock
()
=
0
;
...
@@ -55,13 +55,13 @@ namespace sw
...
@@ -55,13 +55,13 @@ namespace sw
static
Routine
*
copyRoutine
(
const
BlitState
&
state
);
static
Routine
*
copyRoutine
(
const
BlitState
&
state
);
protected
:
protected
:
void
copy
(
void
*
source
,
bool
HDR
);
void
copy
(
void
*
source
,
Format
format
);
int
width
;
int
width
;
int
height
;
int
height
;
Format
sourceFormat
;
Format
destFormat
;
int
stride
;
int
stride
;
int
bitDepth
;
bool
HDRdisplay
;
bool
windowed
;
bool
windowed
;
void
*
locked
;
// Video memory back buffer
void
*
locked
;
// Video memory back buffer
...
...
src/Main/FrameBufferDD.cpp
View file @
10219e72
...
@@ -100,9 +100,16 @@ namespace sw
...
@@ -100,9 +100,16 @@ namespace sw
long
result
=
directDraw
->
CreateSurface
(
&
ddsd
,
&
frontBuffer
,
0
);
long
result
=
directDraw
->
CreateSurface
(
&
ddsd
,
&
frontBuffer
,
0
);
directDraw
->
GetDisplayMode
(
&
ddsd
);
directDraw
->
GetDisplayMode
(
&
ddsd
);
bitDepth
=
ddsd
.
ddpfPixelFormat
.
dwRGBBitCount
;
switch
(
ddsd
.
ddpfPixelFormat
.
dwRGBBitCount
)
{
case
32
:
destFormat
=
FORMAT_X8R8G8B8
;
break
;
case
24
:
destFormat
=
FORMAT_R8G8B8
;
break
;
case
16
:
destFormat
=
FORMAT_R5G6B5
;
break
;
default
:
destFormat
=
FORMAT_NULL
;
break
;
}
if
((
result
!=
DD_OK
&&
result
!=
DDERR_PRIMARYSURFACEALREADYEXISTS
)
||
(
bitDepth
!=
32
&&
bitDepth
!=
24
&&
bitDepth
!=
16
))
if
((
result
!=
DD_OK
&&
result
!=
DDERR_PRIMARYSURFACEALREADYEXISTS
)
||
(
destFormat
==
FORMAT_NULL
))
{
{
assert
(
!
"Failed to initialize graphics: Incompatible display mode."
);
assert
(
!
"Failed to initialize graphics: Incompatible display mode."
);
}
}
...
@@ -196,18 +203,18 @@ namespace sw
...
@@ -196,18 +203,18 @@ namespace sw
do
do
{
{
bitDepth
=
32
;
destFormat
=
FORMAT_X8R8G8B8
;
result
=
directDraw
->
SetDisplayMode
(
width
,
height
,
bitDepth
);
result
=
directDraw
->
SetDisplayMode
(
width
,
height
,
32
);
if
(
result
==
DDERR_INVALIDMODE
)
if
(
result
==
DDERR_INVALIDMODE
)
{
{
bitDepth
=
16
;
destFormat
=
FORMAT_R8G8B8
;
result
=
directDraw
->
SetDisplayMode
(
width
,
height
,
bitDepth
);
result
=
directDraw
->
SetDisplayMode
(
width
,
height
,
24
);
if
(
result
==
DDERR_INVALIDMODE
)
if
(
result
==
DDERR_INVALIDMODE
)
{
{
bitDepth
=
24
;
destFormat
=
FORMAT_R5G6B5
;
result
=
directDraw
->
SetDisplayMode
(
width
,
height
,
bitDepth
);
result
=
directDraw
->
SetDisplayMode
(
width
,
height
,
16
);
if
(
result
==
DDERR_INVALIDMODE
)
if
(
result
==
DDERR_INVALIDMODE
)
{
{
...
@@ -240,9 +247,9 @@ namespace sw
...
@@ -240,9 +247,9 @@ namespace sw
updateBounds
(
windowHandle
);
updateBounds
(
windowHandle
);
}
}
void
FrameBufferDD
::
flip
(
void
*
source
,
bool
HDR
)
void
FrameBufferDD
::
flip
(
void
*
source
,
Format
format
)
{
{
copy
(
source
,
HDR
);
copy
(
source
,
format
);
if
(
!
readySurfaces
())
if
(
!
readySurfaces
())
{
{
...
@@ -271,9 +278,9 @@ namespace sw
...
@@ -271,9 +278,9 @@ namespace sw
}
}
}
}
void
FrameBufferDD
::
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
)
void
FrameBufferDD
::
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
)
{
{
copy
(
source
,
HDR
);
copy
(
source
,
format
);
if
(
!
readySurfaces
())
if
(
!
readySurfaces
())
{
{
...
@@ -310,20 +317,20 @@ namespace sw
...
@@ -310,20 +317,20 @@ namespace sw
}
}
}
}
void
FrameBufferDD
::
flip
(
HWND
windowOverride
,
void
*
source
,
bool
HDR
)
void
FrameBufferDD
::
flip
(
HWND
windowOverride
,
void
*
source
,
Format
format
)
{
{
updateClipper
(
windowOverride
);
updateClipper
(
windowOverride
);
updateBounds
(
windowOverride
);
updateBounds
(
windowOverride
);
flip
(
source
,
HDR
);
flip
(
source
,
format
);
}
}
void
FrameBufferDD
::
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
)
void
FrameBufferDD
::
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
)
{
{
updateClipper
(
windowOverride
);
updateClipper
(
windowOverride
);
updateBounds
(
windowOverride
);
updateBounds
(
windowOverride
);
blit
(
source
,
sourceRect
,
destRect
,
HDR
);
blit
(
source
,
sourceRect
,
destRect
,
format
);
}
}
void
FrameBufferDD
::
screenshot
(
void
*
destBuffer
)
void
FrameBufferDD
::
screenshot
(
void
*
destBuffer
)
...
...
src/Main/FrameBufferDD.hpp
View file @
10219e72
...
@@ -25,11 +25,11 @@ namespace sw
...
@@ -25,11 +25,11 @@ namespace sw
virtual
~
FrameBufferDD
();
virtual
~
FrameBufferDD
();
virtual
void
flip
(
void
*
source
,
bool
HDR
);
virtual
void
flip
(
void
*
source
,
Format
format
);
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
);
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
);
virtual
void
flip
(
HWND
windowOverride
,
void
*
source
,
bool
HDR
);
virtual
void
flip
(
HWND
windowOverride
,
void
*
source
,
Format
format
);
virtual
void
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
);
virtual
void
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
);
virtual
void
*
lock
();
virtual
void
*
lock
();
virtual
void
unlock
();
virtual
void
unlock
();
...
...
src/Main/FrameBufferGDI.cpp
View file @
10219e72
...
@@ -34,7 +34,7 @@ namespace sw
...
@@ -34,7 +34,7 @@ namespace sw
init
(
this
->
windowHandle
);
init
(
this
->
windowHandle
);
bitDepth
=
32
;
destFormat
=
FORMAT_X8R8G8B8
;
}
}
FrameBufferGDI
::~
FrameBufferGDI
()
FrameBufferGDI
::~
FrameBufferGDI
()
...
@@ -68,14 +68,14 @@ namespace sw
...
@@ -68,14 +68,14 @@ namespace sw
{
{
}
}
void
FrameBufferGDI
::
flip
(
void
*
source
,
bool
HDR
)
void
FrameBufferGDI
::
flip
(
void
*
source
,
Format
format
)
{
{
blit
(
source
,
0
,
0
,
HDR
);
blit
(
source
,
0
,
0
,
format
);
}
}
void
FrameBufferGDI
::
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
)
void
FrameBufferGDI
::
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
)
{
{
copy
(
source
,
HDR
);
copy
(
source
,
format
);
int
sourceLeft
=
sourceRect
?
sourceRect
->
x0
:
0
;
int
sourceLeft
=
sourceRect
?
sourceRect
->
x0
:
0
;
int
sourceTop
=
sourceRect
?
sourceRect
->
y0
:
0
;
int
sourceTop
=
sourceRect
?
sourceRect
->
y0
:
0
;
...
@@ -89,12 +89,12 @@ namespace sw
...
@@ -89,12 +89,12 @@ namespace sw
StretchBlt
(
windowContext
,
destLeft
,
destTop
,
destWidth
,
destHeight
,
bitmapContext
,
sourceLeft
,
sourceTop
,
sourceWidth
,
sourceHeight
,
SRCCOPY
);
StretchBlt
(
windowContext
,
destLeft
,
destTop
,
destWidth
,
destHeight
,
bitmapContext
,
sourceLeft
,
sourceTop
,
sourceWidth
,
sourceHeight
,
SRCCOPY
);
}
}
void
FrameBufferGDI
::
flip
(
HWND
windowOverride
,
void
*
source
,
bool
HDR
)
void
FrameBufferGDI
::
flip
(
HWND
windowOverride
,
void
*
source
,
Format
format
)
{
{
blit
(
windowOverride
,
source
,
0
,
0
,
HDR
);
blit
(
windowOverride
,
source
,
0
,
0
,
format
);
}
}
void
FrameBufferGDI
::
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
)
void
FrameBufferGDI
::
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
)
{
{
if
(
windowed
&&
windowOverride
!=
0
&&
windowOverride
!=
bitmapWindow
)
if
(
windowed
&&
windowOverride
!=
0
&&
windowOverride
!=
bitmapWindow
)
{
{
...
@@ -102,7 +102,7 @@ namespace sw
...
@@ -102,7 +102,7 @@ namespace sw
init
(
windowOverride
);
init
(
windowOverride
);
}
}
blit
(
source
,
sourceRect
,
destRect
,
HDR
);
blit
(
source
,
sourceRect
,
destRect
,
format
);
}
}
void
FrameBufferGDI
::
setGammaRamp
(
GammaRamp
*
gammaRamp
,
bool
calibrate
)
void
FrameBufferGDI
::
setGammaRamp
(
GammaRamp
*
gammaRamp
,
bool
calibrate
)
...
...
src/Main/FrameBufferGDI.hpp
View file @
10219e72
...
@@ -23,11 +23,11 @@ namespace sw
...
@@ -23,11 +23,11 @@ namespace sw
virtual
~
FrameBufferGDI
();
virtual
~
FrameBufferGDI
();
virtual
void
flip
(
void
*
source
,
bool
HDR
);
virtual
void
flip
(
void
*
source
,
Format
format
);
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
);
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
);
virtual
void
flip
(
HWND
windowOverride
,
void
*
source
,
bool
HDR
);
virtual
void
flip
(
HWND
windowOverride
,
void
*
source
,
Format
format
);
virtual
void
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
);
virtual
void
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
);
virtual
void
*
lock
();
virtual
void
*
lock
();
virtual
void
unlock
();
virtual
void
unlock
();
...
...
src/Main/FrameBufferWin.hpp
View file @
10219e72
...
@@ -30,11 +30,11 @@ namespace sw
...
@@ -30,11 +30,11 @@ namespace sw
virtual
~
FrameBufferWin
();
virtual
~
FrameBufferWin
();
virtual
void
flip
(
void
*
source
,
bool
HDR
)
=
0
;
virtual
void
flip
(
void
*
source
,
Format
format
)
=
0
;
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
)
=
0
;
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
)
=
0
;
virtual
void
flip
(
HWND
windowOverride
,
void
*
source
,
bool
HDR
)
=
0
;
virtual
void
flip
(
HWND
windowOverride
,
void
*
source
,
Format
format
)
=
0
;
virtual
void
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
)
=
0
;
virtual
void
blit
(
HWND
windowOverride
,
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
)
=
0
;
virtual
void
*
lock
()
=
0
;
virtual
void
*
lock
()
=
0
;
virtual
void
unlock
()
=
0
;
virtual
void
unlock
()
=
0
;
...
@@ -54,8 +54,8 @@ namespace sw
...
@@ -54,8 +54,8 @@ namespace sw
};
};
}
}
extern
"C"
extern
"C"
{
{
sw
::
FrameBufferWin
*
createFrameBufferWin
(
HWND
windowHandle
,
int
width
,
int
height
,
bool
fullscreen
,
bool
topLeftOrigin
);
sw
::
FrameBufferWin
*
createFrameBufferWin
(
HWND
windowHandle
,
int
width
,
int
height
,
bool
fullscreen
,
bool
topLeftOrigin
);
}
}
...
...
src/Main/FrameBufferX11.cpp
View file @
10219e72
...
@@ -121,9 +121,9 @@ namespace sw
...
@@ -121,9 +121,9 @@ namespace sw
locked
=
0
;
locked
=
0
;
}
}
void
FrameBufferX11
::
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
)
void
FrameBufferX11
::
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
)
{
{
copy
(
source
,
HDR
);
copy
(
source
,
format
);
if
(
!
mit_shm
)
if
(
!
mit_shm
)
{
{
...
...
src/Main/FrameBufferX11.hpp
View file @
10219e72
...
@@ -32,8 +32,8 @@ namespace sw
...
@@ -32,8 +32,8 @@ namespace sw
~
FrameBufferX11
();
~
FrameBufferX11
();
virtual
void
flip
(
void
*
source
,
bool
HDR
)
{
blit
(
source
,
0
,
0
,
false
);};
virtual
void
flip
(
void
*
source
,
Format
format
)
{
blit
(
source
,
0
,
0
,
format
);};
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
bool
HDR
);
virtual
void
blit
(
void
*
source
,
const
Rect
*
sourceRect
,
const
Rect
*
destRect
,
Format
format
);
virtual
void
*
lock
();
virtual
void
*
lock
();
virtual
void
unlock
();
virtual
void
unlock
();
...
...
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