diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-04-29 17:03:46 -0400 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2019-04-29 14:03:46 -0700 |
| commit | 4880789e3003441732cca4471091563f36531635 (patch) | |
| tree | 8e0d3ed58a561373b35729d24787afe6b39732e3 /source/slang/reflection.cpp | |
| parent | ded340beb4b5197b559626acc39920abb2d39e77 (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 'source/slang/reflection.cpp')
| -rw-r--r-- | source/slang/reflection.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/source/slang/reflection.cpp b/source/slang/reflection.cpp index 9c33ca9d3..326a27854 100644 --- a/source/slang/reflection.cpp +++ b/source/slang/reflection.cpp @@ -137,13 +137,13 @@ SLANG_API char const* spReflectionUserAttribute_GetName(SlangReflectionUserAttri { auto userAttr = convert(attrib); if (!userAttr) return nullptr; - return userAttr->getName()->text.Buffer(); + return userAttr->getName()->text.getBuffer(); } SLANG_API unsigned int spReflectionUserAttribute_GetArgumentCount(SlangReflectionUserAttribute* attrib) { auto userAttr = convert(attrib); if (!userAttr) return 0; - return (unsigned int)userAttr->args.Count(); + return (unsigned int)userAttr->args.getCount(); } SlangReflectionType* spReflectionUserAttribute_GetArgumentType(SlangReflectionUserAttribute* attrib, unsigned int index) { @@ -155,7 +155,7 @@ SLANG_API SlangResult spReflectionUserAttribute_GetArgumentValueInt(SlangReflect { auto userAttr = convert(attrib); if (!userAttr) return SLANG_ERROR_INVALID_PARAMETER; - if (index >= userAttr->args.Count()) return SLANG_ERROR_INVALID_PARAMETER; + if (index >= (unsigned int)userAttr->args.getCount()) return SLANG_ERROR_INVALID_PARAMETER; RefPtr<RefObject> val; if (userAttr->intArgVals.TryGetValue(index, val)) { @@ -168,7 +168,7 @@ SLANG_API SlangResult spReflectionUserAttribute_GetArgumentValueFloat(SlangRefle { auto userAttr = convert(attrib); if (!userAttr) return SLANG_ERROR_INVALID_PARAMETER; - if (index >= userAttr->args.Count()) return SLANG_ERROR_INVALID_PARAMETER; + if (index >= (unsigned int)userAttr->args.getCount()) return SLANG_ERROR_INVALID_PARAMETER; if (auto cexpr = as<FloatingPointLiteralExpr>(userAttr->args[index])) { *rs = (float)cexpr->value; @@ -180,7 +180,7 @@ SLANG_API const char* spReflectionUserAttribute_GetArgumentValueString(SlangRefl { auto userAttr = convert(attrib); if (!userAttr) return nullptr; - if (index >= userAttr->args.Count()) return nullptr; + if (index >= (unsigned int)userAttr->args.getCount()) return nullptr; if (auto cexpr = as<StringLiteralExpr>(userAttr->args[index])) { if (bufLen) @@ -772,7 +772,7 @@ static SlangParameterCategory getParameterCategory( static SlangParameterCategory getParameterCategory( TypeLayout* typeLayout) { - auto resourceInfoCount = typeLayout->resourceInfos.Count(); + auto resourceInfoCount = typeLayout->resourceInfos.getCount(); if(resourceInfoCount == 1) { return getParameterCategory(typeLayout->resourceInfos[0].kind); @@ -790,7 +790,7 @@ static TypeLayout* maybeGetContainerLayout(TypeLayout* typeLayout) if (auto parameterGroupTypeLayout = as<ParameterGroupTypeLayout>(typeLayout)) { auto containerTypeLayout = parameterGroupTypeLayout->containerVarLayout->typeLayout; - if (containerTypeLayout->resourceInfos.Count() != 0) + if (containerTypeLayout->resourceInfos.getCount() != 0) { return containerTypeLayout; } @@ -816,7 +816,7 @@ SLANG_API unsigned spReflectionTypeLayout_GetCategoryCount(SlangReflectionTypeLa typeLayout = maybeGetContainerLayout(typeLayout); - return (unsigned) typeLayout->resourceInfos.Count(); + return (unsigned) typeLayout->resourceInfos.getCount(); } SLANG_API SlangParameterCategory spReflectionTypeLayout_GetCategoryByIndex(SlangReflectionTypeLayout* inTypeLayout, unsigned index) @@ -871,9 +871,9 @@ SLANG_API char const* spReflectionVariable_GetName(SlangReflectionVariable* inVa // If the variable is one that has an "external" name that is supposed // to be exposed for reflection, then report it here if(auto reflectionNameMod = var->FindModifier<ParameterGroupReflectionName>()) - return getText(reflectionNameMod->nameAndLoc.name).Buffer(); + return getText(reflectionNameMod->nameAndLoc.name).getBuffer(); - return getText(var->getName()).Buffer(); + return getText(var->getName()).getBuffer(); } SLANG_API SlangReflectionType* spReflectionVariable_GetType(SlangReflectionVariable* inVar) @@ -1046,7 +1046,7 @@ SLANG_API char const* spReflectionVariableLayout_GetSemanticName(SlangReflection if (!(varLayout->flags & Slang::VarLayoutFlag::HasSemantic)) return 0; - return varLayout->semanticName.Buffer(); + return varLayout->semanticName.getBuffer(); } SLANG_API size_t spReflectionVariableLayout_GetSemanticIndex(SlangReflectionVariableLayout* inVarLayout) @@ -1124,7 +1124,7 @@ namespace Slang if(auto structLayout = as<StructTypeLayout>(typeLayout)) { - return (unsigned) structLayout->fields.Count(); + return (unsigned) structLayout->fields.getCount(); } return 0; @@ -1259,7 +1259,7 @@ SLANG_API int spReflectionEntryPoint_usesAnySampleRateInput( SLANG_API char const* spReflectionTypeParameter_GetName(SlangReflectionTypeParameter * inTypeParam) { auto typeParam = convert(inTypeParam); - return typeParam->decl->getName()->text.Buffer(); + return typeParam->decl->getName()->text.getBuffer(); } SLANG_API unsigned spReflectionTypeParameter_GetIndex(SlangReflectionTypeParameter * inTypeParam) @@ -1272,14 +1272,14 @@ SLANG_API unsigned int spReflectionTypeParameter_GetConstraintCount(SlangReflect { auto typeParam = convert(inTypeParam); auto constraints = typeParam->decl->getMembersOfType<GenericTypeConstraintDecl>(); - return (unsigned int)constraints.Count(); + return (unsigned int)constraints.getCount(); } SLANG_API SlangReflectionType* spReflectionTypeParameter_GetConstraintByIndex(SlangReflectionTypeParameter * inTypeParam, unsigned index) { auto typeParam = convert(inTypeParam); auto constraints = typeParam->decl->getMembersOfType<GenericTypeConstraintDecl>(); - return (SlangReflectionType*)constraints.ToArray()[index]->sup.Ptr(); + return (SlangReflectionType*)constraints.toArray()[index]->sup.Ptr(); } // Shader Reflection @@ -1293,7 +1293,7 @@ SLANG_API unsigned spReflection_GetParameterCount(SlangReflection* inProgram) if (!globalStructLayout) return 0; - return (unsigned) globalStructLayout->fields.Count(); + return (unsigned) globalStructLayout->fields.getCount(); } SLANG_API SlangReflectionParameter* spReflection_GetParameterByIndex(SlangReflection* inProgram, unsigned index) @@ -1311,7 +1311,7 @@ SLANG_API SlangReflectionParameter* spReflection_GetParameterByIndex(SlangReflec SLANG_API unsigned int spReflection_GetTypeParameterCount(SlangReflection * reflection) { auto program = convert(reflection); - return (unsigned int)program->globalGenericParams.Count(); + return (unsigned int)program->globalGenericParams.getCount(); } SLANG_API SlangReflectionTypeParameter* spReflection_GetTypeParameterByIndex(SlangReflection * reflection, unsigned int index) @@ -1334,7 +1334,7 @@ SLANG_API SlangUInt spReflection_getEntryPointCount(SlangReflection* inProgram) auto program = convert(inProgram); if(!program) return 0; - return SlangUInt(program->entryPoints.Count()); + return SlangUInt(program->entryPoints.getCount()); } SLANG_API SlangReflectionEntryPoint* spReflection_getEntryPointByIndex(SlangReflection* inProgram, SlangUInt index) |
