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
88f9cbf2
Commit
88f9cbf2
authored
Oct 18, 2013
by
Geoff Lang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SwapChain11 now stores a SRV of it's depth stencil.
TRAC #24025 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods
parent
d9b9a508
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
7 deletions
+34
-7
Renderer11.cpp
src/libGLESv2/renderer/d3d11/Renderer11.cpp
+2
-1
SwapChain11.cpp
src/libGLESv2/renderer/d3d11/SwapChain11.cpp
+30
-6
SwapChain11.h
src/libGLESv2/renderer/d3d11/SwapChain11.h
+2
-0
No files found.
src/libGLESv2/renderer/d3d11/Renderer11.cpp
View file @
88f9cbf2
...
@@ -2657,7 +2657,8 @@ RenderTarget *Renderer11::createRenderTarget(SwapChain *swapChain, bool depth)
...
@@ -2657,7 +2657,8 @@ RenderTarget *Renderer11::createRenderTarget(SwapChain *swapChain, bool depth)
{
{
// Note: depth stencil may be NULL for 0 sized surfaces
// Note: depth stencil may be NULL for 0 sized surfaces
renderTarget
=
new
RenderTarget11
(
this
,
swapChain11
->
getDepthStencil
(),
renderTarget
=
new
RenderTarget11
(
this
,
swapChain11
->
getDepthStencil
(),
swapChain11
->
getDepthStencilTexture
(),
NULL
,
swapChain11
->
getDepthStencilTexture
(),
swapChain11
->
getDepthStencilShaderResource
(),
swapChain11
->
getWidth
(),
swapChain11
->
getHeight
(),
1
);
swapChain11
->
getWidth
(),
swapChain11
->
getHeight
(),
1
);
}
}
else
else
...
...
src/libGLESv2/renderer/d3d11/SwapChain11.cpp
View file @
88f9cbf2
...
@@ -30,6 +30,7 @@ SwapChain11::SwapChain11(Renderer11 *renderer, HWND window, HANDLE shareHandle,
...
@@ -30,6 +30,7 @@ SwapChain11::SwapChain11(Renderer11 *renderer, HWND window, HANDLE shareHandle,
mOffscreenSRView
=
NULL
;
mOffscreenSRView
=
NULL
;
mDepthStencilTexture
=
NULL
;
mDepthStencilTexture
=
NULL
;
mDepthStencilDSView
=
NULL
;
mDepthStencilDSView
=
NULL
;
mDepthStencilSRView
=
NULL
;
mQuadVB
=
NULL
;
mQuadVB
=
NULL
;
mPassThroughSampler
=
NULL
;
mPassThroughSampler
=
NULL
;
mPassThroughIL
=
NULL
;
mPassThroughIL
=
NULL
;
...
@@ -57,6 +58,7 @@ void SwapChain11::release()
...
@@ -57,6 +58,7 @@ void SwapChain11::release()
SafeRelease
(
mOffscreenSRView
);
SafeRelease
(
mOffscreenSRView
);
SafeRelease
(
mDepthStencilTexture
);
SafeRelease
(
mDepthStencilTexture
);
SafeRelease
(
mDepthStencilDSView
);
SafeRelease
(
mDepthStencilDSView
);
SafeRelease
(
mDepthStencilSRView
);
SafeRelease
(
mQuadVB
);
SafeRelease
(
mQuadVB
);
SafeRelease
(
mPassThroughSampler
);
SafeRelease
(
mPassThroughSampler
);
SafeRelease
(
mPassThroughIL
);
SafeRelease
(
mPassThroughIL
);
...
@@ -172,7 +174,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
...
@@ -172,7 +174,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
}
}
}
}
d3d11
::
SetDebugName
(
mOffscreenTexture
,
"Offscreen texture"
);
d3d11
::
SetDebugName
(
mOffscreenTexture
,
"Offscreen
back buffer
texture"
);
// EGL_ANGLE_surface_d3d_texture_2d_share_handle requires that we store a share handle for the client
// EGL_ANGLE_surface_d3d_texture_2d_share_handle requires that we store a share handle for the client
if
(
useSharedResource
)
if
(
useSharedResource
)
...
@@ -207,7 +209,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
...
@@ -207,7 +209,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
HRESULT
result
=
device
->
CreateRenderTargetView
(
mOffscreenTexture
,
&
offscreenRTVDesc
,
&
mOffscreenRTView
);
HRESULT
result
=
device
->
CreateRenderTargetView
(
mOffscreenTexture
,
&
offscreenRTVDesc
,
&
mOffscreenRTView
);
ASSERT
(
SUCCEEDED
(
result
));
ASSERT
(
SUCCEEDED
(
result
));
d3d11
::
SetDebugName
(
mOffscreenRTView
,
"Offscreen render target"
);
d3d11
::
SetDebugName
(
mOffscreenRTView
,
"Offscreen
back buffer
render target"
);
D3D11_SHADER_RESOURCE_VIEW_DESC
offscreenSRVDesc
;
D3D11_SHADER_RESOURCE_VIEW_DESC
offscreenSRVDesc
;
offscreenSRVDesc
.
Format
=
gl_d3d11
::
GetSRVFormat
(
mBackBufferFormat
,
mRenderer
->
getCurrentClientVersion
());
offscreenSRVDesc
.
Format
=
gl_d3d11
::
GetSRVFormat
(
mBackBufferFormat
,
mRenderer
->
getCurrentClientVersion
());
...
@@ -217,7 +219,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
...
@@ -217,7 +219,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
result
=
device
->
CreateShaderResourceView
(
mOffscreenTexture
,
&
offscreenSRVDesc
,
&
mOffscreenSRView
);
result
=
device
->
CreateShaderResourceView
(
mOffscreenTexture
,
&
offscreenSRVDesc
,
&
mOffscreenSRView
);
ASSERT
(
SUCCEEDED
(
result
));
ASSERT
(
SUCCEEDED
(
result
));
d3d11
::
SetDebugName
(
mOffscreenSRView
,
"Offscreen shader resource"
);
d3d11
::
SetDebugName
(
mOffscreenSRView
,
"Offscreen
back buffer
shader resource"
);
if
(
mDepthBufferFormat
!=
GL_NONE
)
if
(
mDepthBufferFormat
!=
GL_NONE
)
{
{
...
@@ -230,7 +232,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
...
@@ -230,7 +232,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
depthStencilTextureDesc
.
SampleDesc
.
Count
=
1
;
depthStencilTextureDesc
.
SampleDesc
.
Count
=
1
;
depthStencilTextureDesc
.
SampleDesc
.
Quality
=
0
;
depthStencilTextureDesc
.
SampleDesc
.
Quality
=
0
;
depthStencilTextureDesc
.
Usage
=
D3D11_USAGE_DEFAULT
;
depthStencilTextureDesc
.
Usage
=
D3D11_USAGE_DEFAULT
;
depthStencilTextureDesc
.
BindFlags
=
D3D11_BIND_DEPTH_STENCIL
;
depthStencilTextureDesc
.
BindFlags
=
D3D11_BIND_DEPTH_STENCIL
|
D3D11_BIND_SHADER_RESOURCE
;
depthStencilTextureDesc
.
CPUAccessFlags
=
0
;
depthStencilTextureDesc
.
CPUAccessFlags
=
0
;
depthStencilTextureDesc
.
MiscFlags
=
0
;
depthStencilTextureDesc
.
MiscFlags
=
0
;
...
@@ -249,7 +251,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
...
@@ -249,7 +251,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
return
EGL_BAD_ALLOC
;
return
EGL_BAD_ALLOC
;
}
}
}
}
d3d11
::
SetDebugName
(
mDepthStencilTexture
,
"
D
epth stencil texture"
);
d3d11
::
SetDebugName
(
mDepthStencilTexture
,
"
Offscreen d
epth stencil texture"
);
D3D11_DEPTH_STENCIL_VIEW_DESC
depthStencilDesc
;
D3D11_DEPTH_STENCIL_VIEW_DESC
depthStencilDesc
;
depthStencilDesc
.
Format
=
gl_d3d11
::
GetDSVFormat
(
mDepthBufferFormat
,
mRenderer
->
getCurrentClientVersion
());
depthStencilDesc
.
Format
=
gl_d3d11
::
GetDSVFormat
(
mDepthBufferFormat
,
mRenderer
->
getCurrentClientVersion
());
...
@@ -259,7 +261,17 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
...
@@ -259,7 +261,17 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
result
=
device
->
CreateDepthStencilView
(
mDepthStencilTexture
,
&
depthStencilDesc
,
&
mDepthStencilDSView
);
result
=
device
->
CreateDepthStencilView
(
mDepthStencilTexture
,
&
depthStencilDesc
,
&
mDepthStencilDSView
);
ASSERT
(
SUCCEEDED
(
result
));
ASSERT
(
SUCCEEDED
(
result
));
d3d11
::
SetDebugName
(
mDepthStencilDSView
,
"Depth stencil view"
);
d3d11
::
SetDebugName
(
mDepthStencilDSView
,
"Offscreen depth stencil view"
);
D3D11_SHADER_RESOURCE_VIEW_DESC
depthStencilSRVDesc
;
depthStencilSRVDesc
.
Format
=
gl_d3d11
::
GetSRVFormat
(
mDepthBufferFormat
,
mRenderer
->
getCurrentClientVersion
());
depthStencilSRVDesc
.
ViewDimension
=
D3D11_SRV_DIMENSION_TEXTURE2D
;
depthStencilSRVDesc
.
Texture2D
.
MostDetailedMip
=
0
;
depthStencilSRVDesc
.
Texture2D
.
MipLevels
=
-
1
;
result
=
device
->
CreateShaderResourceView
(
mDepthStencilTexture
,
&
depthStencilSRVDesc
,
&
mDepthStencilSRView
);
ASSERT
(
SUCCEEDED
(
result
));
d3d11
::
SetDebugName
(
mDepthStencilSRView
,
"Offscreen depth stencil shader resource"
);
}
}
mWidth
=
backbufferWidth
;
mWidth
=
backbufferWidth
;
...
@@ -658,6 +670,18 @@ ID3D11DepthStencilView *SwapChain11::getDepthStencil()
...
@@ -658,6 +670,18 @@ ID3D11DepthStencilView *SwapChain11::getDepthStencil()
return
mDepthStencilDSView
;
return
mDepthStencilDSView
;
}
}
// Increments refcount on view.
// caller must Release() the returned view
ID3D11ShaderResourceView
*
SwapChain11
::
getDepthStencilShaderResource
()
{
if
(
mDepthStencilSRView
)
{
mDepthStencilSRView
->
AddRef
();
}
return
mDepthStencilSRView
;
}
ID3D11Texture2D
*
SwapChain11
::
getDepthStencilTexture
()
ID3D11Texture2D
*
SwapChain11
::
getDepthStencilTexture
()
{
{
if
(
mDepthStencilTexture
)
if
(
mDepthStencilTexture
)
...
...
src/libGLESv2/renderer/d3d11/SwapChain11.h
View file @
88f9cbf2
...
@@ -34,6 +34,7 @@ class SwapChain11 : public SwapChain
...
@@ -34,6 +34,7 @@ class SwapChain11 : public SwapChain
virtual
ID3D11Texture2D
*
getDepthStencilTexture
();
virtual
ID3D11Texture2D
*
getDepthStencilTexture
();
virtual
ID3D11DepthStencilView
*
getDepthStencil
();
virtual
ID3D11DepthStencilView
*
getDepthStencil
();
virtual
ID3D11ShaderResourceView
*
getDepthStencilShaderResource
();
EGLint
getWidth
()
const
{
return
mWidth
;
}
EGLint
getWidth
()
const
{
return
mWidth
;
}
EGLint
getHeight
()
const
{
return
mHeight
;
}
EGLint
getHeight
()
const
{
return
mHeight
;
}
...
@@ -66,6 +67,7 @@ class SwapChain11 : public SwapChain
...
@@ -66,6 +67,7 @@ class SwapChain11 : public SwapChain
ID3D11Texture2D
*
mDepthStencilTexture
;
ID3D11Texture2D
*
mDepthStencilTexture
;
ID3D11DepthStencilView
*
mDepthStencilDSView
;
ID3D11DepthStencilView
*
mDepthStencilDSView
;
ID3D11ShaderResourceView
*
mDepthStencilSRView
;
ID3D11Buffer
*
mQuadVB
;
ID3D11Buffer
*
mQuadVB
;
ID3D11SamplerState
*
mPassThroughSampler
;
ID3D11SamplerState
*
mPassThroughSampler
;
...
...
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