target_ext = sys.argv[i]
backport_ext = None
out_base = None
+ignore_things = []
if target_ext.endswith(".glext"):
fn = target_ext
target_ext = None
secondary.append(parts[1])
elif parts[0]=="backport":
backport_ext = parts[1]
+ elif parts[0]=="ignore":
+ ignore_things.append(parts[1])
if i+1<len(sys.argv):
out_base = os.path.splitext(sys.argv[i+1])[0]
else:
enums = get_nested_elements(req, "enum")
for t in itertools.chain(commands, enums):
name = t.getAttribute("name")
+ if name in ignore_things:
+ continue
+
thing = things.get(name)
if thing:
if thing.extension and extension.name!=target_ext:
--- /dev/null
+#include <msp/datafile/collection.h>
+#include <msp/gl/extensions/ext_texture_array.h>
+#include "error.h"
+#include "pixelstore.h"
+#include "texture2darray.h"
+
+using namespace std;
+
+namespace Msp {
+namespace GL {
+
+Texture2DArray::Texture2DArray():
+ Texture3D(GL_TEXTURE_2D_ARRAY)
+{
+ static Require _req(EXT_texture_array);
+}
+
+void Texture2DArray::layer_image(unsigned level, unsigned z, PixelFormat fmt, DataType type, const void *data)
+{
+ unsigned w = get_width();
+ unsigned h = get_height();
+ unsigned d = get_depth();
+ get_level_size(level, w, h, d);
+
+ sub_image(level, 0, 0, z, w, h, 1, fmt, type, data);
+}
+
+void Texture2DArray::layer_image(unsigned level, unsigned z, const Graphics::Image &img)
+{
+ if(!get_width())
+ throw invalid_operation("Texture2D::layer_image");
+
+ unsigned w = img.get_width();
+ unsigned h = img.get_height();
+ PixelFormat fmt = pixelformat_from_graphics(img.get_format());
+ if(w!=get_width() || h!=get_height())
+ throw incompatible_data("Texture2D::image");
+
+ PixelStore pstore = PixelStore::from_image(img);
+ BindRestore _bind_ps(pstore);
+
+ layer_image(level, z, fmt, UNSIGNED_BYTE, img.get_data());
+}
+
+
+Texture2DArray::Loader::Loader(Texture2DArray &t):
+ DataFile::DerivedObjectLoader<Texture2DArray, Texture3D::Loader>(t)
+{
+ init();
+}
+
+Texture2DArray::Loader::Loader(Texture2DArray &t, Collection &c):
+ DataFile::DerivedObjectLoader<Texture2DArray, Texture3D::Loader>(t, c)
+{
+ init();
+}
+
+void Texture2DArray::Loader::init()
+{
+ add("external_image", &Loader::external_image);
+}
+
+void Texture2DArray::Loader::external_image(unsigned z, const string &fn)
+{
+ Graphics::Image img;
+ RefPtr<IO::Seekable> io = get_collection().open_raw(fn);
+ img.load_io(*io);
+
+ obj.layer_image(0, z, img);
+}
+
+} // namespace GL
+} // namespace Msp
--- /dev/null
+#ifndef MSP_GL_TEXTURE2DARRAY_H_
+#define MSP_GL_TEXTURE2DARRAY_H_
+
+#include "texture3d.h"
+
+namespace Msp {
+namespace GL {
+
+/**
+An array of two-dimensional textures. It's very much like a 3D texture, with
+two important differences: there's no filtering nor mipmapping along the third
+dimension.
+*/
+class Texture2DArray: public Texture3D
+{
+public:
+ class Loader: public Msp::DataFile::DerivedObjectLoader<Texture2DArray, Texture3D::Loader>
+ {
+ public:
+ Loader(Texture2DArray &);
+ Loader(Texture2DArray &, Collection &);
+ private:
+ void init();
+
+ void external_image(unsigned, const std::string &);
+ };
+
+ Texture2DArray();
+
+ void layer_image(unsigned, unsigned, PixelFormat, DataType, const void *);
+ void layer_image(unsigned, unsigned, const Graphics::Image &);
+
+ unsigned get_layers() const { return get_depth(); }
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif