summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-04-29 17:03:46 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-04-29 14:03:46 -0700
commit4880789e3003441732cca4471091563f36531635 (patch)
tree8e0d3ed58a561373b35729d24787afe6b39732e3 /tools
parentded340beb4b5197b559626acc39920abb2d39e77 (diff)
String/List closer to conventions, and use Index type (#959)
* List made members m_ Tweaked types to closer match conventions. * Use asserts for checking conditions on List. Other small improvements. * List<T>.Count() -> getSize() * List<T> Add -> add First -> getFirst Last -> getLast RemoveLast -> removeLast ReleaseBuffer -> detachBuffer GetArrayView -> getArrayView * List<T>:: AddRange -> addRange Capacity -> getCapacity Insert -> insert InsertRange -> insertRange AddRange -> addRange RemoveRange -> removeRange RemoveAt -> removeAt Remove -> remove Reverse -> reverse FastRemove -> fastRemove FastRemoveAt -> fastRemoveAt Clear -> clear * List<T> FreeBuffer -> _deallocateBuffer Free -> clearAndDeallocate SwapWith -> swapWith * List<T> SetSize -> setSize Reserve -> reserve GrowToSize growToSize * UnsafeShrinkToSize -> unsafeShrinkToSize Compress -> compress FindLast -> findLastIndex FindLast -> findLastIndex Simplify Contains * List<T> Removed m_allocator (wasn't used) Swap -> swapElements Sort -> sort Contains -> contains ForEach -> forEach QuickSort -> quickSort InsertionSort -> insertionSort BinarySearch -> binarySearch Max -> calcMax Min -> calcMin * Initializer::Initialize -> initialize List<T>:: Allocate -> _allocate Init -> _init IndexOf -> indexOf * * Put #include <assert.h> in common.h, and remove unneeded inclusions * Small refactor of ArrayView - remove stride as not used * getSize -> getCount setSize -> setCount unsafeShrinkToSize->unsafeShrinkToCount growToSize -> growToCount m_size -> m_count * Some tidy up around Allocator. * Use Index type on List. * Refactor of IntSet. First tentative look at using Index. * Made Index an Int Did preliminary fixes. Made String use Index. * Partial refactor of String. * String::Buffer -> getBuffer ToWString -> toWString * Small improvements to String. String:: Buffer() -> getBuffer() Equals() -> equals * Try to use Index where appropriate. * Fix warnings on windows x86 builds.
Diffstat (limited to 'tools')
-rw-r--r--tools/gfx/circular-resource-heap-d3d12.cpp14
-rw-r--r--tools/gfx/d3d-util.cpp22
-rw-r--r--tools/gfx/descriptor-heap-d3d12.h10
-rw-r--r--tools/gfx/flag-combiner.cpp4
-rw-r--r--tools/gfx/gui.cpp16
-rw-r--r--tools/gfx/render-d3d11.cpp28
-rw-r--r--tools/gfx/render-d3d12.cpp70
-rw-r--r--tools/gfx/render-gl.cpp29
-rw-r--r--tools/gfx/render-vk.cpp84
-rw-r--r--tools/gfx/render.h2
-rw-r--r--tools/gfx/resource-d3d12.cpp4
-rw-r--r--tools/gfx/surface.cpp6
-rw-r--r--tools/gfx/vk-api.cpp4
-rw-r--r--tools/gfx/vk-swap-chain.cpp36
-rw-r--r--tools/gfx/vk-swap-chain.h8
-rw-r--r--tools/render-test/options.cpp12
-rw-r--r--tools/render-test/render-test-main.cpp16
-rw-r--r--tools/render-test/shader-input-layout.cpp50
-rw-r--r--tools/render-test/shader-renderer-util.cpp46
-rw-r--r--tools/render-test/slang-support.cpp24
-rw-r--r--tools/slang-generate/main.cpp31
-rw-r--r--tools/slang-test/options.cpp21
-rw-r--r--tools/slang-test/os.cpp37
-rw-r--r--tools/slang-test/slang-test-main.cpp115
-rw-r--r--tools/slang-test/slangc-tool.cpp4
-rw-r--r--tools/slang-test/test-context.cpp1
-rw-r--r--tools/slang-test/test-reporter.cpp53
-rw-r--r--tools/slang-test/unit-test-byte-encode.cpp9
-rw-r--r--tools/slang-test/unit-test-free-list.cpp11
-rw-r--r--tools/slang-test/unit-test-memory-arena.cpp31
30 files changed, 395 insertions, 403 deletions
diff --git a/tools/gfx/circular-resource-heap-d3d12.cpp b/tools/gfx/circular-resource-heap-d3d12.cpp
index 20e47c4dd..685dd364f 100644
--- a/tools/gfx/circular-resource-heap-d3d12.cpp
+++ b/tools/gfx/circular-resource-heap-d3d12.cpp
@@ -57,7 +57,7 @@ void D3D12CircularResourceHeap::addSync(uint64_t signalValue)
PendingEntry entry;
entry.m_completedValue = signalValue;
entry.m_cursor = m_front;
- m_pendingQueue.Add(entry);
+ m_pendingQueue.add(entry);
}
void D3D12CircularResourceHeap::updateCompleted()
@@ -65,13 +65,13 @@ void D3D12CircularResourceHeap::updateCompleted()
const uint64_t completedValue = m_fence->getCompletedValue();
#if 0
- while (m_pendingQueue.Count() != 0)
+ while (m_pendingQueue.getCount() != 0)
{
const PendingEntry& entry = m_pendingQueue[0];
if (entry.m_completedValue <= completedValue)
{
m_back = entry.m_cursor;
- m_pendingQueue.RemoveAt(0);
+ m_pendingQueue.removeAt(0);
}
else
{
@@ -80,8 +80,8 @@ void D3D12CircularResourceHeap::updateCompleted()
}
#else
// A more efficient implementation is m_pendingQueue is implemented as a vector like type
- const int size = int(m_pendingQueue.Count());
- int end = 0;
+ const Index size = m_pendingQueue.getCount();
+ Index end = 0;
while (end < size && m_pendingQueue[end].m_completedValue <= completedValue)
{
end++;
@@ -93,11 +93,11 @@ void D3D12CircularResourceHeap::updateCompleted()
m_back = m_pendingQueue[end - 1].m_cursor;
if (end == size)
{
- m_pendingQueue.Clear();
+ m_pendingQueue.clear();
}
else
{
- m_pendingQueue.RemoveRange(0, size);
+ m_pendingQueue.removeRange(0, size);
}
}
#endif
diff --git a/tools/gfx/d3d-util.cpp b/tools/gfx/d3d-util.cpp
index cdbf0bfdb..3f25ff46c 100644
--- a/tools/gfx/d3d-util.cpp
+++ b/tools/gfx/d3d-util.cpp
@@ -1,4 +1,4 @@
-// d3d-util.cpp
+// d3d-util.cpp
#include "d3d-util.h"
#include <d3dcompiler.h>
@@ -294,15 +294,15 @@ bool D3DUtil::isTypeless(DXGI_FORMAT format)
if (outSize > 0)
{
- const UInt prevSize = out.Count();
- out.SetSize(prevSize + len + 1);
+ const Index prevSize = out.getCount();
+ out.setCount(prevSize + len + 1);
- WCHAR* dst = out.Buffer() + prevSize;
+ WCHAR* dst = out.getBuffer() + prevSize;
::MultiByteToWideChar(CP_UTF8, dwFlags, in, int(len), dst, outSize);
// Make null terminated
dst[outSize] = 0;
// Remove terminating 0 from array
- out.UnsafeShrinkToSize(prevSize + outSize);
+ out.unsafeShrinkToCount(prevSize + outSize);
}
}
@@ -376,9 +376,9 @@ static bool _isMatch(IDXGIAdapter* adapter, const Slang::UnownedStringSlice& low
DXGI_ADAPTER_DESC desc;
adapter->GetDesc(&desc);
- String descName = String::FromWString(desc.Description).ToLower();
+ String descName = String::fromWString(desc.Description).toLower();
- return descName.IndexOf(lowerAdapaterName) != UInt(-1);
+ return descName.indexOf(lowerAdapaterName) != Index(-1);
}
/* static */bool D3DUtil::isWarp(IDXGIFactory* dxgiFactory, IDXGIAdapter* adapterIn)
@@ -397,9 +397,9 @@ static bool _isMatch(IDXGIAdapter* adapter, const Slang::UnownedStringSlice& low
/* static */SlangResult D3DUtil::findAdapters(DeviceCheckFlags flags, const UnownedStringSlice& adapterName, IDXGIFactory* dxgiFactory, List<ComPtr<IDXGIAdapter>>& outDxgiAdapters)
{
- String lowerAdapterName = String(adapterName).ToLower();
+ String lowerAdapterName = String(adapterName).toLower();
- outDxgiAdapters.Clear();
+ outDxgiAdapters.clear();
ComPtr<IDXGIAdapter> warpAdapter;
if ((flags & DeviceCheckFlag::UseHardwareDevice) == 0)
@@ -410,7 +410,7 @@ static bool _isMatch(IDXGIAdapter* adapter, const Slang::UnownedStringSlice& low
dxgiFactory4->EnumWarpAdapter(IID_PPV_ARGS(warpAdapter.writeRef()));
if (_isMatch(warpAdapter, lowerAdapterName.getUnownedSlice()))
{
- outDxgiAdapters.Add(warpAdapter);
+ outDxgiAdapters.add(warpAdapter);
}
}
}
@@ -444,7 +444,7 @@ static bool _isMatch(IDXGIAdapter* adapter, const Slang::UnownedStringSlice& low
// If the right type then add it
if ((deviceFlags & DXGI_ADAPTER_FLAG_SOFTWARE) == 0 && (flags & DeviceCheckFlag::UseHardwareDevice) != 0)
{
- outDxgiAdapters.Add(dxgiAdapter);
+ outDxgiAdapters.add(dxgiAdapter);
}
}
diff --git a/tools/gfx/descriptor-heap-d3d12.h b/tools/gfx/descriptor-heap-d3d12.h
index 2a814583b..638c1f752 100644
--- a/tools/gfx/descriptor-heap-d3d12.h
+++ b/tools/gfx/descriptor-heap-d3d12.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <dxgi.h>
@@ -108,10 +108,10 @@ public:
{
// TODO: this allocator would take some work to make thread-safe
- if(m_freeList.Count() > 0)
+ if(m_freeList.getCount() > 0)
{
auto descriptor = m_freeList[0];
- m_freeList.FastRemoveAt(0);
+ m_freeList.fastRemoveAt(0);
*outDescriptor = descriptor;
return SLANG_OK;
@@ -121,7 +121,7 @@ public:
if(index < 0)
{
// Allocate a new heap and try again.
- m_heaps.Add(m_heap);
+ m_heaps.add(m_heap);
SLANG_RETURN_ON_FAIL(m_heap.init(m_device, m_chunkSize, m_type, D3D12_DESCRIPTOR_HEAP_FLAG_NONE));
int index = m_heap.allocate();
@@ -141,7 +141,7 @@ public:
void free(D3D12HostVisibleDescriptor descriptor)
{
- m_freeList.Add(descriptor);
+ m_freeList.add(descriptor);
}
};
diff --git a/tools/gfx/flag-combiner.cpp b/tools/gfx/flag-combiner.cpp
index 5ea577f11..f67f869ce 100644
--- a/tools/gfx/flag-combiner.cpp
+++ b/tools/gfx/flag-combiner.cpp
@@ -24,8 +24,8 @@ void FlagCombiner::add(uint32_t flags, ChangeType type)
void FlagCombiner::calcCombinations(List<uint32_t>& outCombinations) const
{
const int numCombinations = getNumCombinations();
- outCombinations.SetSize(numCombinations);
- uint32_t* dstCombinations = outCombinations.Buffer();
+ outCombinations.setCount(numCombinations);
+ uint32_t* dstCombinations = outCombinations.getBuffer();
for (int i = 0; i < numCombinations; ++i)
{
dstCombinations[i] = getCombination(i);
diff --git a/tools/gfx/gui.cpp b/tools/gfx/gui.cpp
index cefb132fb..8208bd606 100644
--- a/tools/gfx/gui.cpp
+++ b/tools/gfx/gui.cpp
@@ -161,22 +161,22 @@ GUI::GUI(Window* window, Renderer* inRenderer)
//
List<DescriptorSetLayout::SlotRangeDesc> descriptorSetRanges;
- descriptorSetRanges.Add(DescriptorSetLayout::SlotRangeDesc(DescriptorSlotType::UniformBuffer));
- descriptorSetRanges.Add(DescriptorSetLayout::SlotRangeDesc(DescriptorSlotType::SampledImage));
- descriptorSetRanges.Add(DescriptorSetLayout::SlotRangeDesc(DescriptorSlotType::Sampler));
+ descriptorSetRanges.add(DescriptorSetLayout::SlotRangeDesc(DescriptorSlotType::UniformBuffer));
+ descriptorSetRanges.add(DescriptorSetLayout::SlotRangeDesc(DescriptorSlotType::SampledImage));
+ descriptorSetRanges.add(DescriptorSetLayout::SlotRangeDesc(DescriptorSlotType::Sampler));
DescriptorSetLayout::Desc descriptorSetLayoutDesc;
- descriptorSetLayoutDesc.slotRangeCount = descriptorSetRanges.Count();
- descriptorSetLayoutDesc.slotRanges = descriptorSetRanges.Buffer();
+ descriptorSetLayoutDesc.slotRangeCount = descriptorSetRanges.getCount();
+ descriptorSetLayoutDesc.slotRanges = descriptorSetRanges.getBuffer();
descriptorSetLayout = renderer->createDescriptorSetLayout(descriptorSetLayoutDesc);
List<PipelineLayout::DescriptorSetDesc> pipelineDescriptorSets;
- pipelineDescriptorSets.Add(PipelineLayout::DescriptorSetDesc(descriptorSetLayout));
+ pipelineDescriptorSets.add(PipelineLayout::DescriptorSetDesc(descriptorSetLayout));
PipelineLayout::Desc pipelineLayoutDesc;
- pipelineLayoutDesc.descriptorSetCount = pipelineDescriptorSets.Count();
- pipelineLayoutDesc.descriptorSets = pipelineDescriptorSets.Buffer();
+ pipelineLayoutDesc.descriptorSetCount = pipelineDescriptorSets.getCount();
+ pipelineLayoutDesc.descriptorSets = pipelineDescriptorSets.getBuffer();
pipelineLayoutDesc.renderTargetCount = 1;
pipelineLayout = renderer->createPipelineLayout(pipelineLayoutDesc);
diff --git a/tools/gfx/render-d3d11.cpp b/tools/gfx/render-d3d11.cpp
index afb8c3e5f..5911d6e9c 100644
--- a/tools/gfx/render-d3d11.cpp
+++ b/tools/gfx/render-d3d11.cpp
@@ -475,11 +475,11 @@ SlangResult D3D11Renderer::initialize(const Desc& desc, void* inWindowHandle)
// If we have an adapter set on the desc, look it up. We only need to do so for hardware
ComPtr<IDXGIAdapter> adapter;
- if (desc.adapter.Length() && (deviceCheckFlags & DeviceCheckFlag::UseHardwareDevice))
+ if (desc.adapter.getLength() && (deviceCheckFlags & DeviceCheckFlag::UseHardwareDevice))
{
List<ComPtr<IDXGIAdapter>> dxgiAdapters;
D3DUtil::findAdapters(deviceCheckFlags, desc.adapter.getUnownedSlice(), dxgiAdapters);
- if (dxgiAdapters.Count() == 0)
+ if (dxgiAdapters.getCount() == 0)
{
continue;
}
@@ -695,7 +695,7 @@ Result D3D11Renderer::createTextureResource(Resource::Usage initialUsage, const
D3D11_SUBRESOURCE_DATA* subResourcesPtr = nullptr;
if(initData)
{
- subRes.SetSize(srcDesc.numMipLevels * effectiveArraySize);
+ subRes.setCount(srcDesc.numMipLevels * effectiveArraySize);
{
int subResourceIndex = 0;
for (int i = 0; i < effectiveArraySize; i++)
@@ -715,7 +715,7 @@ Result D3D11Renderer::createTextureResource(Resource::Usage initialUsage, const
}
}
}
- subResourcesPtr = subRes.Buffer();
+ subResourcesPtr = subRes.getBuffer();
}
const int accessFlags = _calcResourceAccessFlags(srcDesc.cpuAccessFlags);
@@ -816,9 +816,9 @@ Result D3D11Renderer::createBufferResource(Resource::Usage initialUsage, const B
List<uint8_t> initDataBuffer;
if (initData && alignedSizeInBytes > srcDesc.sizeInBytes)
{
- initDataBuffer.SetSize(alignedSizeInBytes);
- ::memcpy(initDataBuffer.Buffer(), initData, srcDesc.sizeInBytes);
- initData = initDataBuffer.Buffer();
+ initDataBuffer.setCount(alignedSizeInBytes);
+ ::memcpy(initDataBuffer.getBuffer(), initData, srcDesc.sizeInBytes);
+ initData = initDataBuffer.getBuffer();
}
D3D11_BUFFER_DESC bufferDesc = { 0 };
@@ -1813,7 +1813,7 @@ Result D3D11Renderer::createDescriptorSetLayout(const DescriptorSetLayout::Desc&
rangeInfo.arrayIndex = counts[typeIndex];
counts[typeIndex] += rangeDesc.count;
}
- descriptorSetLayoutImpl->m_ranges.Add(rangeInfo);
+ descriptorSetLayoutImpl->m_ranges.add(rangeInfo);
}
for(int ii = 0; ii < int(D3D11DescriptorSlotType::CountOf); ++ii)
@@ -1845,7 +1845,7 @@ Result D3D11Renderer::createPipelineLayout(const PipelineLayout::Desc& desc, Pip
counts[jj] += setInfo.layout->m_counts[jj];
}
- pipelineLayoutImpl->m_descriptorSets.Add(setInfo);
+ pipelineLayoutImpl->m_descriptorSets.add(setInfo);
}
pipelineLayoutImpl->m_uavCount = UINT(counts[int(D3D11DescriptorSlotType::UnorderedAccessView)]);
@@ -1861,10 +1861,10 @@ Result D3D11Renderer::createDescriptorSet(DescriptorSetLayout* layout, Descripto
RefPtr<DescriptorSetImpl> descriptorSetImpl = new DescriptorSetImpl();
descriptorSetImpl->m_layout = layoutImpl;
- descriptorSetImpl->m_cbs .SetSize(layoutImpl->m_counts[int(D3D11DescriptorSlotType::ConstantBuffer)]);
- descriptorSetImpl->m_srvs .SetSize(layoutImpl->m_counts[int(D3D11DescriptorSlotType::ShaderResourceView)]);
- descriptorSetImpl->m_uavs .SetSize(layoutImpl->m_counts[int(D3D11DescriptorSlotType::UnorderedAccessView)]);
- descriptorSetImpl->m_samplers.SetSize(layoutImpl->m_counts[int(D3D11DescriptorSlotType::Sampler)]);
+ descriptorSetImpl->m_cbs .setCount(layoutImpl->m_counts[int(D3D11DescriptorSlotType::ConstantBuffer)]);
+ descriptorSetImpl->m_srvs .setCount(layoutImpl->m_counts[int(D3D11DescriptorSlotType::ShaderResourceView)]);
+ descriptorSetImpl->m_uavs .setCount(layoutImpl->m_counts[int(D3D11DescriptorSlotType::UnorderedAccessView)]);
+ descriptorSetImpl->m_samplers.setCount(layoutImpl->m_counts[int(D3D11DescriptorSlotType::Sampler)]);
*outDescriptorSet = descriptorSetImpl.detach();
return SLANG_OK;
@@ -2097,7 +2097,7 @@ void D3D11Renderer::_applyBindingState(bool isCompute)
else
context->OMSetRenderTargetsAndUnorderedAccessViews(
m_currentBindings->getDesc().m_numRenderTargets,
- m_renderTargetViews.Buffer()->readRef(),
+ m_renderTargetViews.getBuffer()->readRef(),
m_depthStencilView,
bindingIndex,
1,
diff --git a/tools/gfx/render-d3d12.cpp b/tools/gfx/render-d3d12.cpp
index 32eaf71e5..e3ce7161a 100644
--- a/tools/gfx/render-d3d12.cpp
+++ b/tools/gfx/render-d3d12.cpp
@@ -175,9 +175,9 @@ protected:
{
case BackingStyle::MemoryBacked:
{
- const size_t bufferSize = m_memory.Count();
+ const size_t bufferSize = m_memory.getCount();
D3D12CircularResourceHeap::Cursor cursor = circularHeap.allocateConstantBuffer(bufferSize);
- ::memcpy(cursor.m_position, m_memory.Buffer(), bufferSize);
+ ::memcpy(cursor.m_position, m_memory.getBuffer(), bufferSize);
// Set the constant buffer
submitter->setRootConstantBufferView(index, circularHeap.getGpuHandle(cursor));
break;
@@ -1000,7 +1000,7 @@ Result D3D12Renderer::calcComputePipelineState(ComPtr<ID3D12RootSignature>& sign
// Describe and create the compute pipeline state object
D3D12_COMPUTE_PIPELINE_STATE_DESC computeDesc = {};
computeDesc.pRootSignature = rootSignature;
- computeDesc.CS = { m_boundShaderProgram->m_computeShader.Buffer(), m_boundShaderProgram->m_computeShader.Count() };
+ computeDesc.CS = { m_boundShaderProgram->m_computeShader.getBuffer(), m_boundShaderProgram->m_computeShader.Count() };
SLANG_RETURN_ON_FAIL(m_device->CreateComputePipelineState(&computeDesc, IID_PPV_ARGS(pipelineState.writeRef())));
}
@@ -1324,7 +1324,7 @@ Result D3D12Renderer::_createDevice(DeviceCheckFlags deviceCheckFlags, const Uno
ComPtr<ID3D12Device> device;
ComPtr<IDXGIAdapter> adapter;
- for (int i = 0; i < int(dxgiAdapters.Count()); ++i)
+ for (Index i = 0; i < dxgiAdapters.getCount(); ++i)
{
IDXGIAdapter* dxgiAdapter = dxgiAdapters[i];
if (SLANG_SUCCEEDED(m_D3D12CreateDevice(dxgiAdapter, featureLevel, IID_PPV_ARGS(device.writeRef()))))
@@ -1501,7 +1501,7 @@ Result D3D12Renderer::initialize(const Desc& desc, void* inWindowHandle)
featureShaderModel.HighestShaderModel >= 0x62)
{
// With sm_6_2 we have half
- m_features.Add("half");
+ m_features.add("half");
}
}
// Check what min precision support we have
@@ -1965,11 +1965,11 @@ Result D3D12Renderer::createTextureResource(Resource::Usage initialUsage, const
// Calculate the layout
List<D3D12_PLACED_SUBRESOURCE_FOOTPRINT> layouts;
- layouts.SetSize(numMipMaps);
+ layouts.setCount(numMipMaps);
List<UInt64> mipRowSizeInBytes;
- mipRowSizeInBytes.SetSize(numMipMaps);
+ mipRowSizeInBytes.setCount(numMipMaps);
List<UInt32> mipNumRows;
- mipNumRows.SetSize(numMipMaps);
+ mipNumRows.setCount(numMipMaps);
// Since textures are effectively immutable currently initData must be set
assert(initData);
@@ -2052,7 +2052,7 @@ Result D3D12Renderer::createTextureResource(Resource::Usage initialUsage, const
}
}
- //assert(srcRow == (const uint8_t*)(srcMip.Buffer() + srcMip.Count()));
+ //assert(srcRow == (const uint8_t*)(srcMip.getBuffer() + srcMip.getCount()));
}
uploadResource->Unmap(0, nullptr);
@@ -2119,11 +2119,11 @@ Result D3D12Renderer::createBufferResource(Resource::Usage initialUsage, const B
{
// Assume the constant buffer will change every frame. We'll just keep a copy of the contents
// in regular memory until it needed
- buffer->m_memory.SetSize(UInt(alignedSizeInBytes));
+ buffer->m_memory.setCount(UInt(alignedSizeInBytes));
// Initialize
if (initData)
{
- ::memcpy(buffer->m_memory.Buffer(), initData, srcDesc.sizeInBytes);
+ ::memcpy(buffer->m_memory.getBuffer(), initData, srcDesc.sizeInBytes);
}
break;
}
@@ -2424,12 +2424,12 @@ Result D3D12Renderer::createInputLayout(const InputElementDesc* inputElements, U
const char* text = inputElements[i].semanticName;
textSize += text ? (::strlen(text) + 1) : 0;
}
- layout->m_text.SetSize(textSize);
- char* textPos = layout->m_text.Buffer();
+ layout->m_text.setCount(textSize);
+ char* textPos = layout->m_text.getBuffer();
//
List<D3D12_INPUT_ELEMENT_DESC>& elements = layout->m_elements;
- elements.SetSize(inputElementCount);
+ elements.setCount(inputElementCount);
for (UInt i = 0; i < inputElementCount; ++i)
@@ -2537,20 +2537,20 @@ void* D3D12Renderer::map(BufferResource* bufferIn, MapFlavor flavor)
SLANG_RETURN_NULL_ON_FAIL(stageBuf.getResource()->Map(0, &readRange, reinterpret_cast<void**>(&data)));
// Copy to memory buffer
- buffer->m_memory.SetSize(bufferSize);
- ::memcpy(buffer->m_memory.Buffer(), data, bufferSize);
+ buffer->m_memory.setCount(bufferSize);
+ ::memcpy(buffer->m_memory.getBuffer(), data, bufferSize);
stageBuf.getResource()->Unmap(0, nullptr);
}
- return buffer->m_memory.Buffer();
+ return buffer->m_memory.getBuffer();
}
}
break;
}
case Style::MemoryBacked:
{
- return buffer->m_memory.Buffer();
+ return buffer->m_memory.getBuffer();
}
default: return nullptr;
}
@@ -2636,10 +2636,10 @@ void D3D12Renderer::setPrimitiveTopology(PrimitiveTopology topology)
void D3D12Renderer::setVertexBuffers(UInt startSlot, UInt slotCount, BufferResource*const* buffers, const UInt* strides, const UInt* offsets)
{
{
- const UInt num = startSlot + slotCount;
- if (num > m_boundVertexBuffers.Count())
+ const Index num = startSlot + slotCount;
+ if (num > m_boundVertexBuffers.getCount())
{
- m_boundVertexBuffers.SetSize(num);
+ m_boundVertexBuffers.setCount(num);
}
}
@@ -2739,7 +2739,7 @@ void D3D12Renderer::draw(UInt vertexCount, UInt startVertex)
{
int numVertexViews = 0;
D3D12_VERTEX_BUFFER_VIEW vertexViews[16];
- for (int i = 0; i < int(m_boundVertexBuffers.Count()); i++)
+ for (Index i = 0; i < m_boundVertexBuffers.getCount(); i++)
{
const BoundVertexBuffer& boundVertexBuffer = m_boundVertexBuffers[i];
BufferResourceImpl* buffer = boundVertexBuffer.m_buffer;
@@ -3116,15 +3116,15 @@ Result D3D12Renderer::createProgram(const ShaderProgram::Desc& desc, ShaderProgr
if (desc.pipelineType == PipelineType::Compute)
{
auto computeKernel = desc.findKernel(StageType::Compute);
- program->m_computeShader.InsertRange(0, (const uint8_t*) computeKernel->codeBegin, computeKernel->getCodeSize());
+ program->m_computeShader.insertRange(0, (const uint8_t*) computeKernel->codeBegin, computeKernel->getCodeSize());
}
else
{
auto vertexKernel = desc.findKernel(StageType::Vertex);
auto fragmentKernel = desc.findKernel(StageType::Fragment);
- program->m_vertexShader.InsertRange(0, (const uint8_t*) vertexKernel->codeBegin, vertexKernel->getCodeSize());
- program->m_pixelShader.InsertRange(0, (const uint8_t*) fragmentKernel->codeBegin, fragmentKernel->getCodeSize());
+ program->m_vertexShader.insertRange(0, (const uint8_t*) vertexKernel->codeBegin, vertexKernel->getCodeSize());
+ program->m_pixelShader.insertRange(0, (const uint8_t*) fragmentKernel->codeBegin, fragmentKernel->getCodeSize());
}
*outProgram = program.detach();
@@ -3207,21 +3207,21 @@ Result D3D12Renderer::createDescriptorSetLayout(const DescriptorSetLayout::Desc&
D3D12_ROOT_PARAMETER dxRootParameter = {};
dxRootParameter.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
dxRootParameter.DescriptorTable.NumDescriptorRanges = UINT(totalResourceRangeCount);
- descriptorSetLayoutImpl->m_dxRootParameters.Add(dxRootParameter);
+ descriptorSetLayoutImpl->m_dxRootParameters.add(dxRootParameter);
}
if( totalSamplerRangeCount )
{
D3D12_ROOT_PARAMETER dxRootParameter = {};
dxRootParameter.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
dxRootParameter.DescriptorTable.NumDescriptorRanges = UINT(totalSamplerRangeCount);
- descriptorSetLayoutImpl->m_dxRootParameters.Add(dxRootParameter);
+ descriptorSetLayoutImpl->m_dxRootParameters.add(dxRootParameter);
}
// Next we can allocate space for all the D3D register ranges we need,
// again based on totals that we can compute easily:
//
Int totalRangeCount = totalResourceRangeCount + totalSamplerRangeCount;
- descriptorSetLayoutImpl->m_dxRanges.SetSize(totalRangeCount);
+ descriptorSetLayoutImpl->m_dxRanges.setCount(totalRangeCount);
// Now we will walk through the ranges in the order they were
// specified, so that we can fill in the "range info" required for
@@ -3272,7 +3272,7 @@ Result D3D12Renderer::createDescriptorSetLayout(const DescriptorSetLayout::Desc&
break;
}
- descriptorSetLayoutImpl->m_ranges.Add(rangeInfo);
+ descriptorSetLayoutImpl->m_ranges.add(rangeInfo);
}
}
@@ -3584,7 +3584,7 @@ Result D3D12Renderer::createDescriptorSet(DescriptorSetLayout* layout, Descripto
auto resourceHeap = &m_cpuViewHeap;
descriptorSetImpl->m_resourceHeap = resourceHeap;
descriptorSetImpl->m_resourceTable = resourceHeap->allocate(int(resourceCount));
- descriptorSetImpl->m_resourceObjects.SetSize(resourceCount);
+ descriptorSetImpl->m_resourceObjects.setCount(resourceCount);
}
Int samplerCount = layoutImpl->m_samplerCount;
@@ -3593,7 +3593,7 @@ Result D3D12Renderer::createDescriptorSet(DescriptorSetLayout* layout, Descripto
auto samplerHeap = &m_cpuSamplerHeap;
descriptorSetImpl->m_samplerHeap = samplerHeap;
descriptorSetImpl->m_samplerTable = samplerHeap->allocate(int(samplerCount));
- descriptorSetImpl->m_samplerObjects.SetSize(samplerCount);
+ descriptorSetImpl->m_samplerObjects.setCount(samplerCount);
}
*outDescriptorSet = descriptorSetImpl.detach();
@@ -3611,10 +3611,10 @@ Result D3D12Renderer::createGraphicsPipelineState(const GraphicsPipelineStateDes
psoDesc.pRootSignature = pipelineLayoutImpl->m_rootSignature;
- psoDesc.VS = { programImpl->m_vertexShader.Buffer(), programImpl->m_vertexShader.Count() };
- psoDesc.PS = { programImpl->m_pixelShader .Buffer(), programImpl->m_pixelShader .Count() };
+ psoDesc.VS = { programImpl->m_vertexShader.getBuffer(), SIZE_T(programImpl->m_vertexShader.getCount()) };
+ psoDesc.PS = { programImpl->m_pixelShader .getBuffer(), SIZE_T(programImpl->m_pixelShader .getCount()) };
- psoDesc.InputLayout = { inputLayoutImpl->m_elements.Buffer(), UINT(inputLayoutImpl->m_elements.Count()) };
+ psoDesc.InputLayout = { inputLayoutImpl->m_elements.getBuffer(), UINT(inputLayoutImpl->m_elements.getCount()) };
psoDesc.PrimitiveTopologyType = m_primitiveTopologyType;
{
@@ -3706,7 +3706,7 @@ Result D3D12Renderer::createComputePipelineState(const ComputePipelineStateDesc&
// Describe and create the compute pipeline state object
D3D12_COMPUTE_PIPELINE_STATE_DESC computeDesc = {};
computeDesc.pRootSignature = pipelineLayoutImpl->m_rootSignature;
- computeDesc.CS = { programImpl->m_computeShader.Buffer(), programImpl->m_computeShader.Count() };
+ computeDesc.CS = { programImpl->m_computeShader.getBuffer(), SIZE_T(programImpl->m_computeShader.getCount()) };
ComPtr<ID3D12PipelineState> pipelineState;
SLANG_RETURN_ON_FAIL(m_device->CreateComputePipelineState(&computeDesc, IID_PPV_ARGS(pipelineState.writeRef())));
diff --git a/tools/gfx/render-gl.cpp b/tools/gfx/render-gl.cpp
index a3703a75b..c20eb7e6d 100644
--- a/tools/gfx/render-gl.cpp
+++ b/tools/gfx/render-gl.cpp
@@ -4,7 +4,6 @@
//WORKING:#include "options.h"
#include "render.h"
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "core/basic.h"
@@ -447,8 +446,8 @@ void GLRenderer::bindBufferImpl(int target, UInt startSlot, UInt slotCount, Buff
void GLRenderer::flushStateForDraw()
{
auto inputLayout = m_currentPipelineState->m_inputLayout.Ptr();
- auto attrCount = inputLayout->m_attributeCount;
- for (UInt ii = 0; ii < attrCount; ++ii)
+ auto attrCount = Index(inputLayout->m_attributeCount);
+ for (Index ii = 0; ii < attrCount; ++ii)
{
auto& attr = inputLayout->m_attributes[ii];
@@ -466,15 +465,15 @@ void GLRenderer::flushStateForDraw()
glEnableVertexAttribArray((GLuint)ii);
}
- for (UInt ii = attrCount; ii < kMaxVertexStreams; ++ii)
+ for (Index ii = attrCount; ii < kMaxVertexStreams; ++ii)
{
glDisableVertexAttribArray((GLuint)ii);
}
// Next bind the descriptor sets as required by the layout
auto pipelineLayout = m_currentPipelineState->m_pipelineLayout;
- auto descriptorSetCount = pipelineLayout->m_sets.Count();
- for(UInt ii = 0; ii < descriptorSetCount; ++ii)
+ auto descriptorSetCount = pipelineLayout->m_sets.getCount();
+ for(Index ii = 0; ii < descriptorSetCount; ++ii)
{
auto descriptorSet = m_boundDescriptorSets[ii];
auto descriptorSetInfo = pipelineLayout->m_sets[ii];
@@ -678,13 +677,13 @@ SlangResult GLRenderer::initialize(const Desc& desc, void* inWindowHandle)
auto renderer = glGetString(GL_RENDERER);
- if (renderer && desc.adapter.Length() > 0)
+ if (renderer && desc.adapter.getLength() > 0)
{
- String lowerAdapter = desc.adapter.ToLower();
- String lowerRenderer = String((const char*)renderer).ToLower();
+ String lowerAdapter = desc.adapter.toLower();
+ String lowerRenderer = String((const char*)renderer).toLower();
// The adapter is not available
- if (lowerRenderer.IndexOf(lowerAdapter) == UInt(-1))
+ if (lowerRenderer.indexOf(lowerAdapter) == Index(-1))
{
return SLANG_E_NOT_AVAILABLE;
}
@@ -1329,7 +1328,7 @@ Result GLRenderer::createDescriptorSetLayout(const DescriptorSetLayout::Desc& de
rangeInfo.arrayIndex = counts[int(glSlotType)];
counts[int(glSlotType)] += rangeDesc.count;
- layoutImpl->m_ranges.Add(rangeInfo);
+ layoutImpl->m_ranges.add(rangeInfo);
}
for( Int ii = 0; ii < int(GLDescriptorSlotType::CountOf); ++ii )
@@ -1362,7 +1361,7 @@ Result GLRenderer::createPipelineLayout(const PipelineLayout::Desc& desc, Pipeli
counts[ii] += setLayout->m_counts[ii];
}
- layoutImpl->m_sets.Add(setInfo);
+ layoutImpl->m_sets.add(setInfo);
}
*outLayout = layoutImpl.detach();
@@ -1384,15 +1383,15 @@ Result GLRenderer::createDescriptorSet(DescriptorSetLayout* layout, DescriptorSe
{
auto slotTypeIndex = int(GLDescriptorSlotType::ConstantBuffer);
auto slotCount = layoutImpl->m_counts[slotTypeIndex];
- descriptorSetImpl->m_constantBuffers.SetSize(slotCount);
+ descriptorSetImpl->m_constantBuffers.setCount(slotCount);
}
{
auto slotTypeIndex = int(GLDescriptorSlotType::CombinedTextureSampler);
auto slotCount = layoutImpl->m_counts[slotTypeIndex];
- descriptorSetImpl->m_textures.SetSize(slotCount);
- descriptorSetImpl->m_samplers.SetSize(slotCount);
+ descriptorSetImpl->m_textures.setCount(slotCount);
+ descriptorSetImpl->m_samplers.setCount(slotCount);
}
*outDescriptorSet = descriptorSetImpl.detach();
diff --git a/tools/gfx/render-vk.cpp b/tools/gfx/render-vk.cpp
index 30eff04c9..c76a8e42d 100644
--- a/tools/gfx/render-vk.cpp
+++ b/tools/gfx/render-vk.cpp
@@ -619,7 +619,7 @@ Slang::Result VKRenderer::_createPipeline(RefPtr<Pipeline>& pipelineOut)
vertexInputInfo.pVertexBindingDescriptions = &vertexInputBindingDescription;
vertexInputInfo.vertexAttributeDescriptionCount = static_cast<uint32_t>(srcAttributeDescs.Count());
- vertexInputInfo.pVertexAttributeDescriptions = srcAttributeDescs.Buffer();
+ vertexInputInfo.pVertexAttributeDescriptions = srcAttributeDescs.getBuffer();
}
//
@@ -825,8 +825,8 @@ VkBool32 VKRenderer::handleDebugMessage(VkDebugReportFlagsEXT flags, VkDebugRepo
// Use a dynamic buffer to store
size_t bufferSize = strlen(pMsg) + 1 + 1024;
List<char> bufferArray;
- bufferArray.SetSize(bufferSize);
- char* buffer = bufferArray.Buffer();
+ bufferArray.setCount(bufferSize);
+ char* buffer = bufferArray.getBuffer();
sprintf_s(buffer,
bufferSize,
@@ -862,9 +862,9 @@ VkPipelineShaderStageCreateInfo VKRenderer::compileEntryPoint(
// will free the memory after a compile request is closed.
size_t codeSize = dataEnd - dataBegin;
- bufferOut.InsertRange(0, dataBegin, codeSize);
+ bufferOut.insertRange(0, dataBegin, codeSize);
- char* codeBegin = bufferOut.Buffer();
+ char* codeBegin = bufferOut.getBuffer();
VkShaderModuleCreateInfo moduleCreateInfo = { VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO };
moduleCreateInfo.pCode = (uint32_t*)codeBegin;
@@ -945,27 +945,27 @@ SlangResult VKRenderer::initialize(const Desc& desc, void* inWindowHandle)
SLANG_VK_RETURN_ON_FAIL(m_api.vkEnumeratePhysicalDevices(instance, &numPhysicalDevices, nullptr));
List<VkPhysicalDevice> physicalDevices;
- physicalDevices.SetSize(numPhysicalDevices);
- SLANG_VK_RETURN_ON_FAIL(m_api.vkEnumeratePhysicalDevices(instance, &numPhysicalDevices, physicalDevices.Buffer()));
+ physicalDevices.setCount(numPhysicalDevices);
+ SLANG_VK_RETURN_ON_FAIL(m_api.vkEnumeratePhysicalDevices(instance, &numPhysicalDevices, physicalDevices.getBuffer()));
- int32_t selectedDeviceIndex = 0;
+ Index selectedDeviceIndex = 0;
- if (desc.adapter.Length())
+ if (desc.adapter.getLength())
{
selectedDeviceIndex = -1;
- String lowerAdapter = desc.adapter.ToLower();
+ String lowerAdapter = desc.adapter.toLower();
- for (int i = 0; i < int(physicalDevices.Count()); ++i)
+ for (Index i = 0; i < physicalDevices.getCount(); ++i)
{
auto physicalDevice = physicalDevices[i];
VkPhysicalDeviceProperties basicProps = {};
m_api.vkGetPhysicalDeviceProperties(physicalDevice, &basicProps);
- String lowerName = String(basicProps.deviceName).ToLower();
+ String lowerName = String(basicProps.deviceName).toLower();
- if (lowerName.IndexOf(lowerAdapter) != UInt(-1))
+ if (lowerName.indexOf(lowerAdapter) != Index(-1))
{
selectedDeviceIndex = i;
break;
@@ -981,7 +981,7 @@ SlangResult VKRenderer::initialize(const Desc& desc, void* inWindowHandle)
SLANG_RETURN_ON_FAIL(m_api.initPhysicalDevice(physicalDevices[selectedDeviceIndex]));
List<const char*> deviceExtensions;
- deviceExtensions.Add(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
+ deviceExtensions.add(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
VkDeviceCreateInfo deviceCreateInfo = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
deviceCreateInfo.queueCreateInfoCount = 1;
@@ -1038,10 +1038,10 @@ SlangResult VKRenderer::initialize(const Desc& desc, void* inWindowHandle)
deviceCreateInfo.pNext = &float16Features;
// Add the Float16 extension
- deviceExtensions.Add(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME);
+ deviceExtensions.add(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME);
// We have half support
- m_features.Add("half");
+ m_features.add("half");
}
}
@@ -1056,8 +1056,8 @@ SlangResult VKRenderer::initialize(const Desc& desc, void* inWindowHandle)
deviceCreateInfo.pQueueCreateInfos = &queueCreateInfo;
- deviceCreateInfo.enabledExtensionCount = uint32_t(deviceExtensions.Count());
- deviceCreateInfo.ppEnabledExtensionNames = deviceExtensions.Buffer();
+ deviceCreateInfo.enabledExtensionCount = uint32_t(deviceExtensions.getCount());
+ deviceCreateInfo.ppEnabledExtensionNames = deviceExtensions.getBuffer();
SLANG_VK_RETURN_ON_FAIL(m_api.vkCreateDevice(m_api.m_physicalDevice, &deviceCreateInfo, nullptr, &m_device));
SLANG_RETURN_ON_FAIL(m_api.initDeviceProcs(m_device));
@@ -1479,7 +1479,7 @@ Result VKRenderer::createTextureResource(Resource::Usage initialUsage, const Tex
const int rowSizeInBytes = Surface::calcRowSize(desc.format, mipSize.width);
const int numRows = Surface::calcNumRows(desc.format, mipSize.height);
- mipSizes.Add(mipSize);
+ mipSizes.add(mipSize);
bufferSize += (rowSizeInBytes * numRows) * mipSize.depth;
}
@@ -1491,7 +1491,7 @@ Result VKRenderer::createTextureResource(Resource::Usage initialUsage, const Tex
Buffer uploadBuffer;
SLANG_RETURN_ON_FAIL(uploadBuffer.init(m_api, bufferSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT));
- assert(mipSizes.Count() == numMipMaps);
+ assert(mipSizes.getCount() == numMipMaps);
// Copy into upload buffer
{
@@ -1502,7 +1502,7 @@ Result VKRenderer::createTextureResource(Resource::Usage initialUsage, const Tex
for (int i = 0; i < arraySize; ++i)
{
- for (int j = 0; j < int(mipSizes.Count()); ++j)
+ for (Index j = 0; j < mipSizes.getCount(); ++j)
{
const auto& mipSize = mipSizes[j];
@@ -1536,7 +1536,7 @@ Result VKRenderer::createTextureResource(Resource::Usage initialUsage, const Tex
size_t srcOffset = 0;
for (int i = 0; i < arraySize; ++i)
{
- for (int j = 0; j < int(mipSizes.Count()); ++j)
+ for (Index j = 0; j < mipSizes.getCount(); ++j)
{
const auto& mipSize = mipSizes[j];
@@ -1555,7 +1555,7 @@ Result VKRenderer::createTextureResource(Resource::Usage initialUsage, const Tex
region.bufferImageHeight = 0;
region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- region.imageSubresource.mipLevel = j;
+ region.imageSubresource.mipLevel = uint32_t(j);
region.imageSubresource.baseArrayLayer = i;
region.imageSubresource.layerCount = 1;
region.imageOffset = { 0, 0, 0 };
@@ -1829,7 +1829,7 @@ Result VKRenderer::createInputLayout(const InputElementDesc* elements, UInt numE
List<VkVertexInputAttributeDescription>& dstVertexDescs = layout->m_vertexDescs;
size_t vertexSize = 0;
- dstVertexDescs.SetSize(numElements);
+ dstVertexDescs.setCount(numElements);
for (UInt i = 0; i < numElements; ++i)
{
@@ -1887,7 +1887,7 @@ void* VKRenderer::map(BufferResource* bufferIn, MapFlavor flavor)
case MapFlavor::HostRead:
{
// Make sure there is space in the read buffer
- buffer->m_readBuffer.SetSize(bufferSize);
+ buffer->m_readBuffer.setCount(bufferSize);
// create staging buffer
Buffer staging;
@@ -1907,12 +1907,12 @@ void* VKRenderer::map(BufferResource* bufferIn, MapFlavor flavor)
void* mappedData = nullptr;
SLANG_VK_CHECK(m_api.vkMapMemory(m_device, staging.m_memory, 0, bufferSize, 0, &mappedData));
- ::memcpy(buffer->m_readBuffer.Buffer(), mappedData, bufferSize);
+ ::memcpy(buffer->m_readBuffer.getBuffer(), mappedData, bufferSize);
m_api.vkUnmapMemory(m_device, staging.m_memory);
buffer->m_mapFlavor = flavor;
- return buffer->m_readBuffer.Buffer();
+ return buffer->m_readBuffer.getBuffer();
}
default:
return nullptr;
@@ -1959,14 +1959,14 @@ void VKRenderer::setPrimitiveTopology(PrimitiveTopology topology)
void VKRenderer::setVertexBuffers(UInt startSlot, UInt slotCount, BufferResource*const* buffers, const UInt* strides, const UInt* offsets)
{
{
- const UInt num = startSlot + slotCount;
- if (num > m_boundVertexBuffers.Count())
+ const Index num = Index(startSlot + slotCount);
+ if (num > m_boundVertexBuffers.getCount())
{
- m_boundVertexBuffers.SetSize(num);
+ m_boundVertexBuffers.setCount(num);
}
}
- for (UInt i = 0; i < slotCount; i++)
+ for (Index i = 0; i < Index(slotCount); i++)
{
BufferResourceImpl* buffer = static_cast<BufferResourceImpl*>(buffers[i]);
if (buffer)
@@ -2061,7 +2061,7 @@ void VKRenderer::draw(UInt vertexCount, UInt startVertex = 0)
0, nullptr);
// Bind the vertex buffer
- if (m_boundVertexBuffers.Count() > 0 && m_boundVertexBuffers[0].m_buffer)
+ if (m_boundVertexBuffers.getCount() > 0 && m_boundVertexBuffers[0].m_buffer)
{
const BoundVertexBuffer& boundVertexBuffer = m_boundVertexBuffers[0];
@@ -2314,16 +2314,16 @@ Result VKRenderer::createDescriptorSetLayout(const DescriptorSetLayout::Desc& de
descriptorCountForTypes[dstDescriptorType] += uint32_t(srcRange.count);
- dstBindings.Add(dstBinding);
+ dstBindings.add(dstBinding);
DescriptorSetLayoutImpl::RangeInfo rangeInfo;
rangeInfo.descriptorType = dstDescriptorType;
- descriptorSetLayoutImpl->m_ranges.Add(rangeInfo);
+ descriptorSetLayoutImpl->m_ranges.add(rangeInfo);
}
VkDescriptorSetLayoutCreateInfo descriptorSetLayoutInfo = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO };
- descriptorSetLayoutInfo.bindingCount = uint32_t(dstBindings.Count());
- descriptorSetLayoutInfo.pBindings = dstBindings.Buffer();
+ descriptorSetLayoutInfo.bindingCount = uint32_t(dstBindings.getCount());
+ descriptorSetLayoutInfo.pBindings = dstBindings.getBuffer();
VkDescriptorSetLayout descriptorSetLayout = VK_NULL_HANDLE;
SLANG_VK_CHECK(m_api.vkCreateDescriptorSetLayout(m_device, &descriptorSetLayoutInfo, nullptr, &descriptorSetLayout));
@@ -2428,8 +2428,8 @@ void VKRenderer::DescriptorSetImpl::_setBinding(Binding::Type type, UInt range,
{
SLANG_ASSERT(ptr == nullptr || _getBindingType(ptr) == type);
- const int numBindings = int(m_bindings.Count());
- for (int i = 0; i < numBindings; ++i)
+ const Index numBindings = m_bindings.getCount();
+ for (Index i = 0; i < numBindings; ++i)
{
Binding& binding = m_bindings[i];
@@ -2441,7 +2441,7 @@ void VKRenderer::DescriptorSetImpl::_setBinding(Binding::Type type, UInt range,
}
else
{
- m_bindings.RemoveAt(i);
+ m_bindings.removeAt(i);
}
return;
@@ -2457,7 +2457,7 @@ void VKRenderer::DescriptorSetImpl::_setBinding(Binding::Type type, UInt range,
binding.index = uint32_t(index);
binding.obj = ptr;
- m_bindings.Add(binding);
+ m_bindings.add(binding);
}
}
@@ -2654,8 +2654,8 @@ Result VKRenderer::createGraphicsPipelineState(const GraphicsPipelineStateDesc&
vertexInputInfo.vertexBindingDescriptionCount = 1;
vertexInputInfo.pVertexBindingDescriptions = &vertexInputBindingDescription;
- vertexInputInfo.vertexAttributeDescriptionCount = static_cast<uint32_t>(srcAttributeDescs.Count());
- vertexInputInfo.pVertexAttributeDescriptions = srcAttributeDescs.Buffer();
+ vertexInputInfo.vertexAttributeDescriptionCount = static_cast<uint32_t>(srcAttributeDescs.getCount());
+ vertexInputInfo.pVertexAttributeDescriptions = srcAttributeDescs.getBuffer();
}
VkPipelineInputAssemblyStateCreateInfo inputAssembly = {};
diff --git a/tools/gfx/render.h b/tools/gfx/render.h
index c95652cd0..292b4f8f8 100644
--- a/tools/gfx/render.h
+++ b/tools/gfx/render.h
@@ -788,7 +788,7 @@ public:
virtual SlangResult initialize(const Desc& desc, void* inWindowHandle) = 0;
- bool hasFeature(const Slang::UnownedStringSlice& feature) { return getFeatures().IndexOf(Slang::String(feature)) != UInt(-1); }
+ bool hasFeature(const Slang::UnownedStringSlice& feature) { return getFeatures().indexOf(Slang::String(feature)) != Slang::Index(-1); }
virtual const Slang::List<Slang::String>& getFeatures() = 0;
virtual void setClearColor(const float color[4]) = 0;
diff --git a/tools/gfx/resource-d3d12.cpp b/tools/gfx/resource-d3d12.cpp
index 2e0f78371..27de868b6 100644
--- a/tools/gfx/resource-d3d12.cpp
+++ b/tools/gfx/resource-d3d12.cpp
@@ -1,4 +1,4 @@
-// resource-d3d12.cpp
+// resource-d3d12.cpp
#include "resource-d3d12.h"
namespace gfx {
@@ -135,7 +135,7 @@ void D3D12CounterFence::nextSignalAndWait(ID3D12CommandQueue* commandQueue)
{
size_t len = ::strlen(name);
List<wchar_t> buf;
- buf.SetSize(len + 1);
+ buf.setCount(len + 1);
D3DUtil::appendWideChars(name, buf);
resource->SetName(buf.begin());
diff --git a/tools/gfx/surface.cpp b/tools/gfx/surface.cpp
index 4b53d278a..63fd7087c 100644
--- a/tools/gfx/surface.cpp
+++ b/tools/gfx/surface.cpp
@@ -1,4 +1,4 @@
-// surface.cpp
+// surface.cpp
#include "surface.h"
#include <stdlib.h>
@@ -174,8 +174,8 @@ void Surface::flipInplaceVertically()
uint8_t* bottom = m_data + (m_numRows - 1) * m_rowStrideInBytes;
List<uint8_t> bufferList;
- bufferList.SetSize(rowSizeInBytes);
- uint8_t* buffer = bufferList.Buffer();
+ bufferList.setCount(rowSizeInBytes);
+ uint8_t* buffer = bufferList.getBuffer();
const int stride = m_rowStrideInBytes;
diff --git a/tools/gfx/vk-api.cpp b/tools/gfx/vk-api.cpp
index 6e250e281..304513d24 100644
--- a/tools/gfx/vk-api.cpp
+++ b/tools/gfx/vk-api.cpp
@@ -121,8 +121,8 @@ int VulkanApi::findQueue(VkQueueFlags reqFlags) const
vkGetPhysicalDeviceQueueFamilyProperties(m_physicalDevice, &numQueueFamilies, nullptr);
Slang::List<VkQueueFamilyProperties> queueFamilies;
- queueFamilies.SetSize(numQueueFamilies);
- vkGetPhysicalDeviceQueueFamilyProperties(m_physicalDevice, &numQueueFamilies, queueFamilies.Buffer());
+ queueFamilies.setCount(numQueueFamilies);
+ vkGetPhysicalDeviceQueueFamilyProperties(m_physicalDevice, &numQueueFamilies, queueFamilies.getBuffer());
// Find a queue that can service our needs
//VkQueueFlags reqQueueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT;
diff --git a/tools/gfx/vk-swap-chain.cpp b/tools/gfx/vk-swap-chain.cpp
index 6e89c946c..340e6a6a4 100644
--- a/tools/gfx/vk-swap-chain.cpp
+++ b/tools/gfx/vk-swap-chain.cpp
@@ -13,10 +13,10 @@ using namespace Slang;
static int _indexOf(List<VkSurfaceFormatKHR>& formatsIn, VkFormat format)
{
- const int numFormats = int(formatsIn.Count());
- const VkSurfaceFormatKHR* formats = formatsIn.Buffer();
+ const Index numFormats = formatsIn.getCount();
+ const VkSurfaceFormatKHR* formats = formatsIn.getBuffer();
- for (int i = 0; i < numFormats; ++i)
+ for (Index i = 0; i < numFormats; ++i)
{
if (formats[i].format == format)
{
@@ -66,19 +66,19 @@ SlangResult VulkanSwapChain::init(VulkanDeviceQueue* deviceQueue, const Desc& de
uint32_t numSurfaceFormats = 0;
List<VkSurfaceFormatKHR> surfaceFormats;
m_api->vkGetPhysicalDeviceSurfaceFormatsKHR(m_api->m_physicalDevice, m_surface, &numSurfaceFormats, nullptr);
- surfaceFormats.SetSize(int(numSurfaceFormats));
- m_api->vkGetPhysicalDeviceSurfaceFormatsKHR(m_api->m_physicalDevice, m_surface, &numSurfaceFormats, surfaceFormats.Buffer());
+ surfaceFormats.setCount(int(numSurfaceFormats));
+ m_api->vkGetPhysicalDeviceSurfaceFormatsKHR(m_api->m_physicalDevice, m_surface, &numSurfaceFormats, surfaceFormats.getBuffer());
// Look for a suitable format
List<VkFormat> formats;
- formats.Add(VulkanUtil::getVkFormat(desc.m_format));
+ formats.add(VulkanUtil::getVkFormat(desc.m_format));
// HACK! To check for a different format if couldn't be found
if (descIn.m_format == Format::RGBA_Unorm_UInt8)
{
- formats.Add(VK_FORMAT_B8G8R8A8_UNORM);
+ formats.add(VK_FORMAT_B8G8R8A8_UNORM);
}
- for(int i = 0; i < int(formats.Count()); ++i)
+ for(Index i = 0; i < formats.getCount(); ++i)
{
VkFormat format = formats[i];
if (_indexOf(surfaceFormats, format) >= 0)
@@ -125,7 +125,7 @@ SlangResult VulkanSwapChain::_createFrameBuffers(VkRenderPass renderPass)
{
assert(renderPass != VK_NULL_HANDLE);
- for (int i = 0; i < int(m_images.Count()); ++i)
+ for (Index i = 0; i < m_images.getCount(); ++i)
{
Image& image = m_images[i];
VkImageView attachments[] =
@@ -150,7 +150,7 @@ SlangResult VulkanSwapChain::_createFrameBuffers(VkRenderPass renderPass)
void VulkanSwapChain::_destroyFrameBuffers()
{
- for (int i = 0; i < int(m_images.Count()); ++i)
+ for (Index i = 0; i < m_images.getCount(); ++i)
{
Image& image = m_images[i];
if (image.m_frameBuffer != VK_NULL_HANDLE)
@@ -209,8 +209,8 @@ SlangResult VulkanSwapChain::_createSwapChain()
List<VkPresentModeKHR> presentModes;
uint32_t numPresentModes = 0;
m_api->vkGetPhysicalDeviceSurfacePresentModesKHR(m_api->m_physicalDevice, m_surface, &numPresentModes, nullptr);
- presentModes.SetSize(numPresentModes);
- m_api->vkGetPhysicalDeviceSurfacePresentModesKHR(m_api->m_physicalDevice, m_surface, &numPresentModes, presentModes.Buffer());
+ presentModes.setCount(numPresentModes);
+ m_api->vkGetPhysicalDeviceSurfacePresentModesKHR(m_api->m_physicalDevice, m_surface, &numPresentModes, presentModes.getBuffer());
{
int numCheckPresentOptions = 3;
@@ -227,7 +227,7 @@ SlangResult VulkanSwapChain::_createSwapChain()
// Find the first option that's available on the device
for (int j = 0; j < numCheckPresentOptions; j++)
{
- if (presentModes.IndexOf(presentOptions[j]) != UInt(-1))
+ if (presentModes.indexOf(presentOptions[j]) != Index(-1))
{
m_presentMode = presentOptions[j];
break;
@@ -265,11 +265,11 @@ SlangResult VulkanSwapChain::_createSwapChain()
{
List<VkImage> images;
- images.SetSize(numSwapChainImages);
+ images.setCount(numSwapChainImages);
- m_api->vkGetSwapchainImagesKHR(m_api->m_device, m_swapChain, &numSwapChainImages, images.Buffer());
+ m_api->vkGetSwapchainImagesKHR(m_api->m_device, m_swapChain, &numSwapChainImages, images.getBuffer());
- m_images.SetSize(numSwapChainImages);
+ m_images.setCount(numSwapChainImages);
for (int i = 0; i < int(numSwapChainImages); ++i)
{
Image& dstImage = m_images[i];
@@ -328,7 +328,7 @@ void VulkanSwapChain::_destroySwapChain()
_destroyFrameBuffers();
}
- for (int i = 0; i < int(m_images.Count()); ++i)
+ for (Index i = 0; i < m_images.getCount(); ++i)
{
Image& image = m_images[i];
@@ -345,7 +345,7 @@ void VulkanSwapChain::_destroySwapChain()
}
// Mark that it is no longer used
- m_images.Clear();
+ m_images.clear();
}
VulkanSwapChain::~VulkanSwapChain()
diff --git a/tools/gfx/vk-swap-chain.h b/tools/gfx/vk-swap-chain.h
index 12feb0ed5..ad2357315 100644
--- a/tools/gfx/vk-swap-chain.h
+++ b/tools/gfx/vk-swap-chain.h
@@ -72,7 +72,7 @@ struct VulkanSwapChain
const Desc& getDesc() const { return m_desc; }
/// True if the swap chain is available
- bool hasValidSwapChain() const { return m_images.Count() > 0; }
+ bool hasValidSwapChain() const { return m_images.getCount() > 0; }
/// Present to the display
void present(bool vsync);
@@ -105,11 +105,11 @@ struct VulkanSwapChain
{
const PlatformDesc* check = &desc;
int size = (sizeof(T) + sizeof(void*) - 1) / sizeof(void*);
- m_platformDescBuffer.SetSize(size);
- *(T*)m_platformDescBuffer.Buffer() = desc;
+ m_platformDescBuffer.setCount(size);
+ *(T*)m_platformDescBuffer.getBuffer() = desc;
}
template <typename T>
- const T* _getPlatformDesc() const { return static_cast<const T*>((const PlatformDesc*)m_platformDescBuffer.Buffer()); }
+ const T* _getPlatformDesc() const { return static_cast<const T*>((const PlatformDesc*)m_platformDescBuffer.getBuffer()); }
SlangResult _createSwapChain();
void _destroySwapChain();
SlangResult _createFrameBuffers(VkRenderPass renderPass);
diff --git a/tools/render-test/options.cpp b/tools/render-test/options.cpp
index 2277a6ad7..17ba864f7 100644
--- a/tools/render-test/options.cpp
+++ b/tools/render-test/options.cpp
@@ -72,7 +72,7 @@ SlangResult parseOptions(int argc, const char*const* argv, Slang::WriterHelper s
char const* arg = *argCursor++;
if( arg[0] != '-' )
{
- positionalArgs.Add(arg);
+ positionalArgs.add(arg);
continue;
}
@@ -80,7 +80,7 @@ SlangResult parseOptions(int argc, const char*const* argv, Slang::WriterHelper s
{
while(argCursor != argEnd)
{
- positionalArgs.Add(*argCursor++);
+ positionalArgs.add(*argCursor++);
}
break;
}
@@ -116,7 +116,7 @@ SlangResult parseOptions(int argc, const char*const* argv, Slang::WriterHelper s
for (const auto& value : values)
{
- gOptions.renderFeatures.Add(value);
+ gOptions.renderFeatures.add(value);
}
}
else if( strcmp(arg, "-xslang") == 0 )
@@ -200,14 +200,14 @@ SlangResult parseOptions(int argc, const char*const* argv, Slang::WriterHelper s
gOptions.rendererType = (gOptions.rendererType == RendererType::Unknown) ? gOptions.targetLanguageRendererType : gOptions.rendererType;
// first positional argument is source shader path
- if(positionalArgs.Count())
+ if(positionalArgs.getCount())
{
gOptions.sourcePath = positionalArgs[0];
- positionalArgs.RemoveAt(0);
+ positionalArgs.removeAt(0);
}
// any remaining arguments represent an error
- if(positionalArgs.Count() != 0)
+ if(positionalArgs.getCount() != 0)
{
stdError.print("unexpected arguments\n");
return SLANG_FAIL;
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index 34e041473..f82e03ad5 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -351,8 +351,8 @@ Result RenderTestApp::initializeShaders(ShaderCompiler* shaderCompiler)
fseek(sourceFile, 0, SEEK_SET);
List<char> sourceText;
- sourceText.SetSize(sourceSize + 1);
- fread(sourceText.Buffer(), sourceSize, 1, sourceFile);
+ sourceText.setCount(sourceSize + 1);
+ fread(sourceText.getBuffer(), sourceSize, 1, sourceFile);
fclose(sourceFile);
sourceText[sourceSize] = 0;
@@ -366,12 +366,12 @@ Result RenderTestApp::initializeShaders(ShaderCompiler* shaderCompiler)
m_shaderInputLayout.numRenderTargets = 0;
break;
}
- m_shaderInputLayout.Parse(sourceText.Buffer());
+ m_shaderInputLayout.Parse(sourceText.getBuffer());
ShaderCompileRequest::SourceInfo sourceInfo;
sourceInfo.path = sourcePath;
- sourceInfo.dataBegin = sourceText.Buffer();
- sourceInfo.dataEnd = sourceText.Buffer() + sourceSize;
+ sourceInfo.dataBegin = sourceText.getBuffer();
+ sourceInfo.dataEnd = sourceText.getBuffer() + sourceSize;
ShaderCompileRequest compileRequest;
compileRequest.source = sourceInfo;
@@ -558,7 +558,7 @@ SLANG_TEST_TOOL_API SlangResult innerMain(Slang::StdWriters* stdWriters, SlangSe
StringBuilder rendererName;
rendererName << "[" << RendererUtil::toText(gOptions.rendererType) << "] ";
- if (gOptions.adapter.Length())
+ if (gOptions.adapter.getLength())
{
rendererName << "'" << gOptions.adapter << "'";
}
@@ -568,7 +568,7 @@ SLANG_TEST_TOOL_API SlangResult innerMain(Slang::StdWriters* stdWriters, SlangSe
{
if (!gOptions.onlyStartup)
{
- fprintf(stderr, "Unable to create renderer %s\n", rendererName.Buffer());
+ fprintf(stderr, "Unable to create renderer %s\n", rendererName.getBuffer());
}
return SLANG_FAIL;
}
@@ -584,7 +584,7 @@ SLANG_TEST_TOOL_API SlangResult innerMain(Slang::StdWriters* stdWriters, SlangSe
{
if (!gOptions.onlyStartup)
{
- fprintf(stderr, "Unable to initialize renderer %s\n", rendererName.Buffer());
+ fprintf(stderr, "Unable to initialize renderer %s\n", rendererName.getBuffer());
}
return res;
}
diff --git a/tools/render-test/shader-input-layout.cpp b/tools/render-test/shader-input-layout.cpp
index 6d51a1980..644b0889e 100644
--- a/tools/render-test/shader-input-layout.cpp
+++ b/tools/render-test/shader-input-layout.cpp
@@ -8,17 +8,17 @@ namespace renderer_test
using namespace Slang;
void ShaderInputLayout::Parse(const char * source)
{
- entries.Clear();
- globalGenericTypeArguments.Clear();
- entryPointGenericTypeArguments.Clear();
- globalExistentialTypeArguments.Clear();
- entryPointExistentialTypeArguments.Clear();
+ entries.clear();
+ globalGenericTypeArguments.clear();
+ entryPointGenericTypeArguments.clear();
+ globalExistentialTypeArguments.clear();
+ entryPointExistentialTypeArguments.clear();
auto lines = Split(source, '\n');
for (auto & line : lines)
{
- if (line.StartsWith("//TEST_INPUT:"))
+ if (line.startsWith("//TEST_INPUT:"))
{
- auto lineContent = line.SubString(13, line.Length() - 13);
+ auto lineContent = line.subString(13, line.getLength() - 13);
TokenReader parser(lineContent);
try
{
@@ -28,7 +28,7 @@ namespace renderer_test
StringBuilder typeExp;
while (!parser.IsEnd())
typeExp << parser.ReadToken().Content;
- entryPointGenericTypeArguments.Add(typeExp);
+ entryPointGenericTypeArguments.add(typeExp);
}
else if (parser.LookAhead("global_type"))
{
@@ -36,7 +36,7 @@ namespace renderer_test
StringBuilder typeExp;
while (!parser.IsEnd())
typeExp << parser.ReadToken().Content;
- globalGenericTypeArguments.Add(typeExp);
+ globalGenericTypeArguments.add(typeExp);
}
else if (parser.LookAhead("globalExistentialType"))
{
@@ -44,7 +44,7 @@ namespace renderer_test
StringBuilder typeExp;
while (!parser.IsEnd())
typeExp << parser.ReadToken().Content;
- globalExistentialTypeArguments.Add(typeExp);
+ globalExistentialTypeArguments.add(typeExp);
}
else if (parser.LookAhead("entryPointExistentialType"))
{
@@ -52,7 +52,7 @@ namespace renderer_test
StringBuilder typeExp;
while (!parser.IsEnd())
typeExp << parser.ReadToken().Content;
- entryPointExistentialTypeArguments.Add(typeExp);
+ entryPointExistentialTypeArguments.add(typeExp);
}
else
{
@@ -183,12 +183,12 @@ namespace renderer_test
{
if (parser.NextToken().Type == TokenType::IntLiteral)
{
- entry.bufferData.Add(parser.ReadUInt());
+ entry.bufferData.add(parser.ReadUInt());
}
else
{
auto floatNum = parser.ReadFloat();
- entry.bufferData.Add(*(unsigned int*)&floatNum);
+ entry.bufferData.add(*(unsigned int*)&floatNum);
}
}
parser.Read("]");
@@ -254,7 +254,7 @@ namespace renderer_test
parser.Read("(");
while (!parser.IsEnd() && !parser.LookAhead(")"))
{
- entry.glslBinding.Add(parser.ReadInt());
+ entry.glslBinding.add(parser.ReadInt());
if (parser.LookAhead(","))
parser.Read(",");
else
@@ -271,7 +271,7 @@ namespace renderer_test
parser.Read(",");
}
}
- entries.Add(entry);
+ entries.add(entry);
}
}
catch (TextFormatException)
@@ -302,19 +302,19 @@ namespace renderer_test
List<List<unsigned int>>& dstBuffer = output.dataBuffer;
- int numMips = int(work.dataBuffer.Count());
- dstBuffer.SetSize(numMips);
+ Index numMips = work.dataBuffer.getCount();
+ dstBuffer.setCount(numMips);
for (int i = 0; i < numMips; ++i)
{
- const int numPixels = int(work.dataBuffer[i].Count());
- const unsigned int* srcPixels = work.dataBuffer[i].Buffer();
+ const Index numPixels = work.dataBuffer[i].getCount();
+ const unsigned int* srcPixels = work.dataBuffer[i].getBuffer();
- dstBuffer[i].SetSize(numPixels);
+ dstBuffer[i].setCount(numPixels);
- float* dstPixels = (float*)dstBuffer[i].Buffer();
+ float* dstPixels = (float*)dstBuffer[i].getBuffer();
- for (int j = 0; j < numPixels; ++j)
+ for (Index j = 0; j < numPixels; ++j)
{
// Copy out red
const unsigned int srcPixel = srcPixels[j];
@@ -344,7 +344,7 @@ namespace renderer_test
output.arraySize = arraySize;
output.textureSize = inputDesc.size;
output.mipLevels = Math::Log2Floor(output.textureSize) + 1;
- output.dataBuffer.SetSize(output.mipLevels * output.arraySize);
+ output.dataBuffer.setCount(output.mipLevels * output.arraySize);
auto iteratePixels = [&](int dimension, int size, unsigned int * buffer, auto f)
{
if (dimension == 1)
@@ -372,9 +372,9 @@ namespace renderer_test
bufferLen *= size;
else if (inputDesc.dimension == 3)
bufferLen *= size*size;
- dataBuffer[slice].SetSize(bufferLen);
+ dataBuffer[slice].setCount(bufferLen);
- iteratePixels(inputDesc.dimension, size, dataBuffer[slice].Buffer(), [&](int x, int y, int z) -> unsigned int
+ iteratePixels(inputDesc.dimension, size, dataBuffer[slice].getBuffer(), [&](int x, int y, int z) -> unsigned int
{
if (inputDesc.content == InputTextureContent::Zero)
{
diff --git a/tools/render-test/shader-renderer-util.cpp b/tools/render-test/shader-renderer-util.cpp
index 13effdd08..e13958f50 100644
--- a/tools/render-test/shader-renderer-util.cpp
+++ b/tools/render-test/shader-renderer-util.cpp
@@ -66,9 +66,9 @@ void BindingStateImpl::apply(Renderer* renderer, PipelineType pipelineType)
TextureResource::Data initData;
List<ptrdiff_t> mipRowStrides;
- mipRowStrides.SetSize(textureResourceDesc.numMipLevels);
+ mipRowStrides.setCount(textureResourceDesc.numMipLevels);
List<const void*> subResources;
- subResources.SetSize(numSubResources);
+ subResources.setCount(numSubResources);
// Set up the src row strides
for (int i = 0; i < textureResourceDesc.numMipLevels; i++)
@@ -80,19 +80,19 @@ void BindingStateImpl::apply(Renderer* renderer, PipelineType pipelineType)
// Set up pointers the the data
{
int subResourceIndex = 0;
- const int numGen = int(texData.dataBuffer.Count());
+ const int numGen = int(texData.dataBuffer.getCount());
for (int i = 0; i < numSubResources; i++)
{
- subResources[i] = texData.dataBuffer[subResourceIndex].Buffer();
+ subResources[i] = texData.dataBuffer[subResourceIndex].getBuffer();
// Wrap around
subResourceIndex = (subResourceIndex + 1 >= numGen) ? 0 : (subResourceIndex + 1);
}
}
- initData.mipRowStrides = mipRowStrides.Buffer();
+ initData.mipRowStrides = mipRowStrides.getBuffer();
initData.numMips = textureResourceDesc.numMipLevels;
initData.numSubResources = numSubResources;
- initData.subResources = subResources.Buffer();
+ initData.subResources = subResources.getBuffer();
textureOut = renderer->createTextureResource(Resource::Usage::GenericRead, textureResourceDesc, &initData);
@@ -175,7 +175,7 @@ static RefPtr<SamplerState> _createSamplerState(
}
case BindingStyle::OpenGl:
{
- const int count = int(entry.glslBinding.Count());
+ const int count = int(entry.glslBinding.getCount());
if (count <= 0)
{
@@ -184,7 +184,7 @@ static RefPtr<SamplerState> _createSamplerState(
int baseIndex = entry.glslBinding[0];
// Make sure they are contiguous
- for (int i = 1; i < int(entry.glslBinding.Count()); ++i)
+ for (Index i = 1; i < int(entry.glslBinding.getCount()); ++i)
{
if (baseIndex + i != entry.glslBinding[i])
{
@@ -205,8 +205,8 @@ static RefPtr<SamplerState> _createSamplerState(
/* static */Result ShaderRendererUtil::createBindingState(const ShaderInputLayout& layout, Renderer* renderer, BufferResource* addedConstantBuffer, BindingStateImpl** outBindingState)
{
- auto srcEntries = layout.entries.Buffer();
- auto numEntries = int(layout.entries.Count());
+ auto srcEntries = layout.entries.getBuffer();
+ auto numEntries = layout.entries.getCount();
const int textureBindFlags = Resource::BindFlag::NonPixelShaderResource | Resource::BindFlag::PixelShaderResource;
@@ -217,10 +217,10 @@ static RefPtr<SamplerState> _createSamplerState(
DescriptorSetLayout::SlotRangeDesc slotRangeDesc;
slotRangeDesc.type = DescriptorSlotType::UniformBuffer;
- slotRangeDescs.Add(slotRangeDesc);
+ slotRangeDescs.add(slotRangeDesc);
}
- for (int i = 0; i < numEntries; i++)
+ for (Index i = 0; i < numEntries; i++)
{
const ShaderInputLayoutEntry& srcEntry = srcEntries[i];
@@ -279,23 +279,23 @@ static RefPtr<SamplerState> _createSamplerState(
assert(!"Unhandled type");
return SLANG_FAIL;
}
- slotRangeDescs.Add(slotRangeDesc);
+ slotRangeDescs.add(slotRangeDesc);
}
DescriptorSetLayout::Desc descriptorSetLayoutDesc;
- descriptorSetLayoutDesc.slotRangeCount = slotRangeDescs.Count();
- descriptorSetLayoutDesc.slotRanges = slotRangeDescs.Buffer();
+ descriptorSetLayoutDesc.slotRangeCount = slotRangeDescs.getCount();
+ descriptorSetLayoutDesc.slotRanges = slotRangeDescs.getBuffer();
auto descriptorSetLayout = renderer->createDescriptorSetLayout(descriptorSetLayoutDesc);
if(!descriptorSetLayout) return SLANG_FAIL;
List<PipelineLayout::DescriptorSetDesc> pipelineDescriptorSets;
- pipelineDescriptorSets.Add(PipelineLayout::DescriptorSetDesc(descriptorSetLayout));
+ pipelineDescriptorSets.add(PipelineLayout::DescriptorSetDesc(descriptorSetLayout));
PipelineLayout::Desc pipelineLayoutDesc;
pipelineLayoutDesc.renderTargetCount = layout.numRenderTargets;
- pipelineLayoutDesc.descriptorSetCount = pipelineDescriptorSets.Count();
- pipelineLayoutDesc.descriptorSets = pipelineDescriptorSets.Buffer();
+ pipelineLayoutDesc.descriptorSetCount = pipelineDescriptorSets.getCount();
+ pipelineLayoutDesc.descriptorSets = pipelineDescriptorSets.getBuffer();
auto pipelineLayout = renderer->createPipelineLayout(pipelineLayoutDesc);
if(!pipelineLayout) return SLANG_FAIL;
@@ -320,10 +320,10 @@ static RefPtr<SamplerState> _createSamplerState(
case ShaderInputType::Buffer:
{
const InputBufferDesc& srcBuffer = srcEntry.bufferDesc;
- const size_t bufferSize = srcEntry.bufferData.Count() * sizeof(uint32_t);
+ const size_t bufferSize = srcEntry.bufferData.getCount() * sizeof(uint32_t);
RefPtr<BufferResource> bufferResource;
- SLANG_RETURN_ON_FAIL(createBufferResource(srcEntry.bufferDesc, srcEntry.isOutput, bufferSize, srcEntry.bufferData.Buffer(), renderer, bufferResource));
+ SLANG_RETURN_ON_FAIL(createBufferResource(srcEntry.bufferDesc, srcEntry.isOutput, bufferSize, srcEntry.bufferData.getBuffer(), renderer, bufferResource));
switch(srcBuffer.type)
{
@@ -349,7 +349,7 @@ static RefPtr<SamplerState> _createSamplerState(
BindingStateImpl::OutputBinding binding;
binding.entryIndex = i;
binding.resource = bufferResource;
- outputBindings.Add(binding);
+ outputBindings.add(binding);
}
}
break;
@@ -374,7 +374,7 @@ static RefPtr<SamplerState> _createSamplerState(
BindingStateImpl::OutputBinding binding;
binding.entryIndex = i;
binding.resource = texture;
- outputBindings.Add(binding);
+ outputBindings.add(binding);
}
}
break;
@@ -404,7 +404,7 @@ static RefPtr<SamplerState> _createSamplerState(
BindingStateImpl::OutputBinding binding;
binding.entryIndex = i;
binding.resource = texture;
- outputBindings.Add(binding);
+ outputBindings.add(binding);
}
}
break;
diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp
index 06f5eaba1..77f1436b1 100644
--- a/tools/render-test/slang-support.cpp
+++ b/tools/render-test/slang-support.cpp
@@ -95,28 +95,28 @@ RefPtr<ShaderProgram> ShaderCompiler::compileProgram(
Slang::List<const char*> rawGlobalTypeNames;
for (auto typeName : request.globalGenericTypeArguments)
- rawGlobalTypeNames.Add(typeName.Buffer());
+ rawGlobalTypeNames.add(typeName.getBuffer());
spSetGlobalGenericArgs(
slangRequest,
- (int)rawGlobalTypeNames.Count(),
- rawGlobalTypeNames.Buffer());
+ (int)rawGlobalTypeNames.getCount(),
+ rawGlobalTypeNames.getBuffer());
Slang::List<const char*> rawEntryPointTypeNames;
for (auto typeName : request.entryPointGenericTypeArguments)
- rawEntryPointTypeNames.Add(typeName.Buffer());
+ rawEntryPointTypeNames.add(typeName.getBuffer());
- const int globalExistentialTypeCount = int(request.globalExistentialTypeArguments.Count());
+ const int globalExistentialTypeCount = int(request.globalExistentialTypeArguments.getCount());
for(int ii = 0; ii < globalExistentialTypeCount; ++ii )
{
- spSetTypeNameForGlobalExistentialTypeParam(slangRequest, ii, request.globalExistentialTypeArguments[ii].Buffer());
+ spSetTypeNameForGlobalExistentialTypeParam(slangRequest, ii, request.globalExistentialTypeArguments[ii].getBuffer());
}
- const int entryPointExistentialTypeCount = int(request.entryPointExistentialTypeArguments.Count());
+ const int entryPointExistentialTypeCount = int(request.entryPointExistentialTypeArguments.getCount());
auto setEntryPointExistentialTypeArgs = [&](int entryPoint)
{
for( int ii = 0; ii < entryPointExistentialTypeCount; ++ii )
{
- spSetTypeNameForEntryPointExistentialTypeParam(slangRequest, entryPoint, ii, request.entryPointExistentialTypeArguments[ii].Buffer());
+ spSetTypeNameForEntryPointExistentialTypeParam(slangRequest, entryPoint, ii, request.entryPointExistentialTypeArguments[ii].getBuffer());
}
};
@@ -125,8 +125,8 @@ RefPtr<ShaderProgram> ShaderCompiler::compileProgram(
int computeEntryPoint = spAddEntryPointEx(slangRequest, computeTranslationUnit,
computeEntryPointName,
SLANG_STAGE_COMPUTE,
- (int)rawEntryPointTypeNames.Count(),
- rawEntryPointTypeNames.Buffer());
+ (int)rawEntryPointTypeNames.getCount(),
+ rawEntryPointTypeNames.getBuffer());
setEntryPointExistentialTypeArgs(computeEntryPoint);
@@ -156,8 +156,8 @@ RefPtr<ShaderProgram> ShaderCompiler::compileProgram(
}
else
{
- int vertexEntryPoint = spAddEntryPointEx(slangRequest, vertexTranslationUnit, vertexEntryPointName, SLANG_STAGE_VERTEX, (int)rawEntryPointTypeNames.Count(), rawEntryPointTypeNames.Buffer());
- int fragmentEntryPoint = spAddEntryPointEx(slangRequest, fragmentTranslationUnit, fragmentEntryPointName, SLANG_STAGE_FRAGMENT, (int)rawEntryPointTypeNames.Count(), rawEntryPointTypeNames.Buffer());
+ int vertexEntryPoint = spAddEntryPointEx(slangRequest, vertexTranslationUnit, vertexEntryPointName, SLANG_STAGE_VERTEX, (int)rawEntryPointTypeNames.getCount(), rawEntryPointTypeNames.getBuffer());
+ int fragmentEntryPoint = spAddEntryPointEx(slangRequest, fragmentTranslationUnit, fragmentEntryPointName, SLANG_STAGE_FRAGMENT, (int)rawEntryPointTypeNames.getCount(), rawEntryPointTypeNames.getBuffer());
setEntryPointExistentialTypeArgs(vertexEntryPoint);
setEntryPointExistentialTypeArgs(fragmentEntryPoint);
diff --git a/tools/slang-generate/main.cpp b/tools/slang-generate/main.cpp
index a2fec6578..ed5af370b 100644
--- a/tools/slang-generate/main.cpp
+++ b/tools/slang-generate/main.cpp
@@ -1,6 +1,5 @@
// main.cpp
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -602,7 +601,7 @@ void emitCodeNodes(
}
// Given line starts and a location, find the line number. Returns -1 if not found
-static int _findLineIndex(const List<const char*>& lineBreaks, const char* location)
+static Index _findLineIndex(const List<const char*>& lineBreaks, const char* location)
{
if (location == nullptr)
{
@@ -610,12 +609,12 @@ static int _findLineIndex(const List<const char*>& lineBreaks, const char* locat
}
// Use a binary chop to find the associated line
- int lo = 0;
- int hi = int(lineBreaks.Count());
+ Index lo = 0;
+ Index hi = lineBreaks.getCount();
while (lo + 1 < hi)
{
- const int mid = (hi + lo) >> 1;
+ const auto mid = (hi + lo) >> 1;
const auto midOffset = lineBreaks[mid];
if (midOffset <= location)
{
@@ -638,7 +637,7 @@ static void _calcLineBreaks(const UnownedStringSlice& content, List<const char*>
char const* cursor = begin;
// Treat the beginning of the file as a line break
- outLineStarts.Add(cursor);
+ outLineStarts.add(cursor);
while (cursor != end)
{
@@ -657,7 +656,7 @@ static void _calcLineBreaks(const UnownedStringSlice& content, List<const char*>
if ((c^d) == ('\r' ^ '\n'))
cursor++;
- outLineStarts.Add(cursor);
+ outLineStarts.add(cursor);
break;
}
default:
@@ -683,7 +682,7 @@ void emitTemplateNodes(
if (enable && prev && prev->flavor == Node::Flavor::escape && nn->flavor == Node::Flavor::text)
{
// Find the line
- int lineIndex = _findLineIndex(lineBreaks, nn->span.begin());
+ Index lineIndex = _findLineIndex(lineBreaks, nn->span.begin());
// If found, output the directive
if (lineIndex >= 0)
{
@@ -864,11 +863,11 @@ int main(
// Copy the input paths
for (; argCursor != argEnd; ++argCursor)
{
- inputPaths.Add(*argCursor);
+ inputPaths.add(*argCursor);
}
}
- if(inputPaths.Count() == 0)
+ if(inputPaths.getCount() == 0)
{
usage(appName);
exit(1);
@@ -881,7 +880,7 @@ int main(
SourceFile* sourceFile = parseSourceFile(inputPath);
if (sourceFile)
{
- gSourceFiles.Add(sourceFile);
+ gSourceFiles.add(sourceFile);
}
}
@@ -897,7 +896,7 @@ int main(
outputPath << inputPath << ".temp.h";
FILE* outputStream;
- fopen_s(&outputStream, outputPath.Buffer(), "w");
+ fopen_s(&outputStream, outputPath.getBuffer(), "w");
emitTemplateNodes(sourceFile, outputStream, node);
@@ -908,13 +907,13 @@ int main(
outputPathFinal << inputPath << ".h";
String allTextOld, allTextNew;
- readAllText(outputPathFinal.Buffer(), allTextOld);
- readAllText(outputPath.Buffer(), allTextNew);
+ readAllText(outputPathFinal.getBuffer(), allTextOld);
+ readAllText(outputPath.getBuffer(), allTextNew);
if (allTextOld != allTextNew)
{
- writeAllText(inputPath, outputPathFinal.Buffer(), allTextNew.Buffer());
+ writeAllText(inputPath, outputPathFinal.getBuffer(), allTextNew.getBuffer());
}
- remove(outputPath.Buffer());
+ remove(outputPath.getBuffer());
}
return 0;
diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp
index 17e424127..3e985b493 100644
--- a/tools/slang-test/options.cpp
+++ b/tools/slang-test/options.cpp
@@ -4,7 +4,6 @@
#include "os.h"
#include "../../source/core/slang-string-util.h"
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -37,7 +36,7 @@ TestCategory* TestCategorySet::findOrError(String const& name)
TestCategory* category = find(name);
if (!category)
{
- StdWriters::getError().print("error: unknown test category name '%s'\n", name.Buffer());
+ StdWriters::getError().print("error: unknown test category name '%s'\n", name.getBuffer());
}
return category;
}
@@ -92,18 +91,18 @@ static bool _isSubCommand(const char* arg)
{
optionsOut->subCommand = arg;
// Make the first arg the command name
- optionsOut->subCommandArgs.Add(optionsOut->subCommand);
+ optionsOut->subCommandArgs.add(optionsOut->subCommand);
// Add all the remaining commands to subCommands
for (; argCursor != argEnd; ++argCursor)
{
- optionsOut->subCommandArgs.Add(*argCursor);
+ optionsOut->subCommandArgs.add(*argCursor);
}
// Done
return SLANG_OK;
}
- positionalArgs.Add(arg);
+ positionalArgs.add(arg);
continue;
}
@@ -112,7 +111,7 @@ static bool _isSubCommand(const char* arg)
// Add all positional args at the end
while (argCursor != argEnd)
{
- positionalArgs.Add(*argCursor++);
+ positionalArgs.add(*argCursor++);
}
break;
}
@@ -278,24 +277,24 @@ static bool _isSubCommand(const char* arg)
// first positional argument is source shader path
- if (positionalArgs.Count())
+ if (positionalArgs.getCount())
{
optionsOut->testPrefix = positionalArgs[0];
- positionalArgs.RemoveAt(0);
+ positionalArgs.removeAt(0);
}
// any remaining arguments represent an error
- if (positionalArgs.Count() != 0)
+ if (positionalArgs.getCount() != 0)
{
stdError.print("unexpected arguments\n");
return SLANG_FAIL;
}
- if (optionsOut->binDir.Length() == 0)
+ if (optionsOut->binDir.getLength() == 0)
{
// If the binDir isn't set try using the path to the executable
String exePath = Path::getExecutablePath();
- if (exePath.Length())
+ if (exePath.getLength())
{
optionsOut->binDir = Path::getParentDirectory(exePath);
}
diff --git a/tools/slang-test/os.cpp b/tools/slang-test/os.cpp
index 9ecf50557..a938a71e7 100644
--- a/tools/slang-test/os.cpp
+++ b/tools/slang-test/os.cpp
@@ -1,7 +1,6 @@
// os.cpp
#include "os.h"
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -34,7 +33,7 @@ static bool adjustToValidResult(OSFindFilesResult& result)
if (wcscmp(result.fileData_.cFileName, L"..") == 0)
goto skip;
- result.filePath_ = result.directoryPath_ + String::FromWString(result.fileData_.cFileName);
+ result.filePath_ = result.directoryPath_ + String::fromWString(result.fileData_.cFileName);
if (result.fileData_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
result.filePath_ = result.filePath_ + "/";
@@ -63,7 +62,7 @@ OSFindFilesResult osFindFilesInDirectoryMatchingPattern(
OSFindFilesResult result;
HANDLE findHandle = FindFirstFileW(
- searchPath.ToWString(),
+ searchPath.toWString(),
&result.fileData_);
result.directoryPath_ = directoryPath;
@@ -101,7 +100,7 @@ OSFindFilesResult osFindChildDirectories(
OSFindFilesResult result;
HANDLE findHandle = FindFirstFileW(
- searchPath.ToWString(),
+ searchPath.toWString(),
&result.fileData_);
result.directoryPath_ = directoryPath;
@@ -223,7 +222,7 @@ void OSProcessSpawner::pushArgument(
commandLine_.Append(" ");
commandLine_.Append(argument);
- argumentList_.Add(argument);
+ argumentList_.add(argument);
}
Slang::String OSProcessSpawner::getCommandLine()
@@ -321,8 +320,8 @@ OSError OSProcessSpawner::spawnAndWaitForCompletion()
// `CreateProcess` requires write access to this, for some reason...
BOOL success = CreateProcessW(
- isExecutablePath_ ? executableName_.ToWString().begin() : nullptr,
- (LPWSTR)commandLine_.ToString().ToWString().begin(),
+ isExecutablePath_ ? executableName_.toWString().begin() : nullptr,
+ (LPWSTR)commandLine_.ToString().toWString().begin(),
nullptr,
nullptr,
true,
@@ -405,9 +404,9 @@ static bool checkValidResult(OSFindFilesResult& result)
String path = result.directoryPath_
+ String(result.entry_->d_name);
-// fprintf(stderr, "stat(%s)\n", path.Buffer());
+// fprintf(stderr, "stat(%s)\n", path.getBuffer());
struct stat fileInfo;
- if(stat(path.Buffer(), &fileInfo) != 0)
+ if(stat(path.getBuffer(), &fileInfo) != 0)
return false;
if(S_ISDIR(fileInfo.st_mode))
@@ -443,9 +442,9 @@ OSFindFilesResult osFindFilesInDirectory(
{
OSFindFilesResult result;
-// fprintf(stderr, "osFindFilesInDirectory(%s)\n", directoryPath.Buffer());
+// fprintf(stderr, "osFindFilesInDirectory(%s)\n", directoryPath.getBuffer());
- result.directory_ = opendir(directoryPath.Buffer());
+ result.directory_ = opendir(directoryPath.getBuffer());
if(!result.directory_)
{
result.entry_ = NULL;
@@ -462,7 +461,7 @@ OSFindFilesResult osFindChildDirectories(
{
OSFindFilesResult result;
- result.directory_ = opendir(directoryPath.Buffer());
+ result.directory_ = opendir(directoryPath.getBuffer());
if(!result.directory_)
{
result.entry_ = NULL;
@@ -482,7 +481,7 @@ void OSProcessSpawner::pushExecutableName(
Slang::String executableName)
{
executableName_ = executableName;
- arguments_.Add(executableName);
+ arguments_.add(executableName);
isExecutablePath_ = false;
}
@@ -490,20 +489,20 @@ void OSProcessSpawner::pushExecutablePath(
Slang::String executablePath)
{
executableName_ = executablePath;
- arguments_.Add(executablePath);
+ arguments_.add(executablePath);
isExecutablePath_ = true;
}
void OSProcessSpawner::pushArgument(
Slang::String argument)
{
- arguments_.Add(argument);
- argumentList_.Add(argument);
+ arguments_.add(argument);
+ argumentList_.add(argument);
}
Slang::String OSProcessSpawner::getCommandLine()
{
- Slang::UInt argCount = arguments_.Count();
+ Slang::UInt argCount = arguments_.getCount();
Slang::StringBuilder sb;
for(Slang::UInt ii = 0; ii < argCount; ++ii)
@@ -519,9 +518,9 @@ OSError OSProcessSpawner::spawnAndWaitForCompletion()
List<char const*> argPtrs;
for(auto arg : arguments_)
{
- argPtrs.Add(arg.Buffer());
+ argPtrs.add(arg.getBuffer());
}
- argPtrs.Add(NULL);
+ argPtrs.add(NULL);
int stdoutPipe[2];
int stderrPipe[2];
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 8d79c8f94..ff449f64e 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -21,7 +21,6 @@ using namespace Slang;
#define STB_IMAGE_IMPLEMENTATION
#include "external/stb/stb_image.h"
-#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@@ -220,7 +219,7 @@ static TestResult _gatherTestOptions(
}
- outOptions.categories.Add(category);
+ outOptions.categories.add(category);
if( *categoryEnd == ',' )
{
@@ -240,9 +239,9 @@ static TestResult _gatherTestOptions(
}
// If no categories were specified, then add the default category
- if(outOptions.categories.Count() == 0)
+ if(outOptions.categories.getCount() == 0)
{
- outOptions.categories.Add(categorySet->defaultCategory);
+ outOptions.categories.add(categorySet->defaultCategory);
}
if(*cursor == ':')
@@ -319,7 +318,7 @@ static TestResult _gatherTestOptions(
char const* argEnd = cursor;
assert(argBegin != argEnd);
- outOptions.args.Add(getString(argBegin, argEnd));
+ outOptions.args.add(getString(argBegin, argEnd));
}
}
@@ -361,7 +360,7 @@ TestResult gatherTestsForFile(
if(_gatherTestOptions(categorySet, &cursor, testDetails.options) != TestResult::Pass)
return TestResult::Fail;
- testList->tests.Add(testDetails);
+ testList->tests.add(testDetails);
}
else if (match(&cursor, "//DIAGNOSTIC_TEST"))
{
@@ -372,7 +371,7 @@ TestResult gatherTestsForFile(
// Mark that it is a diagnostic test
testDetails.options.type = TestOptions::Type::Diagnostic;
- testList->tests.Add(testDetails);
+ testList->tests.add(testDetails);
}
else
{
@@ -397,7 +396,7 @@ OSError spawnAndWaitExe(TestContext* context, const String& testPath, OSProcessS
if (err != kOSError_None)
{
// fprintf(stderr, "failed to run test '%S'\n", testPath.ToWString());
- context->reporter->messageFormat(TestMessageType::RunError, "failed to run test '%S'", testPath.ToWString().begin());
+ context->reporter->messageFormat(TestMessageType::RunError, "failed to run test '%S'", testPath.toWString().begin());
}
return err;
}
@@ -413,7 +412,7 @@ OSError spawnAndWaitSharedLibrary(TestContext* context, const String& testPath,
builder << "slang-test";
- if (options.binDir.Length())
+ if (options.binDir.getLength())
{
builder << " -bindir " << options.binDir;
}
@@ -422,7 +421,7 @@ OSError spawnAndWaitSharedLibrary(TestContext* context, const String& testPath,
// TODO(js): Potentially this should handle escaping parameters for the command line if need be
const auto& argList = spawner.argumentList_;
- for (UInt i = 0; i < argList.Count(); ++i)
+ for (Index i = 0; i < argList.getCount(); ++i)
{
builder << " " << argList[i];
}
@@ -452,13 +451,13 @@ OSError spawnAndWaitSharedLibrary(TestContext* context, const String& testPath,
}
List<const char*> args;
- args.Add(exeName.Buffer());
- for (int i = 0; i < int(spawner.argumentList_.Count()); ++i)
+ args.add(exeName.getBuffer());
+ for (Index i = 0; i < spawner.argumentList_.getCount(); ++i)
{
- args.Add(spawner.argumentList_[i].Buffer());
+ args.add(spawner.argumentList_[i].getBuffer());
}
- SlangResult res = func(&stdWriters, context->getSession(), int(args.Count()), args.begin());
+ SlangResult res = func(&stdWriters, context->getSession(), int(args.getCount()), args.begin());
StdWriters::setSingleton(prevStdWriters);
@@ -476,10 +475,10 @@ OSError spawnAndWaitSharedLibrary(TestContext* context, const String& testPath,
static SlangResult _extractArg(const List<String>& args, const String& argName, String& outValue)
{
- SLANG_ASSERT(argName.Length() > 0 && argName[0] == '-');
+ SLANG_ASSERT(argName.getLength() > 0 && argName[0] == '-');
- const UInt count = args.Count();
- for (UInt i = 0; i < count - 1; ++i)
+ const Index count = args.getCount();
+ for (Index i = 0; i < count - 1; ++i)
{
if (args[i] == argName)
{
@@ -492,7 +491,7 @@ static SlangResult _extractArg(const List<String>& args, const String& argName,
static bool _hasOption(const List<String>& args, const String& argName)
{
- return args.IndexOf(argName) != UInt(-1);
+ return args.indexOf(argName) != Index(-1);
}
static BackendType _toBackendType(const UnownedStringSlice& slice)
@@ -888,7 +887,7 @@ String findExpectedPath(const TestInput& input, const char* postFix)
}
// Couldn't find either
- printf("referenceOutput '%s' or '%s' not found.\n", defaultBuf.Buffer(), specializedBuf.Buffer());
+ printf("referenceOutput '%s' or '%s' not found.\n", defaultBuf.getBuffer(), specializedBuf.getBuffer());
return "";
}
@@ -960,7 +959,7 @@ TestResult runSimpleTest(TestContext* context, TestInput& input)
// If no expected output file was found, then we
// expect everything to be empty
- if (expectedOutput.Length() == 0)
+ if (expectedOutput.getLength() == 0)
{
expectedOutput = "result code = 0\nstandard error = {\n}\nstandard output = {\n}\n";
}
@@ -1036,7 +1035,7 @@ TestResult runReflectionTest(TestContext* context, TestInput& input)
// If no expected output file was found, then we
// expect everything to be empty
- if (expectedOutput.Length() == 0)
+ if (expectedOutput.getLength() == 0)
{
expectedOutput = "result code = 0\nstandard error = {\n}\nstandard output = {\n}\n";
}
@@ -1077,7 +1076,7 @@ String getExpectedOutput(String const& outputStem)
// If no expected output file was found, then we
// expect everything to be empty
- if (expectedOutput.Length() == 0)
+ if (expectedOutput.getLength() == 0)
{
expectedOutput = "result code = 0\nstandard error = {\n}\nstandard output = {\n}\n";
}
@@ -1105,8 +1104,8 @@ TestResult runCrossCompilerTest(TestContext* context, TestInput& input)
const auto& args = input.testOptions->args;
- const UInt targetIndex = args.IndexOf("-target");
- if (targetIndex != UInt(-1) && targetIndex + 1 < args.Count())
+ const Index targetIndex = args.indexOf("-target");
+ if (targetIndex != Index(-1) && targetIndex + 1 < args.getCount())
{
SlangCompileTarget target = _getCompileTarget(args[targetIndex + 1].getUnownedSlice());
@@ -1315,11 +1314,11 @@ TestResult runHLSLComparisonTest(TestContext* context, TestInput& input)
// If no expected output file was found, then we
// expect everything to be empty
- if (expectedOutput.Length() == 0)
+ if (expectedOutput.getLength() == 0)
{
if (resultCode != 0) result = TestResult::Fail;
- if (standardError.Length() != 0) result = TestResult::Fail;
- if (standardOutput.Length() != 0) result = TestResult::Fail;
+ if (standardError.getLength() != 0) result = TestResult::Fail;
+ if (standardOutput.getLength() != 0) result = TestResult::Fail;
}
// Otherwise we compare to the expected output
else if (actualOutput != expectedOutput)
@@ -1456,7 +1455,7 @@ TestResult runGLSLComparisonTest(TestContext* context, TestInput& input)
static void _addRenderTestOptions(const Options& options, OSProcessSpawner& spawner)
{
- if (options.adapter.Length())
+ if (options.adapter.getLength())
{
spawner.pushArgument("-adapter");
spawner.pushArgument(options.adapter);
@@ -1503,7 +1502,7 @@ TestResult runComputeComparisonImpl(TestContext* context, TestInput& input, cons
}
const String referenceOutput = findExpectedPath(input, ".expected.txt");
- if (referenceOutput.Length() <= 0)
+ if (referenceOutput.getLength() <= 0)
{
return TestResult::Fail;
}
@@ -1524,12 +1523,12 @@ TestResult runComputeComparisonImpl(TestContext* context, TestInput& input, cons
if (!File::exists(actualOutputFile))
{
printf("render-test not producing expected outputs.\n");
- printf("render-test output:\n%s\n", actualOutput.Buffer());
+ printf("render-test output:\n%s\n", actualOutput.getBuffer());
return TestResult::Fail;
}
if (!File::exists(referenceOutput))
{
- printf("referenceOutput %s not found.\n", referenceOutput.Buffer());
+ printf("referenceOutput %s not found.\n", referenceOutput.getBuffer());
return TestResult::Fail;
}
auto actualOutputContent = File::readAllText(actualOutputFile);
@@ -1537,17 +1536,17 @@ TestResult runComputeComparisonImpl(TestContext* context, TestInput& input, cons
auto referenceProgramOutput = Split(File::readAllText(referenceOutput), '\n');
auto printOutput = [&]()
{
- context->reporter->messageFormat(TestMessageType::TestFailure, "output mismatch! actual output: {\n%s\n}, \n%s\n", actualOutputContent.Buffer(), actualOutput.Buffer());
+ context->reporter->messageFormat(TestMessageType::TestFailure, "output mismatch! actual output: {\n%s\n}, \n%s\n", actualOutputContent.getBuffer(), actualOutput.getBuffer());
};
- if (actualProgramOutput.Count() < referenceProgramOutput.Count())
+ if (actualProgramOutput.getCount() < referenceProgramOutput.getCount())
{
printOutput();
return TestResult::Fail;
}
- for (int i = 0; i < (int)referenceProgramOutput.Count(); i++)
+ for (Index i = 0; i < referenceProgramOutput.getCount(); i++)
{
- auto reference = String(referenceProgramOutput[i].Trim());
- auto actual = String(actualProgramOutput[i].Trim());
+ auto reference = String(referenceProgramOutput[i].trim());
+ auto actual = String(actualProgramOutput[i].trim());
if (actual != reference)
{
printOutput();
@@ -1710,22 +1709,22 @@ TestResult doImageComparison(TestContext* context, String const& filePath)
String actualPath = filePath + ".actual.png";
STBImage expectedImage;
- if (SLANG_FAILED(expectedImage.read(expectedPath.Buffer())))
+ if (SLANG_FAILED(expectedImage.read(expectedPath.getBuffer())))
{
- reporter->messageFormat(TestMessageType::RunError, "Unable to load image ;%s'", expectedPath.Buffer());
+ reporter->messageFormat(TestMessageType::RunError, "Unable to load image ;%s'", expectedPath.getBuffer());
return TestResult::Fail;
}
STBImage actualImage;
- if (SLANG_FAILED(actualImage.read(actualPath.Buffer())))
+ if (SLANG_FAILED(actualImage.read(actualPath.getBuffer())))
{
- reporter->messageFormat(TestMessageType::RunError, "Unable to load image ;%s'", actualPath.Buffer());
+ reporter->messageFormat(TestMessageType::RunError, "Unable to load image ;%s'", actualPath.getBuffer());
return TestResult::Fail;
}
if (!expectedImage.isComparable(actualImage))
{
- reporter->messageFormat(TestMessageType::TestFailure, "Images are different sizes '%s' '%s'", actualPath.Buffer(), expectedPath.Buffer());
+ reporter->messageFormat(TestMessageType::TestFailure, "Images are different sizes '%s' '%s'", actualPath.getBuffer(), expectedPath.getBuffer());
return TestResult::Fail;
}
@@ -1997,15 +1996,15 @@ static void _calcSynthesizedTests(TestContext* context, RenderApiType synthRende
builder << "-";
builder << RenderApiUtil::getApiName(synthRenderApiType);
- synthOptions.args.Add(builder);
+ synthOptions.args.add(builder);
// If the target is vulkan remove the -hlsl option
if (synthRenderApiType == RenderApiType::Vulkan)
{
- UInt index = synthOptions.args.IndexOf("-hlsl");
- if (index != UInt(-1))
+ Index index = synthOptions.args.indexOf("-hlsl");
+ if (index != Index(-1))
{
- synthOptions.args.RemoveAt(index);
+ synthOptions.args.removeAt(index);
}
}
@@ -2017,7 +2016,7 @@ static void _calcSynthesizedTests(TestContext* context, RenderApiType synthRende
// It does set the explicit render target
SLANG_ASSERT(synthTestDetails.requirements.explicitRenderApi == synthRenderApiType);
// Add to the tests
- ioSynthTests.Add(synthTestDetails);
+ ioSynthTests.add(synthTestDetails);
}
}
@@ -2056,7 +2055,7 @@ void runTestsOnFile(
}
// Note cases where a test file exists, but we found nothing to run
- if( testList.tests.Count() == 0 )
+ if( testList.tests.getCount() == 0 )
{
context->reporter->addTest(filePath, TestResult::Ignored);
return;
@@ -2094,7 +2093,7 @@ void runTestsOnFile(
// What render options do we want to synthesize
RenderApiFlags missingApis = (~apiUsedFlags) & (context->options.synthesizedTestApis & availableRenderApiFlags);
- const UInt numInitialTests = testList.tests.Count();
+ //const Index numInitialTests = testList.tests.getCount();
while (missingApis)
{
@@ -2110,7 +2109,7 @@ void runTestsOnFile(
}
// Add all the synthesized tests
- testList.tests.AddRange(synthesizedTests);
+ testList.tests.addRange(synthesizedTests);
}
// We have found a test to run!
@@ -2216,7 +2215,7 @@ static bool endsWithAllowedExtension(
for( auto ii = allowedExtensions; *ii; ++ii )
{
- if(filePath.EndsWith(*ii))
+ if(filePath.endsWith(*ii))
return true;
}
@@ -2249,7 +2248,7 @@ void runTestsInDirectory(
{
if( shouldRunTest(context, file) )
{
-// fprintf(stderr, "slang-test: found '%s'\n", file.Buffer());
+// fprintf(stderr, "slang-test: found '%s'\n", file.getBuffer());
runTestsOnFile(context, file);
}
}
@@ -2338,26 +2337,26 @@ SlangResult innerMain(int argc, char** argv)
Options& options = context.options;
- if (options.subCommand.Length())
+ if (options.subCommand.getLength())
{
// Get the function from the tool
auto func = context.getInnerMainFunc(options.binDir, options.subCommand);
if (!func)
{
- StdWriters::getError().print("error: Unable to launch tool '%s'\n", options.subCommand.Buffer());
+ StdWriters::getError().print("error: Unable to launch tool '%s'\n", options.subCommand.getBuffer());
return SLANG_FAIL;
}
// Copy args to a char* list
const auto& srcArgs = options.subCommandArgs;
List<const char*> args;
- args.SetSize(srcArgs.Count());
- for (UInt i = 0; i < srcArgs.Count(); ++i)
+ args.setCount(srcArgs.getCount());
+ for (Index i = 0; i < srcArgs.getCount(); ++i)
{
- args[i] = srcArgs[i].Buffer();
+ args[i] = srcArgs[i].getBuffer();
}
- return func(StdWriters::getSingleton(), context.getSession(), int(args.Count()), args.Buffer());
+ return func(StdWriters::getSingleton(), context.getSession(), int(args.getCount()), args.getBuffer());
}
if( options.includeCategories.Count() == 0 )
@@ -2406,7 +2405,7 @@ SlangResult innerMain(int argc, char** argv)
filePath << "unit-tests/" << cur->m_name << ".internal";
TestOptions testOptions;
- testOptions.categories.Add(unitTestCatagory);
+ testOptions.categories.add(unitTestCatagory);
testOptions.command = filePath;
if (shouldRunTest(&context, testOptions.command))
diff --git a/tools/slang-test/slangc-tool.cpp b/tools/slang-test/slangc-tool.cpp
index bf1bb8c28..40fdf05dd 100644
--- a/tools/slang-test/slangc-tool.cpp
+++ b/tools/slang-test/slangc-tool.cpp
@@ -1,6 +1,8 @@
// test-context.cpp
#include "slangc-tool.h"
+#include "../../source/core/exception.h"
+
using namespace Slang;
SLANG_API void spSetCommandLineCompilerMode(SlangCompileRequest* request);
@@ -45,7 +47,7 @@ SlangResult SlangCTool::innerMain(StdWriters* stdWriters, SlangSession* session,
#ifndef _DEBUG
catch (Exception & e)
{
- StdWriters::getOut().print("internal compiler error: %S\n", e.Message.ToWString().begin());
+ StdWriters::getOut().print("internal compiler error: %S\n", e.Message.toWString().begin());
res = SLANG_FAIL;
}
#endif
diff --git a/tools/slang-test/test-context.cpp b/tools/slang-test/test-context.cpp
index 8ea1cc98b..e4d1df449 100644
--- a/tools/slang-test/test-context.cpp
+++ b/tools/slang-test/test-context.cpp
@@ -4,7 +4,6 @@
#include "os.h"
#include "../../source/core/slang-string-util.h"
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tools/slang-test/test-reporter.cpp b/tools/slang-test/test-reporter.cpp
index fad5ad837..d2402d61b 100644
--- a/tools/slang-test/test-reporter.cpp
+++ b/tools/slang-test/test-reporter.cpp
@@ -4,7 +4,6 @@
#include "os.h"
#include "../../source/core/slang-string-util.h"
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -42,8 +41,8 @@ static bool isXmlEncodeChar(char c)
static void appendXmlEncode(const String& in, StringBuilder& out)
{
- const char* cur = in.Buffer();
- const char* end = cur + in.Length();
+ const char* cur = in.getBuffer();
+ const char* end = cur + in.getLength();
while (cur < end)
{
@@ -110,7 +109,7 @@ bool TestReporter::canWriteStdError() const
void TestReporter::startTest(const String& testName)
{
// Must be in a suite
- assert(m_suiteStack.Count());
+ assert(m_suiteStack.getCount());
assert(!m_inTest);
m_inTest = true;
@@ -125,7 +124,7 @@ void TestReporter::startTest(const String& testName)
void TestReporter::endTest()
{
- assert(m_suiteStack.Count());
+ assert(m_suiteStack.getCount());
assert(m_inTest);
m_currentInfo.message = m_currentMessage;
@@ -196,13 +195,13 @@ void TestReporter::dumpOutputDifference(const String& expectedOutput, const Stri
"ERROR:\n"
"EXPECTED{{{\n%s}}}\n"
"ACTUAL{{{\n%s}}}\n",
- expectedOutput.Buffer(),
- actualOutput.Buffer());
+ expectedOutput.getBuffer(),
+ actualOutput.getBuffer());
if (m_dumpOutputOnFailure && canWriteStdError())
{
- fprintf(stderr, "%s", builder.Buffer());
+ fprintf(stderr, "%s", builder.getBuffer());
fflush(stderr);
}
@@ -278,7 +277,7 @@ void TestReporter::_addResult(const TestInfo& info)
break;
}
- m_testInfos.Add(info);
+ m_testInfos.add(info);
// printf("OUTPUT_MODE: %d\n", options.outputMode);
switch (m_outputMode)
@@ -295,7 +294,7 @@ void TestReporter::_addResult(const TestInfo& info)
assert(!"unexpected");
break;
}
- printf("%s test: '%S'\n", resultString, info.name.ToWString().begin());
+ printf("%s test: '%S'\n", resultString, info.name.toWString().begin());
break;
}
case TestOutputMode::TeamCity:
@@ -309,7 +308,7 @@ void TestReporter::_addResult(const TestInfo& info)
{
case TestResult::Fail:
{
- if (info.message.Length())
+ if (info.message.getLength())
{
StringBuilder escapedMessage;
_appendEncodedTeamCityString(info.message.getUnownedSlice(), escapedMessage);
@@ -323,7 +322,7 @@ void TestReporter::_addResult(const TestInfo& info)
}
case TestResult::Pass:
{
- if (info.message.Length())
+ if (info.message.getLength())
{
StringBuilder escapedMessage;
_appendEncodedTeamCityString(info.message.getUnownedSlice(), escapedMessage);
@@ -333,7 +332,7 @@ void TestReporter::_addResult(const TestInfo& info)
}
case TestResult::Ignored:
{
- if (info.message.Length())
+ if (info.message.getLength())
{
StringBuilder escapedMessage;
_appendEncodedTeamCityString(info.message.getUnownedSlice(), escapedMessage);
@@ -390,10 +389,10 @@ void TestReporter::_addResult(const TestInfo& info)
if (err != kOSError_None)
{
- messageFormat(TestMessageType::Info, "failed to add appveyor test results for '%S'\n", info.name.ToWString().begin());
+ messageFormat(TestMessageType::Info, "failed to add appveyor test results for '%S'\n", info.name.toWString().begin());
#if 0
- fprintf(stderr, "[%d] TEST RESULT: %s {%d} {%s} {%s}\n", err, spawner.commandLine_.Buffer(),
+ fprintf(stderr, "[%d] TEST RESULT: %s {%d} {%s} {%s}\n", err, spawner.commandLine_.getBuffer(),
spawner.getResultCode(),
spawner.getStandardOutput().begin(),
spawner.getStandardError().begin());
@@ -422,7 +421,7 @@ void TestReporter::message(TestMessageType type, const String& message)
{
if (m_isVerbose && canWriteStdError())
{
- fputs(message.Buffer(), stderr);
+ fputs(message.getBuffer(), stderr);
}
// Just dump out if can dump out
@@ -434,16 +433,16 @@ void TestReporter::message(TestMessageType type, const String& message)
if (type == TestMessageType::RunError || type == TestMessageType::TestFailure)
{
fprintf(stderr, "error: ");
- fputs(message.Buffer(), stderr);
+ fputs(message.getBuffer(), stderr);
fprintf(stderr, "\n");
}
else
{
- fputs(message.Buffer(), stderr);
+ fputs(message.getBuffer(), stderr);
}
}
- if (m_currentMessage.Length() > 0)
+ if (m_currentMessage.getLength() > 0)
{
m_currentMessage << "\n";
}
@@ -506,7 +505,7 @@ void TestReporter::outputSummary()
{
if (testInfo.testResult == TestResult::Fail)
{
- printf("%s\n", testInfo.name.Buffer());
+ printf("%s\n", testInfo.name.getBuffer());
}
}
printf("---\n");
@@ -530,11 +529,11 @@ void TestReporter::outputSummary()
if (testInfo.testResult == TestResult::Pass)
{
- printf(" <testcase name=\"%s\" status=\"run\"/>\n", testInfo.name.Buffer());
+ printf(" <testcase name=\"%s\" status=\"run\"/>\n", testInfo.name.getBuffer());
}
else
{
- printf(" <testcase name=\"%s\" status=\"run\">\n", testInfo.name.Buffer());
+ printf(" <testcase name=\"%s\" status=\"run\">\n", testInfo.name.getBuffer());
switch (testInfo.testResult)
{
case TestResult::Fail:
@@ -543,7 +542,7 @@ void TestReporter::outputSummary()
appendXmlEncode(testInfo.message, buf);
printf(" <error>\n");
- printf("%s", buf.Buffer());
+ printf("%s", buf.getBuffer());
printf(" </error>\n");
break;
}
@@ -578,7 +577,7 @@ void TestReporter::outputSummary()
void TestReporter::startSuite(const String& name)
{
- m_suiteStack.Add(name);
+ m_suiteStack.add(name);
switch (m_outputMode)
{
@@ -595,13 +594,13 @@ void TestReporter::startSuite(const String& name)
void TestReporter::endSuite()
{
- assert(m_suiteStack.Count());
+ assert(m_suiteStack.getCount());
switch (m_outputMode)
{
case TestOutputMode::TeamCity:
{
- const String& name = m_suiteStack.Last();
+ const String& name = m_suiteStack.getLast();
StringBuilder escapedSuiteName;
_appendEncodedTeamCityString(name.getUnownedSlice(), escapedSuiteName);
printf("##teamcity[testSuiteFinished name='%s']\n", escapedSuiteName.begin());
@@ -610,5 +609,5 @@ void TestReporter::endSuite()
default: break;
}
- m_suiteStack.RemoveLast();
+ m_suiteStack.removeLast();
}
diff --git a/tools/slang-test/unit-test-byte-encode.cpp b/tools/slang-test/unit-test-byte-encode.cpp
index c0944b27d..83b20d4e0 100644
--- a/tools/slang-test/unit-test-byte-encode.cpp
+++ b/tools/slang-test/unit-test-byte-encode.cpp
@@ -2,7 +2,6 @@
#include "../../source/core/slang-byte-encode-util.h"
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -79,12 +78,12 @@ static void byteEncodeUnitTest()
const int blockSize = 1024;
List<uint8_t> encodedBuffer;
- encodedBuffer.SetSize(ByteEncodeUtil::kMaxLiteEncodeUInt32 * blockSize);
+ encodedBuffer.setCount(ByteEncodeUtil::kMaxLiteEncodeUInt32 * blockSize);
List<uint32_t> initialBuffer;
- initialBuffer.SetSize(blockSize);
+ initialBuffer.setCount(blockSize);
List<uint32_t> decodeBuffer;
- decodeBuffer.SetSize(blockSize);
+ decodeBuffer.setCount(blockSize);
// Put in cache?
memset(decodeBuffer.begin(), 0, blockSize * sizeof(uint32_t));
@@ -139,4 +138,4 @@ static void byteEncodeUnitTest()
}
-SLANG_UNIT_TEST("ByteEncode", byteEncodeUnitTest); \ No newline at end of file
+SLANG_UNIT_TEST("ByteEncode", byteEncodeUnitTest);
diff --git a/tools/slang-test/unit-test-free-list.cpp b/tools/slang-test/unit-test-free-list.cpp
index 649c59571..fd7b4844f 100644
--- a/tools/slang-test/unit-test-free-list.cpp
+++ b/tools/slang-test/unit-test-free-list.cpp
@@ -2,7 +2,6 @@
#include "../../source/core/slang-free-list.h"
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -30,15 +29,15 @@ static void freeListUnitTest()
{
int* ptr = (int*)freeList.allocate();
*ptr = i;
- allocs.Add(ptr);
+ allocs.add(ptr);
}
int numDealloc = randGen.nextInt32UpTo(19);
- numDealloc = int(allocs.Count()) < numDealloc ? int(allocs.Count()) : numDealloc;
+ numDealloc = int(allocs.getCount()) < numDealloc ? int(allocs.getCount()) : numDealloc;
for (int j = 0; j < numDealloc; j++)
{
- const int index = randGen.nextInt32UpTo(int(allocs.Count()));
+ const int index = randGen.nextInt32UpTo(int(allocs.getCount()));
int* alloc = allocs[index];
@@ -47,9 +46,9 @@ static void freeListUnitTest()
freeList.deallocate(alloc);
- allocs.FastRemoveAt(index);
+ allocs.fastRemoveAt(index);
}
}
}
-SLANG_UNIT_TEST("FreeList", freeListUnitTest); \ No newline at end of file
+SLANG_UNIT_TEST("FreeList", freeListUnitTest);
diff --git a/tools/slang-test/unit-test-memory-arena.cpp b/tools/slang-test/unit-test-memory-arena.cpp
index e993d4f7a..5aa0262e5 100644
--- a/tools/slang-test/unit-test-memory-arena.cpp
+++ b/tools/slang-test/unit-test-memory-arena.cpp
@@ -2,7 +2,6 @@
#include "../../source/core/slang-memory-arena.h"
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -117,15 +116,15 @@ static void memoryArenaUnitTest()
List<void*> blocks;
- blocks.Add(arena.allocate(100));
- blocks.Add(arena.allocate(blockSize * 2));
- blocks.Add(arena.allocate(100));
- blocks.Add(arena.allocate(blockSize * 2));
- blocks.Add(arena.allocate(100));
+ blocks.add(arena.allocate(100));
+ blocks.add(arena.allocate(blockSize * 2));
+ blocks.add(arena.allocate(100));
+ blocks.add(arena.allocate(blockSize * 2));
+ blocks.add(arena.allocate(100));
arena.deallocateAll();
- blocks.Add(arena.allocate(100));
- blocks.Add(arena.allocate(blockSize * 2));
+ blocks.add(arena.allocate(100));
+ blocks.add(arena.allocate(blockSize * 2));
arena.reset();
@@ -156,32 +155,32 @@ static void memoryArenaUnitTest()
count++;
const int var = randGen.nextInt32() & 0x3ff;
- if (var < 3 && blocks.Count() > 0)
+ if (var < 3 && blocks.getCount() > 0)
{
if (var == 1)
{
// Deallocate everything
arena.deallocateAll();
- blocks.Clear();
+ blocks.clear();
}
else if (var == 2)
{
arena.reset();
- blocks.Clear();
+ blocks.clear();
}
else if (var == 3)
{
arena.rewindToCursor(nullptr);
- blocks.Clear();
+ blocks.clear();
}
else if (var == 4)
{
// Rewind to a random position
- int rewindIndex = randGen.nextInt32UpTo(int32_t(blocks.Count()));
+ int rewindIndex = randGen.nextInt32UpTo(int32_t(blocks.getCount()));
// rewind to this block
arena.rewindToCursor(blocks[rewindIndex].m_data);
// All the blocks (includign this one) and now deallocated
- blocks.SetSize(rewindIndex);
+ blocks.setCount(rewindIndex);
}
else
@@ -248,11 +247,11 @@ static void memoryArenaUnitTest()
block.m_size = sizeInBytes;
block.m_value = value;
- blocks.Add(block);
+ blocks.add(block);
}
// Check the blocks
- for (int j = 0; j < int(blocks.Count()); ++j)
+ for (Index j = 0; j < blocks.getCount(); ++j)
{
const Block& block = blocks[j];