Remove rdcarray sized constructor

This commit is contained in:
baldurk
2022-11-09 13:22:53 +00:00
parent 2cf7b911c7
commit 2e276a7f84
17 changed files with 64 additions and 39 deletions
@@ -700,7 +700,8 @@ void SettingsDialog::on_TextureViewer_ChooseShaderDirectories_clicked()
{
items = list.getItems();
rdcarray<rdcstr> newDirs(items.size());
rdcarray<rdcstr> newDirs;
newDirs.resize(items.size());
for(int i = 0; i < items.size(); i++)
{
newDirs[i] = items[i];
-6
View File
@@ -149,12 +149,6 @@ public:
typedef T value_type;
rdcarray() : elems(NULL), allocatedCount(0), usedCount(0) {}
rdcarray(size_t count)
{
elems = NULL;
allocatedCount = usedCount = 0;
resize(count);
}
~rdcarray()
{
// clear will destruct the actual elements still existing
+2 -1
View File
@@ -2152,7 +2152,8 @@ void ReplayProxy::DeltaTransferBytes(SerialiserType &xferser, bytebuf &reference
}
// serialise as an array, move the storage from the list into here
rdcarray<DeltaSection> deltas(deltasList.size());
rdcarray<DeltaSection> deltas;
deltas.resize(deltasList.size());
{
// swap between the list and array, so all the buffers just move storage
@@ -639,7 +639,8 @@ rdcarray<PixelModification> D3D11Replay::PixelHistory(rdcarray<EventUsage> event
// while issuing the above queries we can check to see which tests are enabled so we don't
// bother checking if depth testing failed if the depth test was disabled
rdcarray<uint32_t> flags(events.size());
rdcarray<uint32_t> flags;
flags.resize(events.size());
std::map<uint32_t, D3D11_COMPARISON_FUNC> depthOps;
std::map<uint32_t, DXGI_FORMAT> depthFormats;
enum
+1 -1
View File
@@ -2658,7 +2658,7 @@ rdcarray<ShaderDebugState> D3D11Replay::ContinueDebug(ShaderDebugger *debugger)
DXBCDebug::InterpretDebugger *interpreter = (DXBCDebug::InterpretDebugger *)debugger;
if(!interpreter)
return NULL;
return {};
D3D11DebugAPIWrapper apiWrapper(m_pDevice, interpreter->dxbc, interpreter->global,
interpreter->eventId);
+1 -1
View File
@@ -2791,7 +2791,7 @@ rdcarray<ShaderDebugState> D3D12Replay::ContinueDebug(ShaderDebugger *debugger)
DXBCDebug::InterpretDebugger *interpreter = (DXBCDebug::InterpretDebugger *)debugger;
if(!interpreter)
return NULL;
return {};
D3D12DebugAPIWrapper apiWrapper(m_pDevice, interpreter->dxbc, interpreter->global,
interpreter->eventId);
+2 -1
View File
@@ -92,7 +92,8 @@ rdcarray<EventUsage> QueryModifyingEvents(WrappedOpenGL *driver, GLPixelHistoryR
rdcarray<PixelModification> &history)
{
rdcarray<EventUsage> modEvents;
rdcarray<GLuint> occlusionQueries(events.size());
rdcarray<GLuint> occlusionQueries;
occlusionQueries.resize(events.size());
driver->glGenQueries((GLsizei)occlusionQueries.size(), occlusionQueries.data());
driver->ReplayLog(0, events[0].eventId, eReplay_WithoutDraw);
+2 -1
View File
@@ -2478,7 +2478,8 @@ void APIENTRY _glGetProgramResourceiv(GLuint program, GLenum programInterface, G
return;
}
rdcarray<ReflectionProperty> properties(propCount);
rdcarray<ReflectionProperty> properties;
properties.resize(propCount);
for(GLsizei i = 0; i < propCount; i++)
properties[i] = ConvertProperty(props[i]);
@@ -269,7 +269,8 @@ void IntelGlCounters::EndPass()
{
// Flush all of the pass' queries to ensure we can begin further samples
// with a different pass.
rdcarray<uint8_t> data(m_Queries[m_EnabledQueries[m_passIndex]].size);
rdcarray<uint8_t> data;
data.resize(m_Queries[m_EnabledQueries[m_passIndex]].size);
GLuint len;
uint32_t nSamples = (uint32_t)m_glQueries.size() / (m_passIndex + 1);
@@ -321,7 +322,8 @@ void IntelGlCounters::CopyData(void *dest, const IntelGlCounter &counter, uint32
uint32_t pass = CounterPass(counter);
uint32_t queryHandle = m_glQueries[maxSampleIndex * pass + sample];
rdcarray<uint8_t> data(m_Queries[m_EnabledQueries[pass]].size);
rdcarray<uint8_t> data;
data.resize(m_Queries[m_EnabledQueries[pass]].size);
GLuint len;
GL.glGetPerfQueryDataINTEL(queryHandle, 0, (GLsizei)data.size(), &data[0], &len);
@@ -263,7 +263,8 @@ void Editor::AddExtension(const rdcstr &extension)
// insert the extension instruction
size_t sz = extension.size();
rdcarray<uint32_t> uintName((sz / 4) + 1);
rdcarray<uint32_t> uintName;
uintName.resize((sz / 4) + 1);
memcpy(&uintName[0], extension.c_str(), sz);
Operation op(Op::Extension, uintName);
@@ -311,7 +312,8 @@ Id Editor::ImportExtInst(const char *setname)
Id ret = MakeId();
size_t sz = strlen(setname);
rdcarray<uint32_t> uintName((sz / 4) + 1);
rdcarray<uint32_t> uintName;
uintName.resize((sz / 4) + 1);
memcpy(&uintName[0], setname, sz);
uintName.insert(0, ret.value());
+4 -2
View File
@@ -1590,7 +1590,8 @@ VkResult WrappedVulkan::FilterDeviceExtensionProperties(VkPhysicalDevice physDev
if(vkr != VK_SUCCESS)
return vkr;
rdcarray<VkExtensionProperties> exts(numExts);
rdcarray<VkExtensionProperties> exts;
exts.resize(numExts);
vkr = ObjDisp(physDev)->EnumerateDeviceExtensionProperties(Unwrap(physDev), pLayerName, &numExts,
&exts[0]);
@@ -1726,7 +1727,8 @@ VkResult WrappedVulkan::FilterInstanceExtensionProperties(
if(vkr != VK_SUCCESS)
return vkr;
rdcarray<VkExtensionProperties> exts(numExts);
rdcarray<VkExtensionProperties> exts;
exts.resize(numExts);
vkr = pChain->CallDown(pLayerName, &numExts, &exts[0]);
if(vkr != VK_SUCCESS)
+8 -4
View File
@@ -915,8 +915,10 @@ protected:
// Copy color and input attachments, and ignore resolve attachments.
// Since we are only using this renderpass to replay a single draw, we don't
// need to do resolve operations.
rdcarray<VkAttachmentReference> colorAttachments(sub.colorAttachments.size());
rdcarray<VkAttachmentReference> inputAttachments(sub.inputAttachments.size());
rdcarray<VkAttachmentReference> colorAttachments;
rdcarray<VkAttachmentReference> inputAttachments;
colorAttachments.resize(sub.colorAttachments.size());
inputAttachments.resize(sub.inputAttachments.size());
for(size_t i = 0; i < sub.colorAttachments.size(); i++)
{
@@ -936,7 +938,8 @@ protected:
subpassDesc.colorAttachmentCount = (uint32_t)sub.colorAttachments.size();
subpassDesc.pColorAttachments = colorAttachments.data();
rdcarray<VkAttachmentDescription> descs(rpInfo.attachments.size());
rdcarray<VkAttachmentDescription> descs;
descs.resize(rpInfo.attachments.size());
for(uint32_t i = 0; i < rpInfo.attachments.size(); i++)
{
descs[i] = {};
@@ -1121,7 +1124,8 @@ protected:
const VulkanCreationInfo::RenderPass::Subpass &sub = rpInfo.subpasses.front();
const VulkanCreationInfo::Framebuffer &fbInfo =
m_pDriver->GetDebugManager()->GetFramebufferInfo(origFb);
rdcarray<VkImageView> atts(fbInfo.attachments.size());
rdcarray<VkImageView> atts;
atts.resize(fbInfo.attachments.size());
for(uint32_t i = 0; i < fbInfo.attachments.size(); i++)
{
+10 -5
View File
@@ -644,8 +644,10 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl,
rdcspv::Id vbuffersVariable, ibufferVariable;
rdcarray<rdcspv::Id> vbufferSpecConsts(MeshOutputBufferArraySize);
rdcarray<rdcspv::Id> vbufferVariables(MeshOutputBufferArraySize);
rdcarray<rdcspv::Id> vbufferSpecConsts;
rdcarray<rdcspv::Id> vbufferVariables;
vbufferSpecConsts.resize(MeshOutputBufferArraySize);
vbufferVariables.resize(MeshOutputBufferArraySize);
rdcspv::Id ibufferSpecConst;
rdcspv::Id outputSpecConst;
@@ -2043,10 +2045,12 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state)
};
rdcarray<uint32_t> attrInstDivisor;
rdcarray<CompactedAttrBuffer> vbuffers(MeshOutputBufferArraySize);
rdcarray<CompactedAttrBuffer> vbuffers;
vbuffers.resize(MeshOutputBufferArraySize);
{
rdcarray<VkWriteDescriptorSet> descWrites(MeshOutputBufferArraySize);
rdcarray<VkWriteDescriptorSet> descWrites;
descWrites.resize(MeshOutputBufferArraySize);
uint32_t numWrites = 0;
RDCASSERT(state.vertexAttributes.size() <= MeshOutputBufferArraySize);
@@ -2532,7 +2536,8 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state)
uint32_t baseOffset = (uint32_t)specData.size();
rdcarray<uint64_t> addresses(MeshOutputBufferArraySize + 2);
rdcarray<uint64_t> addresses;
addresses.resize(MeshOutputBufferArraySize + 2);
for(uint32_t i = 0; i <= MeshOutputBufferArraySize + 1; i++)
{
@@ -1708,7 +1708,8 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(SerialiserType &ser, VkComman
(const VkRenderPassAttachmentBeginInfo *)FindNextStruct(
&RenderPassBegin, VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO);
rdcarray<ResourceId> attachments(fbinfo.attachments.size());
rdcarray<ResourceId> attachments;
attachments.resize(fbinfo.attachments.size());
// set framebuffer attachments - by default from the ones used to create it, but if it is
// imageless then look for the attachments in our pNext chain
@@ -1852,7 +1853,8 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(SerialiserType &ser, VkComman
// imageless then look for the attachments in our pNext chain
{
VulkanCreationInfo::Framebuffer fbinfo = m_CreationInfo.m_Framebuffer[fb];
rdcarray<ResourceId> attachments(fbinfo.attachments.size());
rdcarray<ResourceId> attachments;
attachments.resize(fbinfo.attachments.size());
if(!fbinfo.imageless)
{
@@ -2367,7 +2369,8 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass2(SerialiserType &ser,
(const VkRenderPassAttachmentBeginInfo *)FindNextStruct(
&RenderPassBegin, VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO);
rdcarray<ResourceId> attachments(fbinfo.attachments.size());
rdcarray<ResourceId> attachments;
attachments.resize(fbinfo.attachments.size());
// set framebuffer attachments - by default from the ones used to create it, but if it is
// imageless then look for the attachments in our pNext chain
@@ -2506,7 +2509,8 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass2(SerialiserType &ser,
// imageless then look for the attachments in our pNext chain
{
VulkanCreationInfo::Framebuffer fbinfo = m_CreationInfo.m_Framebuffer[fb];
rdcarray<ResourceId> attachments(fbinfo.attachments.size());
rdcarray<ResourceId> attachments;
attachments.resize(fbinfo.attachments.size());
if(!fbinfo.imageless)
{
@@ -761,7 +761,8 @@ VkResult WrappedVulkan::vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo
uint32_t count = 0;
ObjDisp(m_Instance)->EnumeratePhysicalDevices(Unwrap(m_Instance), &count, NULL);
rdcarray<VkPhysicalDevice> physDevs(count);
rdcarray<VkPhysicalDevice> physDevs;
physDevs.resize(count);
ObjDisp(m_Instance)->EnumeratePhysicalDevices(Unwrap(m_Instance), &count, physDevs.data());
rdcarray<VkExtensionProperties> exts;
@@ -3452,14 +3453,16 @@ bool WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
}
}
rdcarray<const char *> layerArray(m_InitParams.Layers.size());
rdcarray<const char *> layerArray;
layerArray.resize(m_InitParams.Layers.size());
for(size_t i = 0; i < m_InitParams.Layers.size(); i++)
layerArray[i] = m_InitParams.Layers[i].c_str();
createInfo.enabledLayerCount = 0;
createInfo.ppEnabledLayerNames = NULL;
rdcarray<const char *> extArray(Extensions.size());
rdcarray<const char *> extArray;
extArray.resize(Extensions.size());
for(size_t i = 0; i < Extensions.size(); i++)
extArray[i] = Extensions[i].c_str();
+4 -2
View File
@@ -753,7 +753,8 @@ rdcstr Wide2UTF8(const rdcwstr &s)
// utf-8 characters can be max 4 bytes.
size_t len = (s.length() + 1) * 4;
rdcarray<char> charBuffer(len);
rdcarray<char> charBuffer;
charBuffer.resize(len);
size_t ret;
@@ -797,7 +798,8 @@ rdcwstr UTF82Wide(const rdcstr &s)
// input.
size_t len = s.length() + 1;
rdcarray<wchar_t> wcharBuffer(len);
rdcarray<wchar_t> wcharBuffer;
wcharBuffer.resize(len);
size_t ret;
+4 -2
View File
@@ -968,7 +968,8 @@ extern "C" RENDERDOC_API int RENDERDOC_CC RENDERDOC_RunFunctionalTests(int pytho
return 1;
}
rdcarray<rdcwstr> wideArgs(args.size());
rdcarray<rdcwstr> wideArgs;
wideArgs.resize(args.size());
for(size_t i = 0; i < args.size(); i++)
wideArgs[i] = StringFormat::UTF82Wide(args[i]);
@@ -986,7 +987,8 @@ extern "C" RENDERDOC_API int RENDERDOC_CC RENDERDOC_RunFunctionalTests(int pytho
L"--in-process",
});
rdcarray<wchar_t *> wideArgStrings(wideArgs.size());
rdcarray<wchar_t *> wideArgStrings;
wideArgStrings.resize(wideArgs.size());
for(size_t i = 0; i < wideArgs.size(); i++)
wideArgStrings[i] = wideArgs[i].data();