Skip to content

Commit 31cfad2

Browse files
tests: Add basic test for input attachments.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
1 parent 3ad6ecd commit 31cfad2

File tree

7 files changed

+390
-0
lines changed

7 files changed

+390
-0
lines changed

tests/d3d12_render_target.c

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#define VKD3D_DBG_CHANNEL VKD3D_DBG_CHANNEL_API
2323
#include "d3d12_crosstest.h"
24+
#include "vkd3d_command_list_vkd3d_ext.h"
2425

2526
void test_srgb_unorm_mismatch_usage_aliasing(void)
2627
{
@@ -3001,3 +3002,243 @@ void test_render_pass_suspend_resume_opts_disabled(void)
30013002
test_render_pass_suspend_resume_opts(false);
30023003
vkd3d_set_behavior_flags(0);
30033004
}
3005+
3006+
void test_input_attachments(void)
3007+
{
3008+
D3D12_CPU_DESCRIPTOR_HANDLE rtvs, depth, stencil, depth_stencil;
3009+
D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc;
3010+
D3D12_VK_INPUT_ATTACHMENT_MAPPINGS mappings;
3011+
ID3D12GraphicsCommandListExt2 *list_ext2;
3012+
D3D12_RENDER_TARGET_VIEW_DESC rtv_desc;
3013+
D3D12_DEPTH_STENCIL_VIEW_DESC dsv_desc;
3014+
struct test_context_desc context_desc;
3015+
D3D12_DESCRIPTOR_RANGE desc_range;
3016+
D3D12_ROOT_SIGNATURE_DESC rs_desc;
3017+
D3D12_ROOT_PARAMETER root_param;
3018+
ID3D12PipelineState *write_pso;
3019+
ID3D12DeviceExt2 *device_ext2;
3020+
ID3D12PipelineState *read_pso;
3021+
struct test_context context;
3022+
ID3D12DescriptorHeap *descs;
3023+
ID3D12DescriptorHeap *rtv;
3024+
ID3D12DescriptorHeap *dsv;
3025+
ID3D12Resource *color;
3026+
ID3D12Resource *ds;
3027+
D3D12_VIEWPORT vp;
3028+
D3D12_RECT sci;
3029+
unsigned int i;
3030+
HRESULT hr;
3031+
3032+
#include "shaders/render_target/headers/vs_no_attachments.h"
3033+
#include "shaders/render_target/headers/ps_input_attachment_read.h"
3034+
#include "shaders/render_target/headers/ps_input_attachment_write.h"
3035+
3036+
memset(&context_desc, 0, sizeof(context_desc));
3037+
memset(&context, 0, sizeof(context));
3038+
context_desc.no_pipeline = true;
3039+
context_desc.no_render_target = true;
3040+
context_desc.no_root_signature = true;
3041+
3042+
if (!init_test_context(&context, &context_desc))
3043+
return;
3044+
3045+
if (FAILED(ID3D12Device_QueryInterface(context.device, &IID_ID3D12DeviceExt2, (void **)&device_ext2)))
3046+
{
3047+
skip("ID3D12DeviceExt2 not supported, skipping.\n");
3048+
destroy_test_context(&context);
3049+
return;
3050+
}
3051+
3052+
if (ID3D12DeviceExt2_GetTilerOptimizationTier(device_ext2) < D3D12_VK_TILER_OPTIMIZATION_TIER_1)
3053+
{
3054+
skip("Tiler optimization tier 1 not supported, skipping.\n");
3055+
ID3D12DeviceExt2_Release(device_ext2);
3056+
destroy_test_context(&context);
3057+
return;
3058+
}
3059+
3060+
if (FAILED(ID3D12GraphicsCommandList_QueryInterface(context.list, &IID_ID3D12GraphicsCommandListExt2, (void **)&list_ext2)))
3061+
{
3062+
skip("ID3D12GraphicsCommandListExt2 not supported, skipping.\n");
3063+
ID3D12DeviceExt2_Release(device_ext2);
3064+
destroy_test_context(&context);
3065+
return;
3066+
}
3067+
3068+
ID3D12DeviceExt2_OptInToTilerOptimizations(device_ext2);
3069+
3070+
memset(&root_param, 0, sizeof(root_param));
3071+
memset(&rs_desc, 0, sizeof(rs_desc));
3072+
memset(&mappings, 0, sizeof(mappings));
3073+
memset(&desc_range, 0, sizeof(desc_range));
3074+
3075+
root_param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
3076+
root_param.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
3077+
rs_desc.NumParameters = 1;
3078+
rs_desc.pParameters = &root_param;
3079+
3080+
mappings.NumRenderTargets = 8;
3081+
mappings.EnableDepth = TRUE;
3082+
mappings.EnableStencil = TRUE;
3083+
for (i = 0; i < 8; i++)
3084+
{
3085+
mappings.RenderTargets[i].RegisterSpace = 1;
3086+
mappings.RenderTargets[i].ShaderRegister = 100 + i;
3087+
}
3088+
mappings.Depth.RegisterSpace = 1;
3089+
mappings.Depth.ShaderRegister = 108;
3090+
mappings.Stencil.RegisterSpace = 1;
3091+
mappings.Stencil.ShaderRegister = 109;
3092+
3093+
root_param.DescriptorTable.NumDescriptorRanges = 1;
3094+
root_param.DescriptorTable.pDescriptorRanges = &desc_range;
3095+
desc_range.RegisterSpace = 1;
3096+
desc_range.BaseShaderRegister = 100;
3097+
desc_range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
3098+
desc_range.NumDescriptors = 10;
3099+
3100+
create_root_signature_with_input_attachments(context.device, &rs_desc, &mappings, &context.root_signature);
3101+
3102+
init_pipeline_state_desc(&pso_desc, context.root_signature, DXGI_FORMAT_UNKNOWN,
3103+
&vs_no_attachments_dxbc,
3104+
&ps_input_attachment_write_dxbc, NULL);
3105+
3106+
pso_desc.NumRenderTargets = 8;
3107+
/* We write depth, stencil, RT4-8 */
3108+
for (i = 4; i < 8; i++)
3109+
pso_desc.RTVFormats[i] = (i & 1) ? DXGI_FORMAT_R8G8B8A8_UNORM : DXGI_FORMAT_R8G8B8A8_UINT;
3110+
pso_desc.DSVFormat = DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
3111+
pso_desc.DepthStencilState.DepthEnable = TRUE;
3112+
pso_desc.DepthStencilState.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
3113+
pso_desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_ALWAYS;
3114+
pso_desc.DepthStencilState.StencilEnable = TRUE;
3115+
pso_desc.DepthStencilState.StencilWriteMask = 0xff;
3116+
pso_desc.DepthStencilState.FrontFace.StencilDepthFailOp = D3D12_STENCIL_OP_KEEP;
3117+
pso_desc.DepthStencilState.FrontFace.StencilFailOp = D3D12_STENCIL_OP_KEEP;
3118+
pso_desc.DepthStencilState.FrontFace.StencilPassOp = D3D12_STENCIL_OP_REPLACE;
3119+
pso_desc.DepthStencilState.FrontFace.StencilFunc = D3D12_COMPARISON_FUNC_ALWAYS;
3120+
pso_desc.DepthStencilState.BackFace = pso_desc.DepthStencilState.FrontFace;
3121+
3122+
hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&write_pso);
3123+
ok(SUCCEEDED(hr), "Failed to create PSO, hr #%x.\n", hr);
3124+
3125+
pso_desc.PS = ps_input_attachment_read_dxbc;
3126+
/* We write RT0-4 */
3127+
for (i = 0; i < 4; i++)
3128+
pso_desc.RTVFormats[i] = (i & 1) ? DXGI_FORMAT_R8G8B8A8_UNORM : DXGI_FORMAT_R8G8B8A8_UINT;
3129+
/* Test that we can use NULL formats and still use input attachments.
3130+
* NumRenderTargets must be 8 to read RT4-8 however. */
3131+
for (i = 4; i < 8; i++)
3132+
pso_desc.RTVFormats[i] = DXGI_FORMAT_UNKNOWN;
3133+
pso_desc.DSVFormat = DXGI_FORMAT_UNKNOWN;
3134+
pso_desc.DepthStencilState.DepthEnable = FALSE;
3135+
pso_desc.DepthStencilState.StencilEnable = FALSE;
3136+
3137+
hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&read_pso);
3138+
ok(SUCCEEDED(hr), "Failed to create PSO, hr #%x.\n", hr);
3139+
3140+
color = create_default_texture2d(context.device, 64, 64, 8, 1,
3141+
DXGI_FORMAT_R8G8B8A8_TYPELESS,
3142+
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET,
3143+
D3D12_RESOURCE_STATE_RENDER_TARGET);
3144+
3145+
ds = create_default_texture2d(context.device, 64, 64, 1, 1,
3146+
DXGI_FORMAT_D32_FLOAT_S8X24_UINT,
3147+
D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL,
3148+
D3D12_RESOURCE_STATE_DEPTH_WRITE);
3149+
3150+
rtv = create_cpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 8);
3151+
dsv = create_cpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_DSV, 3);
3152+
3153+
for (i = 0; i < 8; i++)
3154+
{
3155+
rtv_desc.Format = (i & 1) ? DXGI_FORMAT_R8G8B8A8_UNORM : DXGI_FORMAT_R8G8B8A8_UINT;
3156+
rtv_desc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DARRAY;
3157+
rtv_desc.Texture2DArray.ArraySize = 1;
3158+
rtv_desc.Texture2DArray.FirstArraySlice = i;
3159+
rtv_desc.Texture2DArray.MipSlice = 0;
3160+
rtv_desc.Texture2DArray.PlaneSlice = 0;
3161+
3162+
/* Input attachments are implicitly created. */
3163+
ID3D12Device_CreateRenderTargetView(context.device, color, &rtv_desc,
3164+
get_cpu_rtv_handle(&context, rtv, i));
3165+
}
3166+
3167+
ID3D12Device_CreateDepthStencilView(context.device, ds, NULL,
3168+
get_cpu_dsv_handle(&context, dsv, 0));
3169+
3170+
dsv_desc.Format = DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
3171+
dsv_desc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
3172+
dsv_desc.Texture2D.MipSlice = 0;
3173+
3174+
/* Create input attachments. */
3175+
dsv_desc.Flags = D3D12_DSV_FLAG_READ_ONLY_DEPTH;
3176+
ID3D12Device_CreateDepthStencilView(context.device, ds, &dsv_desc,
3177+
get_cpu_dsv_handle(&context, dsv, 1));
3178+
3179+
dsv_desc.Flags = D3D12_DSV_FLAG_READ_ONLY_STENCIL;
3180+
ID3D12Device_CreateDepthStencilView(context.device, ds, &dsv_desc,
3181+
get_cpu_dsv_handle(&context, dsv, 2));
3182+
3183+
descs = create_gpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 10 +
3184+
ID3D12DeviceExt2_GetInputAttachmentDescriptorsCount(device_ext2));
3185+
3186+
ID3D12GraphicsCommandList_SetDescriptorHeaps(context.list, 1, &descs);
3187+
ID3D12GraphicsCommandList_SetGraphicsRootSignature(context.list, context.root_signature);
3188+
3189+
/* These should not actually be read from. */
3190+
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(context.list, 0,
3191+
get_gpu_descriptor_handle(&context, descs, 0));
3192+
3193+
/* Write input attachment descriptors to heap. */
3194+
{
3195+
rtvs = get_cpu_rtv_handle(&context, rtv, 0);
3196+
depth_stencil = get_cpu_dsv_handle(&context, dsv, 0);
3197+
depth = get_cpu_dsv_handle(&context, dsv, 1);
3198+
stencil = get_cpu_dsv_handle(&context, dsv, 2);
3199+
3200+
ID3D12DeviceExt2_CreateInputAttachmentDescriptors(device_ext2, 8, &rtvs, TRUE,
3201+
&depth, &stencil, get_cpu_descriptor_handle(&context, descs, 10));
3202+
ID3D12GraphicsCommandListExt2_SetRootSignatureInputAttachments(list_ext2,
3203+
get_gpu_descriptor_handle(&context, descs, 10));
3204+
}
3205+
3206+
set_viewport(&vp, 0, 0, 64, 64, 0, 1);
3207+
set_rect(&sci, 0, 0, 64, 64);
3208+
3209+
ID3D12GraphicsCommandList_RSSetViewports(context.list, 1, &vp);
3210+
ID3D12GraphicsCommandList_RSSetScissorRects(context.list, 1, &sci);
3211+
ID3D12GraphicsCommandList_IASetPrimitiveTopology(context.list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
3212+
ID3D12GraphicsCommandList_OMSetStencilRef(context.list, 0x60);
3213+
ID3D12GraphicsCommandList_OMSetRenderTargets(context.list, 8, &rtvs, TRUE, &depth_stencil);
3214+
3215+
ID3D12GraphicsCommandList_SetPipelineState(context.list, write_pso);
3216+
ID3D12GraphicsCommandList_DrawInstanced(context.list, 3, 1, 0, 0);
3217+
3218+
ID3D12GraphicsCommandListExt2_InputAttachmentPixelBarrier(list_ext2);
3219+
3220+
ID3D12GraphicsCommandList_SetPipelineState(context.list, read_pso);
3221+
ID3D12GraphicsCommandList_DrawInstanced(context.list, 3, 1, 0, 0);
3222+
for (i = 0; i < 4; i++)
3223+
transition_sub_resource_state(context.list, color, i, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
3224+
3225+
check_sub_resource_uint(color, 0, context.queue, context.list, 0x04030201 + 0x01010101 + 25 + (0x60 << 8), 0);
3226+
reset_command_list(context.list, context.allocator);
3227+
check_sub_resource_uint(color, 1, context.queue, context.list, 0x08070605 + 0x01010101, 0);
3228+
reset_command_list(context.list, context.allocator);
3229+
check_sub_resource_uint(color, 2, context.queue, context.list, 0x0c0b0a09 + 0x01010101, 0);
3230+
reset_command_list(context.list, context.allocator);
3231+
check_sub_resource_uint(color, 3, context.queue, context.list, 0x100f0e0d + 0x01010101, 0);
3232+
reset_command_list(context.list, context.allocator);
3233+
3234+
ID3D12Resource_Release(color);
3235+
ID3D12Resource_Release(ds);
3236+
ID3D12DescriptorHeap_Release(descs);
3237+
ID3D12DescriptorHeap_Release(rtv);
3238+
ID3D12DescriptorHeap_Release(dsv);
3239+
ID3D12PipelineState_Release(write_pso);
3240+
ID3D12PipelineState_Release(read_pso);
3241+
ID3D12GraphicsCommandListExt2_Release(list_ext2);
3242+
ID3D12DeviceExt2_Release(device_ext2);
3243+
destroy_test_context(&context);
3244+
}

tests/d3d12_test_utils.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,31 @@ static inline HRESULT create_root_signature(ID3D12Device *device, const D3D12_RO
915915
return hr;
916916
}
917917

918+
static inline HRESULT create_root_signature_with_input_attachments(ID3D12Device *device,
919+
const D3D12_ROOT_SIGNATURE_DESC *desc, const D3D12_VK_INPUT_ATTACHMENT_MAPPINGS *mappings,
920+
ID3D12RootSignature **root_signature)
921+
{
922+
ID3D12DeviceExt2 *ext2;
923+
ID3DBlob *blob;
924+
HRESULT hr;
925+
926+
if (FAILED(hr = ID3D12Device_QueryInterface(device, &IID_ID3D12DeviceExt2, (void **)&ext2)))
927+
return hr;
928+
929+
if (FAILED(hr = D3D12SerializeRootSignature(desc, D3D_ROOT_SIGNATURE_VERSION_1_0, &blob, NULL)))
930+
{
931+
ID3D12DeviceExt2_Release(ext2);
932+
return hr;
933+
}
934+
935+
hr = ID3D12DeviceExt2_CreateRootSignatureWithInputAttachments(ext2, 0, ID3D10Blob_GetBufferPointer(blob),
936+
ID3D10Blob_GetBufferSize(blob), mappings, &IID_ID3D12RootSignature, (void **)root_signature);
937+
938+
ID3D12DeviceExt2_Release(ext2);
939+
ID3D10Blob_Release(blob);
940+
return hr;
941+
}
942+
918943
static inline HRESULT create_versioned_root_signature(ID3D12Device *device, const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *desc,
919944
ID3D12RootSignature **root_signature)
920945
{

tests/d3d12_tests.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,4 @@ decl_test(test_render_pass_suspend_resume_opts_inline_clears);
528528
decl_test(test_render_pass_suspend_resume_opts_disabled);
529529
decl_test(test_static_sampler_dynamic_index);
530530
decl_test(test_descriptor_range_validation);
531+
decl_test(test_input_attachments);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
static const DWORD ps_input_attachment_read_code_dxbc[] =
2+
{
3+
0x43425844, 0x114740f3, 0xc55ab3a9, 0xe29be1a4, 0x304d1fb9, 0x00000001, 0x00000408, 0x00000003,
4+
0x0000002c, 0x00000060, 0x000000dc, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
5+
0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69,
6+
0x4e47534f, 0x00000074, 0x00000004, 0x00000008, 0x00000068, 0x00000000, 0x00000000, 0x00000001,
7+
0x00000000, 0x0000000f, 0x00000068, 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x0000000f,
8+
0x00000068, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x0000000f, 0x00000068, 0x00000003,
9+
0x00000000, 0x00000003, 0x00000003, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853,
10+
0x00000324, 0x00000051, 0x000000c9, 0x0100086a, 0x07001858, 0x00307e46, 0x00000000, 0x00000068,
11+
0x00000068, 0x00004444, 0x00000001, 0x07001858, 0x00307e46, 0x00000001, 0x00000069, 0x00000069,
12+
0x00005555, 0x00000001, 0x07001858, 0x00307e46, 0x00000002, 0x0000006a, 0x0000006a, 0x00004444,
13+
0x00000001, 0x07001858, 0x00307e46, 0x00000003, 0x0000006b, 0x0000006b, 0x00005555, 0x00000001,
14+
0x07001858, 0x00307e46, 0x00000004, 0x0000006c, 0x0000006c, 0x00005555, 0x00000001, 0x07001858,
15+
0x00307e46, 0x00000005, 0x0000006d, 0x0000006d, 0x00004444, 0x00000001, 0x04002064, 0x00101032,
16+
0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x03000065, 0x001020f2, 0x00000001,
17+
0x03000065, 0x001020f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000003, 0x02000068, 0x00000006,
18+
0x0500001b, 0x00100032, 0x00000000, 0x00101046, 0x00000000, 0x08000036, 0x001000c2, 0x00000000,
19+
0x00004002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0800002d, 0x001000f2, 0x00000001,
20+
0x00100f46, 0x00000000, 0x00207e46, 0x00000000, 0x00000068, 0x0800002d, 0x001000f2, 0x00000002,
21+
0x00100f46, 0x00000000, 0x00207e46, 0x00000001, 0x00000069, 0x0800002d, 0x001000f2, 0x00000003,
22+
0x00100f46, 0x00000000, 0x00207e46, 0x00000002, 0x0000006a, 0x0800002d, 0x001000f2, 0x00000004,
23+
0x00100f46, 0x00000000, 0x00207e46, 0x00000003, 0x0000006b, 0x0800002d, 0x00100012, 0x00000005,
24+
0x00100f46, 0x00000000, 0x00207e46, 0x00000004, 0x0000006c, 0x0800002d, 0x00100022, 0x00000000,
25+
0x00100e46, 0x00000000, 0x00207e16, 0x00000005, 0x0000006d, 0x08000036, 0x001000d2, 0x00000000,
26+
0x00004002, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x0700001e, 0x001000f2, 0x00000000,
27+
0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0a000000, 0x001020f2, 0x00000001, 0x00100e46,
28+
0x00000002, 0x00004002, 0x3b808081, 0x3b808081, 0x3b808081, 0x3b808081, 0x0a00001e, 0x001020f2,
29+
0x00000002, 0x00100e46, 0x00000003, 0x00004002, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
30+
0x0a000000, 0x001020f2, 0x00000003, 0x00100e46, 0x00000004, 0x00004002, 0x3b808081, 0x3b808081,
31+
0x3b808081, 0x3b808081, 0x07000038, 0x00100012, 0x00000001, 0x0010000a, 0x00000005, 0x00004001,
32+
0x42c80000, 0x0500001c, 0x00100012, 0x00000001, 0x0010000a, 0x00000001, 0x0700001e, 0x00102012,
33+
0x00000000, 0x0010000a, 0x00000000, 0x0010000a, 0x00000001, 0x0700001e, 0x00102022, 0x00000000,
34+
0x0010001a, 0x00000000, 0x00004001, 0x00000001, 0x05000036, 0x001020c2, 0x00000000, 0x00100ea6,
35+
0x00000000, 0x0100003e,
36+
};
37+
#ifdef __GNUC__
38+
#define UNUSED_ARRAY_ATTR __attribute__((unused))
39+
#else
40+
#define UNUSED_ARRAY_ATTR
41+
#endif
42+
UNUSED_ARRAY_ATTR static const D3D12_SHADER_BYTECODE ps_input_attachment_read_dxbc = { ps_input_attachment_read_code_dxbc, sizeof(ps_input_attachment_read_code_dxbc) };
43+
#undef UNUSED_ARRAY_ATTR
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
static const DWORD ps_input_attachment_write_code_dxbc[] =
2+
{
3+
0x43425844, 0x7008b832, 0x695b9136, 0xad65dfa8, 0x9665966d, 0x00000001, 0x000001b8, 0x00000003,
4+
0x0000002c, 0x0000003c, 0x000000d8, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
5+
0x00000094, 0x00000005, 0x00000008, 0x00000080, 0x00000004, 0x00000000, 0x00000001, 0x00000004,
6+
0x0000000f, 0x00000080, 0x00000005, 0x00000000, 0x00000003, 0x00000005, 0x0000000f, 0x00000080,
7+
0x00000006, 0x00000000, 0x00000001, 0x00000006, 0x0000000f, 0x00000080, 0x00000007, 0x00000000,
8+
0x00000003, 0x00000007, 0x0000000f, 0x0000008a, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
9+
0x00000e01, 0x545f5653, 0x65677261, 0x56530074, 0x7065445f, 0xab006874, 0x58454853, 0x000000d8,
10+
0x00000050, 0x00000036, 0x0100086a, 0x03000065, 0x001020f2, 0x00000004, 0x03000065, 0x001020f2,
11+
0x00000005, 0x03000065, 0x001020f2, 0x00000006, 0x03000065, 0x001020f2, 0x00000007, 0x02000065,
12+
0x0000c001, 0x08000036, 0x001020f2, 0x00000004, 0x00004002, 0x00000001, 0x00000002, 0x00000003,
13+
0x00000004, 0x08000036, 0x001020f2, 0x00000005, 0x00004002, 0x3ca0a0a1, 0x3cc0c0c1, 0x3ce0e0e1,
14+
0x3d008081, 0x08000036, 0x001020f2, 0x00000006, 0x00004002, 0x00000009, 0x0000000a, 0x0000000b,
15+
0x0000000c, 0x08000036, 0x001020f2, 0x00000007, 0x00004002, 0x3d50d0d1, 0x3d60e0e1, 0x3d70f0f1,
16+
0x3d808081, 0x04000036, 0x0000c001, 0x00004001, 0x3e800000, 0x0100003e,
17+
};
18+
#ifdef __GNUC__
19+
#define UNUSED_ARRAY_ATTR __attribute__((unused))
20+
#else
21+
#define UNUSED_ARRAY_ATTR
22+
#endif
23+
UNUSED_ARRAY_ATTR static const D3D12_SHADER_BYTECODE ps_input_attachment_write_dxbc = { ps_input_attachment_write_code_dxbc, sizeof(ps_input_attachment_write_code_dxbc) };
24+
#undef UNUSED_ARRAY_ATTR
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
struct PSOut
2+
{
3+
uint4 rt0 : SV_Target0;
4+
float4 rt1 : SV_Target1;
5+
uint4 rt2 : SV_Target2;
6+
float4 rt3 : SV_Target3;
7+
};
8+
9+
Texture2D<uint4> RT4 : register(t104, space1);
10+
Texture2D<float4> RT5 : register(t105, space1);
11+
Texture2D<uint4> RT6 : register(t106, space1);
12+
Texture2D<float4> RT7 : register(t107, space1);
13+
Texture2D<float> Depth : register(t108, space1);
14+
Texture2D<uint> Stencil : register(t109, space1);
15+
16+
PSOut main(float4 pos : SV_Position)
17+
{
18+
PSOut pout;
19+
20+
uint4 rt4 = RT4.Load(int3(pos.xy, 0));
21+
float4 rt5 = RT5.Load(int3(pos.xy, 0));
22+
uint4 rt6 = RT6.Load(int3(pos.xy, 0));
23+
float4 rt7 = RT7.Load(int3(pos.xy, 0));
24+
float depth = Depth.Load(int3(pos.xy, 0));
25+
uint stencil = Stencil.Load(int3(pos.xy, 0));
26+
27+
pout.rt0 = rt4 + 1;
28+
pout.rt1 = rt5 + 1.0 / 255.0;
29+
pout.rt2 = rt6 + 1;
30+
pout.rt3 = rt7 + 1.0 / 255.0;
31+
32+
pout.rt0.x += uint(100.0 * depth);
33+
pout.rt0.y += stencil;
34+
35+
return pout;
36+
}

0 commit comments

Comments
 (0)