From 57b27983564952bee0100dcce350361aa32c9494 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 26 Aug 2018 17:09:03 -0700 Subject: Updated core & tools (implemented raw buffers plus other improvements) --- Tests/TestApp/src/TestShaderVarAccess.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'Tests/TestApp/src/TestShaderVarAccess.cpp') 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 pFormattedBuff0, pFormattedBuff[4]; IDeviceObject *pFormattedBuffSRV = nullptr, *pFormattedBuffUAV[4] = {}, *pFormattedBuffSRVs[4] = {}; + RefCntAutoPtr 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]; } } -- cgit v1.2.3