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
d8c86138
Commit
d8c86138
authored
Jun 12, 2013
by
Geoff Lang
Committed by
Shannon Woods
Jul 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added depth stencil format info to format utils 11.
TRAC #23321 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang
parent
685806d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
131 additions
and
0 deletions
+131
-0
formatutils11.cpp
src/libGLESv2/renderer/formatutils11.cpp
+126
-0
formatutils11.h
src/libGLESv2/renderer/formatutils11.h
+5
-0
No files found.
src/libGLESv2/renderer/formatutils11.cpp
View file @
d8c86138
...
...
@@ -592,6 +592,72 @@ static D3D11FastCopyMap BuildFastCopyMap()
return
map
;
}
struct
DXGIDepthStencilInfo
{
unsigned
int
mDepthBits
;
unsigned
int
mDepthOffset
;
unsigned
int
mStencilBits
;
unsigned
int
mStencilOffset
;
DXGIDepthStencilInfo
()
:
mDepthBits
(
0
),
mDepthOffset
(
0
),
mStencilBits
(
0
),
mStencilOffset
(
0
)
{
}
DXGIDepthStencilInfo
(
unsigned
int
depthBits
,
unsigned
int
depthOffset
,
unsigned
int
stencilBits
,
unsigned
int
stencilOffset
)
:
mDepthBits
(
depthBits
),
mDepthOffset
(
depthOffset
),
mStencilBits
(
stencilBits
),
mStencilOffset
(
stencilOffset
)
{
}
};
typedef
std
::
map
<
DXGI_FORMAT
,
DXGIDepthStencilInfo
>
DepthStencilInfoMap
;
typedef
std
::
pair
<
DXGI_FORMAT
,
DXGIDepthStencilInfo
>
DepthStencilInfoPair
;
static
DepthStencilInfoMap
BuildDepthStencilInfoMap
()
{
DepthStencilInfoMap
map
;
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_R16_TYPELESS
,
DXGIDepthStencilInfo
(
16
,
0
,
0
,
0
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_R16_UNORM
,
DXGIDepthStencilInfo
(
16
,
0
,
0
,
0
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_D16_UNORM
,
DXGIDepthStencilInfo
(
16
,
0
,
0
,
0
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_R24G8_TYPELESS
,
DXGIDepthStencilInfo
(
24
,
0
,
8
,
24
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_R24_UNORM_X8_TYPELESS
,
DXGIDepthStencilInfo
(
24
,
0
,
8
,
24
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_D24_UNORM_S8_UINT
,
DXGIDepthStencilInfo
(
24
,
0
,
8
,
24
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_R32_TYPELESS
,
DXGIDepthStencilInfo
(
32
,
0
,
0
,
0
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_R32_FLOAT
,
DXGIDepthStencilInfo
(
32
,
0
,
0
,
0
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_D32_FLOAT
,
DXGIDepthStencilInfo
(
32
,
0
,
0
,
0
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_R32G8X24_TYPELESS
,
DXGIDepthStencilInfo
(
32
,
0
,
8
,
32
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
,
DXGIDepthStencilInfo
(
32
,
0
,
8
,
32
)));
map
.
insert
(
DepthStencilInfoPair
(
DXGI_FORMAT_D32_FLOAT_S8X24_UINT
,
DXGIDepthStencilInfo
(
32
,
0
,
8
,
32
)));
return
map
;
}
static
const
DepthStencilInfoMap
&
GetDepthStencilInfoMap
()
{
static
const
DepthStencilInfoMap
infoMap
=
BuildDepthStencilInfoMap
();
return
infoMap
;
}
bool
GetDepthStencilInfo
(
DXGI_FORMAT
format
,
DXGIDepthStencilInfo
*
outDepthStencilInfo
)
{
const
DepthStencilInfoMap
&
infoMap
=
GetDepthStencilInfoMap
();
DepthStencilInfoMap
::
const_iterator
iter
=
infoMap
.
find
(
format
);
if
(
iter
!=
infoMap
.
end
())
{
if
(
outDepthStencilInfo
)
{
*
outDepthStencilInfo
=
iter
->
second
;
}
return
true
;
}
else
{
return
false
;
}
}
namespace
d3d11
{
...
...
@@ -687,6 +753,66 @@ GLuint GetBlockHeight(DXGI_FORMAT format)
}
}
GLuint
GetDepthBits
(
DXGI_FORMAT
format
)
{
DXGIDepthStencilInfo
dxgiDSInfo
;
if
(
GetDepthStencilInfo
(
format
,
&
dxgiDSInfo
))
{
return
dxgiDSInfo
.
mDepthBits
;
}
else
{
// Since the depth stencil info map does not contain all used DXGI formats,
// we should not assert that the format exists
return
0
;
}
}
GLuint
GetDepthOffset
(
DXGI_FORMAT
format
)
{
DXGIDepthStencilInfo
dxgiDSInfo
;
if
(
GetDepthStencilInfo
(
format
,
&
dxgiDSInfo
))
{
return
dxgiDSInfo
.
mDepthOffset
;
}
else
{
// Since the depth stencil info map does not contain all used DXGI formats,
// we should not assert that the format exists
return
0
;
}
}
GLuint
GetStencilBits
(
DXGI_FORMAT
format
)
{
DXGIDepthStencilInfo
dxgiDSInfo
;
if
(
GetDepthStencilInfo
(
format
,
&
dxgiDSInfo
))
{
return
dxgiDSInfo
.
mStencilBits
;
}
else
{
// Since the depth stencil info map does not contain all used DXGI formats,
// we should not assert that the format exists
return
0
;
}
}
GLuint
GetStencilOffset
(
DXGI_FORMAT
format
)
{
DXGIDepthStencilInfo
dxgiDSInfo
;
if
(
GetDepthStencilInfo
(
format
,
&
dxgiDSInfo
))
{
return
dxgiDSInfo
.
mStencilOffset
;
}
else
{
// Since the depth stencil info map does not contain all used DXGI formats,
// we should not assert that the format exists
return
0
;
}
}
void
MakeValidSize
(
bool
isImage
,
DXGI_FORMAT
format
,
GLsizei
*
requestWidth
,
GLsizei
*
requestHeight
,
int
*
levelOffset
)
{
DXGIFormatInfo
dxgiFormatInfo
;
...
...
src/libGLESv2/renderer/formatutils11.h
View file @
d8c86138
...
...
@@ -27,6 +27,11 @@ GLuint GetFormatPixelBytes(DXGI_FORMAT format);
GLuint
GetBlockWidth
(
DXGI_FORMAT
format
);
GLuint
GetBlockHeight
(
DXGI_FORMAT
format
);
GLuint
GetDepthBits
(
DXGI_FORMAT
format
);
GLuint
GetDepthOffset
(
DXGI_FORMAT
format
);
GLuint
GetStencilBits
(
DXGI_FORMAT
format
);
GLuint
GetStencilOffset
(
DXGI_FORMAT
format
);
void
MakeValidSize
(
bool
isImage
,
DXGI_FORMAT
format
,
GLsizei
*
requestWidth
,
GLsizei
*
requestHeight
,
int
*
levelOffset
);
const
DXGIFormatSet
&
GetAllUsedDXGIFormats
();
...
...
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