diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-08-27 00:09:03 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-08-27 00:09:03 +0000 |
| commit | 57b27983564952bee0100dcce350361aa32c9494 (patch) | |
| tree | 99b7ff2a9464ad236578ea725bd7b1b8d858099a /Tests/TestApp/src/TestShaderVarAccess.cpp | |
| parent | Updated readme: organized projects into a table (diff) | |
| download | DiligentEngine-57b27983564952bee0100dcce350361aa32c9494.tar.gz DiligentEngine-57b27983564952bee0100dcce350361aa32c9494.zip | |
Updated core & tools (implemented raw buffers plus other improvements)
Diffstat (limited to 'Tests/TestApp/src/TestShaderVarAccess.cpp')
| -rw-r--r-- | Tests/TestApp/src/TestShaderVarAccess.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/Tests/TestApp/src/TestShaderVarAccess.cpp b/Tests/TestApp/src/TestShaderVarAccess.cpp index 5949dff..78791bf 100644 --- a/Tests/TestApp/src/TestShaderVarAccess.cpp +++ b/Tests/TestApp/src/TestShaderVarAccess.cpp @@ -124,26 +124,38 @@ TestShaderVarAccess::TestShaderVarAccess( IRenderDevice *pDevice, IDeviceContext RefCntAutoPtr<IBuffer> pFormattedBuff0, pFormattedBuff[4]; IDeviceObject *pFormattedBuffSRV = nullptr, *pFormattedBuffUAV[4] = {}, *pFormattedBuffSRVs[4] = {}; + RefCntAutoPtr<IBufferView> spFormattedBuffSRV, spFormattedBuffUAV[4], spFormattedBuffSRVs[4]; { Diligent::BufferDesc TxlBuffDesc; TxlBuffDesc.Name = "Uniform texel buffer test"; TxlBuffDesc.uiSizeInBytes = 256; TxlBuffDesc.BindFlags = BIND_SHADER_RESOURCE | BIND_UNORDERED_ACCESS; TxlBuffDesc.Usage = USAGE_DEFAULT; - TxlBuffDesc.Format.ValueType = VT_FLOAT32; - TxlBuffDesc.Format.NumComponents = 4; - TxlBuffDesc.Format.IsNormalized = false; + TxlBuffDesc.ElementByteStride = 16; TxlBuffDesc.Mode = BUFFER_MODE_FORMATTED; pDevice->CreateBuffer(TxlBuffDesc, BufferData{}, &pFormattedBuff0); - pFormattedBuffSRV = pFormattedBuff0->GetDefaultView(BUFFER_VIEW_SHADER_RESOURCE); + + Diligent::BufferViewDesc ViewDesc; + ViewDesc.ViewType = BUFFER_VIEW_SHADER_RESOURCE; + ViewDesc.Format.ValueType = VT_FLOAT32; + ViewDesc.Format.NumComponents = 4; + ViewDesc.Format.IsNormalized = false; + pFormattedBuff0->CreateView(ViewDesc, &spFormattedBuffSRV); + pFormattedBuffSRV = spFormattedBuffSRV; for(size_t i=0; i < _countof(pFormattedBuff); ++i) { TxlBuffDesc.Name = "UAV buffer test"; TxlBuffDesc.BindFlags = BIND_SHADER_RESOURCE | BIND_UNORDERED_ACCESS; pDevice->CreateBuffer(TxlBuffDesc, BufferData{}, &(pFormattedBuff[i])); - pFormattedBuffUAV[i] = pFormattedBuff[i]->GetDefaultView(BUFFER_VIEW_UNORDERED_ACCESS); - pFormattedBuffSRVs[i] = pFormattedBuff[i]->GetDefaultView(BUFFER_VIEW_SHADER_RESOURCE); + + ViewDesc.ViewType = BUFFER_VIEW_UNORDERED_ACCESS; + pFormattedBuff[i]->CreateView(ViewDesc, &(spFormattedBuffUAV[i])); + pFormattedBuffUAV[i] = spFormattedBuffUAV[i]; + + ViewDesc.ViewType = BUFFER_VIEW_SHADER_RESOURCE; + pFormattedBuff[i]->CreateView(ViewDesc, &(spFormattedBuffSRVs[i])); + pFormattedBuffSRVs[i] = spFormattedBuffSRVs[i]; } } |
