17
0
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:
maj00r
2026-09-09 20:35:26 +02:00
parent c3007e3237
commit 3f7960aad5
350 changed files with 5958 additions and 3059 deletions

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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

View File

@@ -1,5 +1,7 @@
#include "stdafx.h"
#include "cubemap.h"
module;
#include "glad/glad.h"
module eu07.gl.cubemap;
gl::cubemap::cubemap()
{

View File

@@ -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

View File

@@ -1,5 +1,7 @@
#include "stdafx.h"
#include "fence.h"
module;
#include "glad/glad.h"
module eu07.gl.fence;
gl::fence::fence()
{

View File

@@ -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

View File

@@ -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()
{

View File

@@ -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
View 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);

View File

@@ -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
View 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

View File

@@ -1,10 +0,0 @@
#pragma once
#include "ubo.h"
#include "utilities/Globals.h"
namespace gl
{
extern std::string glsl_common;
void glsl_common_setup();
}

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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

View File

@@ -1,6 +1,8 @@
#include "stdafx.h"
module;
#include "glad/glad.h"
module eu07.gl.renderbuffer;
#include "renderbuffer.h"
gl::renderbuffer::renderbuffer()
{

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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

View File

@@ -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;

View File

@@ -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