mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-25 07:56:33 +00:00
Add test that feature level 9.x programs can be captured on D3D11
This commit is contained in:
@@ -43,7 +43,7 @@ void main()
|
||||
|
||||
int main()
|
||||
{
|
||||
d3d11_1 = true;
|
||||
feature_level = D3D_FEATURE_LEVEL_11_1;
|
||||
|
||||
// initialise, create window, create device, etc
|
||||
if(!Init())
|
||||
|
||||
@@ -44,7 +44,7 @@ float4 main() : SV_Target0
|
||||
|
||||
int main()
|
||||
{
|
||||
d3d11_1 = true;
|
||||
feature_level = D3D_FEATURE_LEVEL_11_1;
|
||||
|
||||
// initialise, create window, create device, etc
|
||||
if(!Init())
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2020 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d11_test.h"
|
||||
|
||||
RD_TEST(D3D11_Feature_Level_9, D3D11GraphicsTest)
|
||||
{
|
||||
static constexpr const char *Description =
|
||||
"Tests drawing a simple triangle on feature level 9.1 to ensure it can be captured and "
|
||||
"replayed correctly.";
|
||||
|
||||
int main()
|
||||
{
|
||||
feature_level = D3D_FEATURE_LEVEL_9_1;
|
||||
|
||||
// initialise, create window, create device, etc
|
||||
if(!Init())
|
||||
return 3;
|
||||
|
||||
ID3DBlobPtr vsblob = Compile(D3DDefaultVertex, "main", "vs_4_0_level_9_1");
|
||||
ID3DBlobPtr psblob = Compile(D3DDefaultPixel, "main", "ps_4_0_level_9_1");
|
||||
|
||||
CreateDefaultInputLayout(vsblob);
|
||||
|
||||
ID3D11VertexShaderPtr vs = CreateVS(vsblob);
|
||||
ID3D11PixelShaderPtr ps = CreatePS(psblob);
|
||||
|
||||
ID3D11BufferPtr vb = MakeBuffer().Vertex().Data(DefaultTri);
|
||||
|
||||
while(Running())
|
||||
{
|
||||
ClearRenderTargetView(bbRTV, {0.2f, 0.2f, 0.2f, 1.0f});
|
||||
|
||||
IASetVertexBuffer(vb, sizeof(DefaultA2V), 0);
|
||||
ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
ctx->IASetInputLayout(defaultLayout);
|
||||
|
||||
ctx->VSSetShader(vs, NULL, 0);
|
||||
ctx->PSSetShader(ps, NULL, 0);
|
||||
|
||||
RSSetViewport({0.0f, 0.0f, (float)screenWidth, (float)screenHeight, 0.0f, 1.0f});
|
||||
|
||||
ctx->OMSetRenderTargets(1, &bbRTV.GetInterfacePtr(), NULL);
|
||||
|
||||
ctx->Draw(3, 0);
|
||||
|
||||
Present();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST();
|
||||
@@ -139,10 +139,7 @@ bool D3D11GraphicsTest::Init(IDXGIAdapterPtr pAdapter)
|
||||
if(!GraphicsTest::Init())
|
||||
return false;
|
||||
|
||||
D3D_FEATURE_LEVEL features[] = {D3D_FEATURE_LEVEL_11_0};
|
||||
|
||||
if(d3d11_1)
|
||||
features[0] = D3D_FEATURE_LEVEL_11_1;
|
||||
D3D_FEATURE_LEVEL features[] = {feature_level};
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
@@ -331,8 +328,11 @@ float4 main(float4 pos : SV_Position) : SV_Target0
|
||||
|
||||
)EOSHADER";
|
||||
|
||||
swapBlitVS = CreateVS(Compile(D3DFullscreenQuadVertex, "main", "vs_4_0"));
|
||||
swapBlitPS = CreatePS(Compile(blitPixel, "main", "ps_5_0"));
|
||||
if(feature_level >= D3D_FEATURE_LEVEL_10_0)
|
||||
{
|
||||
swapBlitVS = CreateVS(Compile(D3DFullscreenQuadVertex, "main", "vs_4_0"));
|
||||
swapBlitPS = CreatePS(Compile(blitPixel, "main", "ps_5_0"));
|
||||
}
|
||||
}
|
||||
|
||||
void D3D11GraphicsTest::Shutdown()
|
||||
|
||||
@@ -164,8 +164,7 @@ struct D3D11GraphicsTest : public GraphicsTest
|
||||
DXGI_FORMAT backbufferFmt = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||
int backbufferCount = 2;
|
||||
int backbufferMSAA = 1;
|
||||
bool d3d11_1 = false;
|
||||
bool d3d11_2 = false;
|
||||
D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_11_0;
|
||||
UINT createFlags = 0;
|
||||
|
||||
DXGI_ADAPTER_DESC adapterDesc = {};
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
<ClCompile Include="d3d11\d3d11_empty_compute_dispatch.cpp" />
|
||||
<ClCompile Include="d3d11\d3d11_empty_drawcall.cpp" />
|
||||
<ClCompile Include="d3d11\d3d11_empty_viewports.cpp" />
|
||||
<ClCompile Include="d3d11\d3d11_feature_level_9.cpp" />
|
||||
<ClCompile Include="d3d11\d3d11_helpers.cpp" />
|
||||
<ClCompile Include="d3d11\d3d11_large_buffer.cpp" />
|
||||
<ClCompile Include="d3d11\d3d11_many_rtvs.cpp" />
|
||||
|
||||
@@ -550,6 +550,9 @@
|
||||
<ClCompile Include="d3d11\d3d11_swapchain_zoo.cpp">
|
||||
<Filter>D3D11\demos</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d11\d3d11_feature_level_9.cpp">
|
||||
<Filter>D3D11\demos</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="D3D11">
|
||||
|
||||
@@ -57,7 +57,7 @@ struct v2f
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f main(vertin IN, uint vid : SV_VertexID)
|
||||
v2f main(vertin IN)
|
||||
{
|
||||
v2f OUT = (v2f)0;
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import renderdoc as rd
|
||||
import rdtest
|
||||
|
||||
|
||||
class D3D11_Feature_Level_9(rdtest.TestCase):
|
||||
demos_test_name = 'D3D11_Feature_Level_9'
|
||||
|
||||
def check_capture(self):
|
||||
last_draw: rd.DrawcallDescription = self.get_last_draw()
|
||||
|
||||
self.controller.SetFrameEvent(last_draw.eventId, True)
|
||||
|
||||
self.check_triangle(out=last_draw.copyDestination)
|
||||
|
||||
draw = self.find_draw("Draw")
|
||||
|
||||
self.controller.SetFrameEvent(draw.eventId, False)
|
||||
|
||||
postvs_data = self.get_postvs(draw, rd.MeshDataStage.VSOut, 0, draw.numIndices)
|
||||
|
||||
postvs_ref = {
|
||||
0: {
|
||||
'vtx': 0,
|
||||
'idx': 0,
|
||||
'SV_POSITION': [-0.5, -0.5, 0.0, 1.0],
|
||||
'COLOR': [0.0, 1.0, 0.0, 1.0],
|
||||
'TEXCOORD': [0.0, 0.0],
|
||||
},
|
||||
1: {
|
||||
'vtx': 1,
|
||||
'idx': 1,
|
||||
'SV_POSITION': [0.0, 0.5, 0.0, 1.0],
|
||||
'COLOR': [0.0, 1.0, 0.0, 1.0],
|
||||
'TEXCOORD': [0.0, 1.0],
|
||||
},
|
||||
2: {
|
||||
'vtx': 2,
|
||||
'idx': 2,
|
||||
'SV_POSITION': [0.5, -0.5, 0.0, 1.0],
|
||||
'COLOR': [0.0, 1.0, 0.0, 1.0],
|
||||
'TEXCOORD': [1.0, 0.0],
|
||||
},
|
||||
}
|
||||
|
||||
self.check_mesh_data(postvs_ref, postvs_data)
|
||||
Reference in New Issue
Block a user