Bug 1801095 - Don't expose webgl_-prefixed uniforms to webgl. r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D164007
This commit is contained in:
Kelsey Gilbert
2022-12-07 02:14:03 +00:00
parent 15d9dca80f
commit 1882d16c5c
4 changed files with 9 additions and 10 deletions

View File

@@ -705,11 +705,6 @@ static bool IsWebglOutOfProcessEnabled() {
return StaticPrefs::webgl_out_of_process();
}
static inline bool StartsWith(const std::string& haystack,
const std::string& needle) {
return haystack.find(needle) == 0;
}
bool ClientWebGLContext::CreateHostContext(const uvec2& requestedSize) {
const auto pNotLost = std::make_shared<webgl::NotLostData>(*this);
auto& notLost = *pNotLost;

View File

@@ -2159,6 +2159,7 @@ webgl::LinkActiveInfo GetLinkActiveInfo(
}();
const auto userName = fnUnmapName(mappedName);
if (StartsWith(userName, "webgl_")) continue;
// -

View File

@@ -318,11 +318,6 @@ ShaderValidator::ValidateAndTranslate(const char* const source) const {
return ret;
}
template <size_t N>
static bool StartsWith(const std::string& haystack, const char (&needle)[N]) {
return haystack.compare(0, N - 1, needle) == 0;
}
bool ShaderValidatorResults::CanLinkTo(const ShaderValidatorResults& vert,
nsCString* const out_log) const {
MOZ_ASSERT(mValid);

View File

@@ -8,6 +8,7 @@
#include <limits>
#include <string>
#include <string_view>
#include <tuple>
#include <type_traits>
#include <unordered_map>
@@ -1184,6 +1185,13 @@ inline void Memcpy(const RangedPtr<T>* const destBegin,
// -
inline bool StartsWith(const std::string_view str,
const std::string_view part) {
return str.find(part) == 0;
}
// -
namespace webgl {
// In theory, this number can be unbounded based on the driver. However, no