summaryrefslogtreecommitdiff
path: root/tools/gfx/render-gl.cpp
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/gfx/render-gl.cpp
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/gfx/render-gl.cpp')
-rw-r--r--tools/gfx/render-gl.cpp29
1 files changed, 14 insertions, 15 deletions
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();