libs/render/src/eu/render/renderer.pimpl.cc
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "eu/log/log.h" | ||
| 2 | |||
| 3 | #include "eu/render/fullscreen.h" | ||
| 4 | #include "eu/render/renderer.pimpl.h" | ||
| 5 | |||
| 6 | #include "glad/glad.h" | ||
| 7 | #include "eu/render/shader_resource.h" | ||
| 8 | |||
| 9 | namespace eu::render | ||
| 10 | { | ||
| 11 | |||
| 12 | |||
| 13 | ✗ | std::string string_from_gl_bytes(const GLubyte* bytes) | |
| 14 | { | ||
| 15 | ✗ | return reinterpret_cast<const char*>(bytes); | |
| 16 | } | ||
| 17 | |||
| 18 | ✗ | CameraUniformBuffer make_camera_uniform_buffer_desc() | |
| 19 | { | ||
| 20 | ✗ | CameraUniformBuffer camera_uniform_buffer; | |
| 21 | |||
| 22 | { | ||
| 23 | ✗ | core::UniformBufferCompiler compiler; | |
| 24 | ✗ | compiler.add(&camera_uniform_buffer.clip_from_view_uni, core::UniformType::mat4, "u_clip_from_view"); | |
| 25 | ✗ | compiler.add(&camera_uniform_buffer.view_from_world_uni, core::UniformType::mat4, "u_view_from_world"); | |
| 26 | ✗ | camera_uniform_buffer.setup = compiler.compile("Camera", 0); | |
| 27 | ✗ | } | |
| 28 | |||
| 29 | ✗ | camera_uniform_buffer.buffer = std::make_unique<UniformBuffer>(USE_DEBUG_LABEL_MANY("camera uniform buffer") camera_uniform_buffer.setup); | |
| 30 | |||
| 31 | ✗ | return camera_uniform_buffer; | |
| 32 | ✗ | } | |
| 33 | |||
| 34 | ✗ | RendererPimpl::RendererPimpl(State* new_states, const Assets& assets, const RenderSettings& set, const FullScreenGeom& full_screen) | |
| 35 | ✗ | : states(new_states) | |
| 36 | ✗ | , camera_uniform_buffer(make_camera_uniform_buffer_desc()) | |
| 37 | ✗ | , shaders_resources(load_shaders(assets, camera_uniform_buffer, set, full_screen)) | |
| 38 | ✗ | , full_screen_geom(full_screen.geom) | |
| 39 | { | ||
| 40 | ✗ | const auto vendor = string_from_gl_bytes(glGetString(GL_VENDOR)); | |
| 41 | ✗ | const auto renderer = string_from_gl_bytes(glGetString(GL_RENDERER)); | |
| 42 | ✗ | const auto version = string_from_gl_bytes(glGetString(GL_VERSION)); | |
| 43 | ✗ | const auto shading_language_version = string_from_gl_bytes(glGetString(GL_SHADING_LANGUAGE_VERSION)); | |
| 44 | ✗ | const auto extensions = string_from_gl_bytes(glGetStringi(GL_EXTENSIONS, 0)); | |
| 45 | |||
| 46 | ✗ | LOG_INFO("vendor {}, renderer {}", vendor.c_str(), renderer.c_str()); | |
| 47 | ✗ | LOG_INFO("version {} (glsl {})", version.c_str(), shading_language_version.c_str()); | |
| 48 | ✗ | LOG_INFO("extensions {}", extensions.c_str()); | |
| 49 | ✗ | } | |
| 50 | |||
| 51 | |||
| 52 | } // namespace eu::render | ||
| 53 |