mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-01 12:42:09 +01:00
pch migration to modules [wip]
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
#pragma once
|
||||
module;
|
||||
|
||||
export module eu07.gl.bindable;
|
||||
|
||||
export {
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -25,3 +29,5 @@ namespace gl
|
||||
|
||||
template <typename T> thread_local bindable<T>* bindable<T>::active;
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "stdafx.h"
|
||||
#include "buffer.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
|
||||
module eu07.gl.buffer;
|
||||
|
||||
GLenum gl::buffer::glenum_target(gl::buffer::targets target)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
export module eu07.gl.buffer;
|
||||
import eu07.gl.object;
|
||||
import eu07.gl.bindable;
|
||||
|
||||
export {
|
||||
|
||||
#include "object.h"
|
||||
#include "bindable.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -44,3 +49,5 @@ namespace gl
|
||||
void download(targets target, void *data, int offset, GLsizeiptr size);
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "cubemap.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
module eu07.gl.cubemap;
|
||||
|
||||
gl::cubemap::cubemap()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
export module eu07.gl.cubemap;
|
||||
import eu07.gl.object;
|
||||
|
||||
export {
|
||||
|
||||
#include "object.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -17,3 +22,5 @@ namespace gl
|
||||
void generate_mipmaps();
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "fence.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
module eu07.gl.fence;
|
||||
|
||||
gl::fence::fence()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
export module eu07.gl.fence;
|
||||
import eu07.gl.object;
|
||||
|
||||
export {
|
||||
|
||||
#include "object.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -18,3 +23,5 @@ namespace gl
|
||||
fence& operator=(const fence&) = delete;
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,8 +1,13 @@
|
||||
#include "stdafx.h"
|
||||
#include "framebuffer.h"
|
||||
module;
|
||||
#include <string>
|
||||
#include "glad/glad.h"
|
||||
#include <algorithm>
|
||||
#include "utilities/utilities_macros.h"
|
||||
|
||||
module eu07.gl.framebuffer;
|
||||
import eu07.utilities.logs;
|
||||
import eu07.utilities.utilities;
|
||||
|
||||
#include "utilities/Logs.h"
|
||||
#include "utilities/utilities.h"
|
||||
|
||||
gl::framebuffer::framebuffer()
|
||||
{
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
export module eu07.gl.framebuffer;
|
||||
import eu07.gl.object;
|
||||
import eu07.gl.bindable;
|
||||
import eu07.gl.renderbuffer;
|
||||
import eu07.model.texture;
|
||||
import eu07.gl.cubemap;
|
||||
|
||||
export {
|
||||
|
||||
#include "object.h"
|
||||
#include "bindable.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "model/Texture.h"
|
||||
#include "cubemap.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -32,3 +37,5 @@ namespace gl
|
||||
static void bind(GLuint id);
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
19
gl/gldebug.h
Normal file
19
gl/gldebug.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
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/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "glad/glad.h"
|
||||
|
||||
#define STRINGIZE_DETAIL(x) #x
|
||||
#define STRINGIZE(x) STRINGIZE_DETAIL(x)
|
||||
|
||||
// drops a marker into the command stream so gDEBugger/apitrace captures show
|
||||
// which source line issued the calls that follow
|
||||
#define glDebug(x) if (GLAD_GL_GREMEDY_string_marker) glStringMarkerGREMEDY(0, __FILE__ ":" STRINGIZE(__LINE__) ": " x);
|
||||
@@ -1,5 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "glsl_common.h"
|
||||
module;
|
||||
#include "utilities/Globals_macros.h"
|
||||
#include <string>
|
||||
|
||||
module eu07.gl.glsl_common;
|
||||
import eu07.utilities.globals;
|
||||
import eu07.utilities.utilities;
|
||||
|
||||
std::string gl::glsl_common;
|
||||
|
||||
|
||||
18
gl/glsl_common.cppm
Normal file
18
gl/glsl_common.cppm
Normal file
@@ -0,0 +1,18 @@
|
||||
module;
|
||||
#include <string>
|
||||
#include "utilities/Globals_macros.h"
|
||||
|
||||
export module eu07.gl.glsl_common;
|
||||
import eu07.gl.ubo;
|
||||
import eu07.utilities.globals;
|
||||
|
||||
export {
|
||||
|
||||
|
||||
namespace gl
|
||||
{
|
||||
extern std::string glsl_common;
|
||||
void glsl_common_setup();
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "ubo.h"
|
||||
#include "utilities/Globals.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
extern std::string glsl_common;
|
||||
void glsl_common_setup();
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
module;
|
||||
#include <glad/glad.h>
|
||||
|
||||
export module eu07.gl.object;
|
||||
|
||||
export {
|
||||
|
||||
|
||||
namespace gl
|
||||
{
|
||||
class object
|
||||
@@ -30,3 +34,5 @@ namespace gl
|
||||
object& operator=(const object&) = delete;
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "stdafx.h"
|
||||
#include "pbo.h"
|
||||
module;
|
||||
#include <optional>
|
||||
#include "glad/glad.h"
|
||||
|
||||
module eu07.gl.pbo;
|
||||
import eu07.gl.fence;
|
||||
|
||||
void gl::pbo::request_read(int x, int y, int lx, int ly, int pixsize, GLenum format, GLenum type)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "buffer.h"
|
||||
#include "fence.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
#include <optional>
|
||||
|
||||
export module eu07.gl.pbo;
|
||||
import eu07.gl.buffer;
|
||||
import eu07.gl.fence;
|
||||
|
||||
export {
|
||||
|
||||
|
||||
namespace gl {
|
||||
class pbo : public buffer
|
||||
{
|
||||
@@ -20,3 +25,5 @@ namespace gl {
|
||||
void unmap(targets target = PIXEL_UNPACK_BUFFER);
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,6 +1,11 @@
|
||||
#include "stdafx.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
module eu07.gl.postfx;
|
||||
import eu07.gl.framebuffer;
|
||||
|
||||
#include "postfx.h"
|
||||
|
||||
std::shared_ptr<gl::shader> gl::postfx::vertex;
|
||||
std::shared_ptr<gl::vao> gl::postfx::vao;
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
export module eu07.gl.postfx;
|
||||
import eu07.gl.shader;
|
||||
import eu07.gl.vao;
|
||||
import eu07.gl.framebuffer;
|
||||
import eu07.model.texture;
|
||||
|
||||
export {
|
||||
|
||||
#include "shader.h"
|
||||
#include "vao.h"
|
||||
#include "framebuffer.h"
|
||||
#include "model/Texture.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -23,3 +29,5 @@ namespace gl
|
||||
void apply(std::vector<opengl_texture*> src, framebuffer *dst);
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "query.h"
|
||||
#include "utilities/Globals.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
#include <optional>
|
||||
#include "utilities/Globals_macros.h"
|
||||
|
||||
module eu07.gl.query;
|
||||
import eu07.utilities.globals;
|
||||
gl::query::query(targets target)
|
||||
: target(target)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
export module eu07.gl.query;
|
||||
import eu07.gl.object;
|
||||
|
||||
export {
|
||||
|
||||
#include "object.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -34,3 +41,5 @@ public:
|
||||
std::optional<int64_t> result();
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
module eu07.gl.renderbuffer;
|
||||
|
||||
#include "renderbuffer.h"
|
||||
|
||||
gl::renderbuffer::renderbuffer()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
export module eu07.gl.renderbuffer;
|
||||
import eu07.gl.object;
|
||||
import eu07.gl.bindable;
|
||||
|
||||
export {
|
||||
|
||||
#include "object.h"
|
||||
#include "bindable.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -17,3 +22,5 @@ namespace gl
|
||||
using bindable::bind;
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,11 +1,20 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
module;
|
||||
#include "utilities/Globals_macros.h"
|
||||
#include "glad/glad.h"
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include "shader.h"
|
||||
#include "glsl_common.h"
|
||||
#include "utilities/Logs.h"
|
||||
|
||||
module eu07.gl.shader;
|
||||
import eu07.gl.ubo;
|
||||
import eu07.utilities.globals;
|
||||
import eu07.gl.glsl_common;
|
||||
import eu07.utilities.logs;
|
||||
|
||||
|
||||
inline bool strcend(std::string const &value, std::string const &ending)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "object.h"
|
||||
#include "bindable.h"
|
||||
export module eu07.gl.shader;
|
||||
import eu07.gl.object;
|
||||
import eu07.gl.bindable;
|
||||
|
||||
export {
|
||||
|
||||
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -101,3 +107,5 @@ namespace gl
|
||||
void init();
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "stdafx.h"
|
||||
#include "ubo.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
module eu07.gl.ubo;
|
||||
|
||||
gl::ubo::ubo(size_t size, int idx, GLenum hint)
|
||||
{
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include <cstddef>
|
||||
#include "glad/glad.h"
|
||||
|
||||
export module eu07.gl.ubo;
|
||||
import eu07.glm;
|
||||
import eu07.gl.object;
|
||||
import eu07.gl.bindable;
|
||||
import eu07.gl.buffer;
|
||||
|
||||
export {
|
||||
|
||||
#include "object.h"
|
||||
#include "bindable.h"
|
||||
#include "buffer.h"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#define UBS_PAD(x) uint8_t PAD[x]
|
||||
|
||||
// 12-byte vec3 for structs that must match an exact binary layout (UBOs, vertex data).
|
||||
// Stays packed regardless of GLM_FORCE_DEFAULT_ALIGNED_GENTYPES.
|
||||
// Guard prevents redefinition when stdafx.h also defines it.
|
||||
#ifndef PACKED_VEC3_DEFINED
|
||||
#define PACKED_VEC3_DEFINED
|
||||
using packed_vec3 = glm::vec<3, float, glm::packed_highp>;
|
||||
#endif
|
||||
|
||||
namespace gl
|
||||
{
|
||||
class ubo : public buffer
|
||||
@@ -151,3 +149,5 @@ namespace gl
|
||||
|
||||
#pragma pack(pop)
|
||||
}
|
||||
|
||||
} // export
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "vao.h"
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
#include <cstddef>
|
||||
|
||||
module eu07.gl.vao;
|
||||
|
||||
bool gl::vao::use_vao = true;
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
#pragma once
|
||||
module;
|
||||
#include <vector>
|
||||
|
||||
export module eu07.gl.vao;
|
||||
import eu07.gl.object;
|
||||
import eu07.gl.bindable;
|
||||
import eu07.gl.buffer;
|
||||
|
||||
export {
|
||||
|
||||
#include "object.h"
|
||||
#include "bindable.h"
|
||||
#include "buffer.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@@ -35,3 +40,5 @@ namespace gl
|
||||
static bool use_vao;
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
Reference in New Issue
Block a user