Hash :
d255123c
Author :
Date :
2017-10-26T20:03:33
Store shader interface variables as per query spec GLES 3.1 section 7.3.1.1 specifies how active variable entries should be generated and how active variables are named. The specs for program interface variable queries are built on top of this section. ANGLE has already followed this spec for the most part for generating variable lists in ProgramState, but now we also follow the naming spec for arrays and include [0] at the end of the stored name. This will make implementing arrays of arrays more straightforward. Most logic for variable queries will just keep working as is when arrays of arrays are added instead of needing more complex logic for handling array indexing. BUG=angleproject:2125 TEST=angle_end2end_tests Change-Id: I3acd14253153e10bc312114b0303065da2efb506 Reviewed-on: https://chromium-review.googlesource.com/739826 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// string_utils:
// String helper functions.
//
#ifndef LIBANGLE_STRING_UTILS_H_
#define LIBANGLE_STRING_UTILS_H_
#include <string>
#include <vector>
#include "common/Optional.h"
namespace angle
{
extern const char kWhitespaceASCII[];
enum WhitespaceHandling
{
KEEP_WHITESPACE,
TRIM_WHITESPACE,
};
enum SplitResult
{
SPLIT_WANT_ALL,
SPLIT_WANT_NONEMPTY,
};
std::vector<std::string> SplitString(const std::string &input,
const std::string &delimiters,
WhitespaceHandling whitespace,
SplitResult resultType);
void SplitStringAlongWhitespace(const std::string &input,
std::vector<std::string> *tokensOut);
std::string TrimString(const std::string &input, const std::string &trimChars);
bool HexStringToUInt(const std::string &input, unsigned int *uintOut);
bool ReadFileToString(const std::string &path, std::string *stringOut);
Optional<std::vector<wchar_t>> WidenString(size_t length, const char *cString);
// Check if the string str begins with the given prefix.
// The comparison is case sensitive.
bool BeginsWith(const std::string &str, const std::string &prefix);
// Check if the string str begins with the given prefix.
// Prefix may not be NULL and needs to be NULL terminated.
// The comparison is case sensitive.
bool BeginsWith(const std::string &str, const char *prefix);
// Check if the string str begins with the given prefix.
// str and prefix may not be NULL and need to be NULL terminated.
// The comparison is case sensitive.
bool BeginsWith(const char *str, const char *prefix);
// Check if the string str begins with the first prefixLength characters of the given prefix.
// The length of the prefix string should be greater than or equal to prefixLength.
// The comparison is case sensitive.
bool BeginsWith(const std::string &str, const std::string &prefix, const size_t prefixLength);
// Check if the string str ends with the given suffix.
// Suffix may not be NUL and needs to be NULL terminated.
// The comparison is case sensitive.
bool EndsWith(const std::string& str, const char* suffix);
// Convert to lower-case.
void ToLower(std::string *str);
// Replaces the substring 'substring' in 'str' with 'replacement'. Returns true if successful.
bool ReplaceSubstring(std::string *str,
const std::string &substring,
const std::string &replacement);
} // namespace angle
#endif // LIBANGLE_STRING_UTILS_H_