2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-06-28 01:07:21 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
#ifndef WEBGL_VERTEX_ARRAY_H_
|
|
|
|
#define WEBGL_VERTEX_ARRAY_H_
|
2013-06-28 01:07:21 +04:00
|
|
|
|
2019-06-30 04:29:42 +03:00
|
|
|
#include <vector>
|
|
|
|
|
2018-10-17 07:18:15 +03:00
|
|
|
#include "CacheInvalidator.h"
|
2014-11-14 07:03:50 +03:00
|
|
|
#include "WebGLObjectModel.h"
|
2014-09-27 00:11:51 +04:00
|
|
|
#include "WebGLStrongTypes.h"
|
2014-11-14 07:03:50 +03:00
|
|
|
#include "WebGLVertexAttribData.h"
|
2013-06-28 01:07:21 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2014-06-11 04:23:50 +04:00
|
|
|
class WebGLVertexArrayFake;
|
2017-10-21 01:40:12 +03:00
|
|
|
namespace webgl {
|
|
|
|
struct LinkedProgramInfo;
|
|
|
|
}
|
2014-06-11 04:23:50 +04:00
|
|
|
|
2020-01-09 01:19:16 +03:00
|
|
|
class WebGLVertexArray : public WebGLContextBoundObject,
|
2018-10-17 07:18:15 +03:00
|
|
|
public CacheInvalidator {
|
2020-01-09 01:19:16 +03:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(WebGLVertexArray, override)
|
|
|
|
|
2013-06-28 01:07:21 +04:00
|
|
|
public:
|
2014-11-14 07:03:50 +03:00
|
|
|
static WebGLVertexArray* Create(WebGLContext* webgl);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-06-06 03:38:27 +04:00
|
|
|
protected:
|
2020-01-09 01:19:16 +03:00
|
|
|
explicit WebGLVertexArray(WebGLContext* webgl);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-10-17 09:54:28 +03:00
|
|
|
public:
|
2020-01-09 01:19:16 +03:00
|
|
|
virtual void BindVertexArray() = 0;
|
2018-10-17 09:54:28 +03:00
|
|
|
bool mHasBeenBound = false;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-10-17 09:54:28 +03:00
|
|
|
protected:
|
2019-06-30 04:29:42 +03:00
|
|
|
std::vector<WebGLVertexAttribData> mAttribs;
|
2020-01-09 01:19:16 +03:00
|
|
|
RefPtr<WebGLBuffer> mElementArrayBuffer;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-12-22 06:42:07 +03:00
|
|
|
friend class ScopedDrawHelper;
|
2013-06-28 01:07:21 +04:00
|
|
|
friend class WebGLContext;
|
2014-11-14 07:03:50 +03:00
|
|
|
friend class WebGLVertexArrayFake;
|
2014-06-24 04:56:21 +04:00
|
|
|
friend class WebGL2Context;
|
2017-10-21 01:40:12 +03:00
|
|
|
friend struct webgl::LinkedProgramInfo;
|
2013-06-28 01:07:21 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
#endif // WEBGL_VERTEX_ARRAY_H_
|