зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1849433 - Code cleanups in dom/canvas/WebGL. r=gfx-reviewers,gw
Differential Revision: https://phabricator.services.mozilla.com/D186589
This commit is contained in:
Родитель
13f32b7c87
Коммит
2631905c4b
|
@ -143,14 +143,7 @@ WebGLContext::WebGLContext(HostWebGLContext& host,
|
|||
mResistFingerprinting(desc.resistFingerprinting),
|
||||
mOptions(desc.options),
|
||||
mPrincipalKey(desc.principalKey),
|
||||
mPendingContextLoss(false),
|
||||
mMaxPerfWarnings(StaticPrefs::webgl_perf_max_warnings()),
|
||||
mMaxAcceptableFBStatusInvals(
|
||||
StaticPrefs::webgl_perf_max_acceptable_fb_status_invals()),
|
||||
mContextLossHandler(this),
|
||||
mMaxWarnings(StaticPrefs::webgl_max_warnings_per_context()),
|
||||
mAllowFBInvalidation(StaticPrefs::webgl_allow_fb_invalidation()),
|
||||
mMsaaSamples((uint8_t)StaticPrefs::webgl_msaa_samples()),
|
||||
mRequestedSize(desc.size) {
|
||||
host.mContext = this;
|
||||
const FuncScope funcScope(*this, "<Create>");
|
||||
|
@ -1668,7 +1661,8 @@ void WebGLContext::ScissorRect::Apply(gl::GLContext& gl) const {
|
|||
|
||||
////////////////////////////////////////
|
||||
|
||||
IndexedBufferBinding::IndexedBufferBinding() : mRangeStart(0), mRangeSize(0) {}
|
||||
IndexedBufferBinding::IndexedBufferBinding() = default;
|
||||
IndexedBufferBinding::~IndexedBufferBinding() = default;
|
||||
|
||||
uint64_t IndexedBufferBinding::ByteCount() const {
|
||||
if (!mBufferBinding) return 0;
|
||||
|
|
|
@ -169,16 +169,6 @@ struct WebGLIntOrFloat {
|
|||
}
|
||||
};
|
||||
|
||||
struct IndexedBufferBinding {
|
||||
RefPtr<WebGLBuffer> mBufferBinding;
|
||||
uint64_t mRangeStart;
|
||||
uint64_t mRangeSize;
|
||||
|
||||
IndexedBufferBinding();
|
||||
|
||||
uint64_t ByteCount() const;
|
||||
};
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
namespace webgl {
|
||||
|
@ -195,11 +185,6 @@ class AvailabilityRunnable final : public DiscardableRunnable {
|
|||
NS_IMETHOD Run() override;
|
||||
};
|
||||
|
||||
struct BufferAndIndex final {
|
||||
const WebGLBuffer* buffer = nullptr;
|
||||
uint32_t id = -1;
|
||||
};
|
||||
|
||||
} // namespace webgl
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -304,12 +289,13 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
|
|||
const uint32_t mMaxVertIdsPerDraw = StaticPrefs::webgl_max_vert_ids_per_draw();
|
||||
|
||||
bool mIsContextLost = false;
|
||||
Atomic<bool> mPendingContextLoss;
|
||||
Atomic<bool> mPendingContextLoss = Atomic<bool>{false};
|
||||
webgl::ContextLossReason mPendingContextLossReason =
|
||||
webgl::ContextLossReason::None;
|
||||
const uint32_t mMaxPerfWarnings;
|
||||
const uint32_t mMaxPerfWarnings = StaticPrefs::webgl_perf_max_warnings();
|
||||
mutable uint64_t mNumPerfWarnings = 0;
|
||||
const uint32_t mMaxAcceptableFBStatusInvals;
|
||||
const uint32_t mMaxAcceptableFBStatusInvals =
|
||||
StaticPrefs::webgl_perf_max_acceptable_fb_status_invals();
|
||||
bool mWarnOnce_DepthTexCompareFilterable = true;
|
||||
|
||||
uint64_t mNextFenceId = 1;
|
||||
|
@ -1228,7 +1214,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
|
|||
mutable uint64_t mDrawCallsSinceLastFlush = 0;
|
||||
|
||||
mutable uint64_t mWarningCount = 0;
|
||||
const uint64_t mMaxWarnings;
|
||||
const uint64_t mMaxWarnings = StaticPrefs::webgl_max_warnings_per_context();
|
||||
bool mAlreadyWarnedAboutFakeVertexAttrib0 = false;
|
||||
|
||||
bool ShouldGenerateWarnings() const { return mWarningCount < mMaxWarnings; }
|
||||
|
@ -1249,13 +1235,13 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
|
|||
bool mNeedsIndexValidation = false;
|
||||
bool mBug_DrawArraysInstancedUserAttribFetchAffectedByFirst = false;
|
||||
|
||||
const bool mAllowFBInvalidation;
|
||||
const bool mAllowFBInvalidation = StaticPrefs::webgl_allow_fb_invalidation();
|
||||
|
||||
bool Has64BitTimestamps() const;
|
||||
|
||||
// --
|
||||
|
||||
const uint8_t mMsaaSamples;
|
||||
const uint8_t mMsaaSamples = static_cast<uint8_t>(StaticPrefs::webgl_msaa_samples());
|
||||
mutable uvec2 mRequestedSize;
|
||||
mutable UniquePtr<gl::MozFramebuffer> mDefaultFB;
|
||||
mutable bool mDefaultFB_IsInvalid = false;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "GLContext.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLTransformFeedback.h"
|
||||
#include "WebGLVertexArray.h"
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <bitset>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
|
@ -16,8 +17,8 @@
|
|||
#include "mozilla/WeakPtr.h"
|
||||
|
||||
#include "CacheInvalidator.h"
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLObjectModel.h"
|
||||
#include "WebGLTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
|
@ -76,7 +77,8 @@ struct ActiveUniformValidationInfo final {
|
|||
};
|
||||
|
||||
struct SamplerUniformInfo final {
|
||||
const decltype(WebGLContext::mBound2DTextures)& texListForType;
|
||||
const nsTArray<RefPtr<WebGLTexture>>& texListForType;
|
||||
// = const decltype(WebGLContext::mBound2DTextures)&
|
||||
const webgl::TextureBaseType texBaseType;
|
||||
const bool isShadowSampler;
|
||||
Vector<uint8_t, 8> texUnits = decltype(texUnits)();
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "ipc/EnumSerializer.h"
|
||||
#include "TexUnpackBlob.h"
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#ifndef WEBGL_TRANSFORM_FEEDBACK_H_
|
||||
#define WEBGL_TRANSFORM_FEEDBACK_H_
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLObjectModel.h"
|
||||
#include "WebGLTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace webgl {
|
||||
|
|
|
@ -1232,8 +1232,26 @@ inline constexpr std::optional<E> AsEnumCase(
|
|||
return ret;
|
||||
}
|
||||
|
||||
// -
|
||||
|
||||
struct BufferAndIndex final {
|
||||
const WebGLBuffer* buffer = nullptr;
|
||||
uint32_t id = -1;
|
||||
};
|
||||
|
||||
} // namespace webgl
|
||||
|
||||
struct IndexedBufferBinding final {
|
||||
RefPtr<WebGLBuffer> mBufferBinding;
|
||||
uint64_t mRangeStart = 0;
|
||||
uint64_t mRangeSize = 0;
|
||||
|
||||
IndexedBufferBinding();
|
||||
~IndexedBufferBinding();
|
||||
|
||||
uint64_t ByteCount() const;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче