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
8cdc21c2
Commit
8cdc21c2
authored
Sep 09, 2013
by
Geoff Lang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Image11::map now takes a parameter to specify if the mapping is for reading or writing.
ANGLEBUG=470 R=shannonwoods@chromium.org Review URL:
https://codereview.appspot.com/13253044
parent
0bd6d117
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
Image11.cpp
src/libGLESv2/renderer/Image11.cpp
+9
-9
Image11.h
src/libGLESv2/renderer/Image11.h
+1
-1
No files found.
src/libGLESv2/renderer/Image11.cpp
View file @
8cdc21c2
...
@@ -50,8 +50,8 @@ void Image11::generateMipmap(Image11 *dest, Image11 *src)
...
@@ -50,8 +50,8 @@ void Image11::generateMipmap(Image11 *dest, Image11 *src)
ASSERT
(
src
->
getHeight
()
==
1
||
src
->
getHeight
()
/
2
==
dest
->
getHeight
());
ASSERT
(
src
->
getHeight
()
==
1
||
src
->
getHeight
()
/
2
==
dest
->
getHeight
());
D3D11_MAPPED_SUBRESOURCE
destMapped
,
srcMapped
;
D3D11_MAPPED_SUBRESOURCE
destMapped
,
srcMapped
;
dest
->
map
(
&
destMapped
);
dest
->
map
(
D3D11_MAP_WRITE
,
&
destMapped
);
src
->
map
(
&
srcMapped
);
src
->
map
(
D3D11_MAP_READ
,
&
srcMapped
);
const
unsigned
char
*
sourceData
=
reinterpret_cast
<
const
unsigned
char
*>
(
srcMapped
.
pData
);
const
unsigned
char
*
sourceData
=
reinterpret_cast
<
const
unsigned
char
*>
(
srcMapped
.
pData
);
unsigned
char
*
destData
=
reinterpret_cast
<
unsigned
char
*>
(
destMapped
.
pData
);
unsigned
char
*
destData
=
reinterpret_cast
<
unsigned
char
*>
(
destMapped
.
pData
);
...
@@ -171,7 +171,7 @@ void Image11::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
...
@@ -171,7 +171,7 @@ void Image11::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
GLint
unpackAlignment
,
const
void
*
input
)
GLint
unpackAlignment
,
const
void
*
input
)
{
{
D3D11_MAPPED_SUBRESOURCE
mappedImage
;
D3D11_MAPPED_SUBRESOURCE
mappedImage
;
HRESULT
result
=
map
(
&
mappedImage
);
HRESULT
result
=
map
(
D3D11_MAP_WRITE
,
&
mappedImage
);
if
(
FAILED
(
result
))
if
(
FAILED
(
result
))
{
{
ERR
(
"Could not map image for loading."
);
ERR
(
"Could not map image for loading."
);
...
@@ -254,7 +254,7 @@ void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GL
...
@@ -254,7 +254,7 @@ void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GL
ASSERT
(
yoffset
%
4
==
0
);
ASSERT
(
yoffset
%
4
==
0
);
D3D11_MAPPED_SUBRESOURCE
mappedImage
;
D3D11_MAPPED_SUBRESOURCE
mappedImage
;
HRESULT
result
=
map
(
&
mappedImage
);
HRESULT
result
=
map
(
D3D11_MAP_WRITE
,
&
mappedImage
);
if
(
FAILED
(
result
))
if
(
FAILED
(
result
))
{
{
ERR
(
"Could not map image for loading."
);
ERR
(
"Could not map image for loading."
);
...
@@ -344,8 +344,8 @@ void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width
...
@@ -344,8 +344,8 @@ void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width
{
{
// This format requires conversion, so we must copy the texture to staging and manually convert via readPixels
// This format requires conversion, so we must copy the texture to staging and manually convert via readPixels
D3D11_MAPPED_SUBRESOURCE
mappedImage
;
D3D11_MAPPED_SUBRESOURCE
mappedImage
;
HRESULT
result
=
map
(
&
mappedImage
);
HRESULT
result
=
map
(
D3D11_MAP_WRITE
,
&
mappedImage
);
// determine the offset coordinate into the destination buffer
// determine the offset coordinate into the destination buffer
GLsizei
rowOffset
=
gl
::
ComputePixelSize
(
mActualFormat
)
*
xoffset
;
GLsizei
rowOffset
=
gl
::
ComputePixelSize
(
mActualFormat
)
*
xoffset
;
void
*
dataOffset
=
static_cast
<
unsigned
char
*>
(
mappedImage
.
pData
)
+
mappedImage
.
RowPitch
*
yoffset
+
rowOffset
;
void
*
dataOffset
=
static_cast
<
unsigned
char
*>
(
mappedImage
.
pData
)
+
mappedImage
.
RowPitch
*
yoffset
+
rowOffset
;
...
@@ -402,7 +402,7 @@ void Image11::createStagingTexture()
...
@@ -402,7 +402,7 @@ void Image11::createStagingTexture()
desc
.
SampleDesc
.
Quality
=
0
;
desc
.
SampleDesc
.
Quality
=
0
;
desc
.
Usage
=
D3D11_USAGE_STAGING
;
desc
.
Usage
=
D3D11_USAGE_STAGING
;
desc
.
BindFlags
=
0
;
desc
.
BindFlags
=
0
;
desc
.
CPUAccessFlags
=
D3D11_CPU_ACCESS_WRITE
;
desc
.
CPUAccessFlags
=
D3D11_CPU_ACCESS_
READ
|
D3D11_CPU_ACCESS_
WRITE
;
desc
.
MiscFlags
=
0
;
desc
.
MiscFlags
=
0
;
HRESULT
result
=
device
->
CreateTexture2D
(
&
desc
,
NULL
,
&
newTexture
);
HRESULT
result
=
device
->
CreateTexture2D
(
&
desc
,
NULL
,
&
newTexture
);
...
@@ -420,7 +420,7 @@ void Image11::createStagingTexture()
...
@@ -420,7 +420,7 @@ void Image11::createStagingTexture()
mDirty
=
false
;
mDirty
=
false
;
}
}
HRESULT
Image11
::
map
(
D3D11_MAPPED_SUBRESOURCE
*
map
)
HRESULT
Image11
::
map
(
D3D11_MAP
mapType
,
D3D11_MAP
PED_SUBRESOURCE
*
map
)
{
{
createStagingTexture
();
createStagingTexture
();
...
@@ -429,7 +429,7 @@ HRESULT Image11::map(D3D11_MAPPED_SUBRESOURCE *map)
...
@@ -429,7 +429,7 @@ HRESULT Image11::map(D3D11_MAPPED_SUBRESOURCE *map)
if
(
mStagingTexture
)
if
(
mStagingTexture
)
{
{
ID3D11DeviceContext
*
deviceContext
=
mRenderer
->
getDeviceContext
();
ID3D11DeviceContext
*
deviceContext
=
mRenderer
->
getDeviceContext
();
result
=
deviceContext
->
Map
(
mStagingTexture
,
mStagingSubresource
,
D3D11_MAP_WRITE
,
0
,
map
);
result
=
deviceContext
->
Map
(
mStagingTexture
,
mStagingSubresource
,
mapType
,
0
,
map
);
// this can fail if the device is removed (from TDR)
// this can fail if the device is removed (from TDR)
if
(
d3d11
::
isDeviceLostError
(
result
))
if
(
d3d11
::
isDeviceLostError
(
result
))
...
...
src/libGLESv2/renderer/Image11.h
View file @
8cdc21c2
...
@@ -54,7 +54,7 @@ class Image11 : public Image
...
@@ -54,7 +54,7 @@ class Image11 : public Image
virtual
void
copy
(
GLint
xoffset
,
GLint
yoffset
,
GLint
x
,
GLint
y
,
GLsizei
width
,
GLsizei
height
,
gl
::
Framebuffer
*
source
);
virtual
void
copy
(
GLint
xoffset
,
GLint
yoffset
,
GLint
x
,
GLint
y
,
GLsizei
width
,
GLsizei
height
,
gl
::
Framebuffer
*
source
);
protected
:
protected
:
HRESULT
map
(
D3D11_MAPPED_SUBRESOURCE
*
map
);
HRESULT
map
(
D3D11_MAP
mapType
,
D3D11_MAP
PED_SUBRESOURCE
*
map
);
void
unmap
();
void
unmap
();
private
:
private
:
...
...
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