mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 10:04:24 +01:00
Implements demo_renderer_t using D3D11, same pattern as Metal. Uses GLFW for windowing (GLFW_NO_API + glfwGetWin32Window). Compiled conditionally with #ifdef _WIN32. Not yet wired into gpu-output.hh or build system — needs GLFW and GLib for MinGW, which are available on Fedora. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
/*
|
|
* Copyright 2026 Behdad Esfahbod. All Rights Reserved.
|
|
*/
|
|
|
|
#ifndef DEMO_RENDERER_H
|
|
#define DEMO_RENDERER_H
|
|
|
|
#include "demo-common.h"
|
|
#include "demo-shader.h"
|
|
|
|
typedef struct demo_atlas_t demo_atlas_t;
|
|
|
|
|
|
struct demo_renderer_t
|
|
{
|
|
virtual ~demo_renderer_t () {}
|
|
|
|
/* Atlas for glyph data upload. */
|
|
virtual demo_atlas_t *get_atlas () = 0;
|
|
|
|
/* One-time setup after atlas is populated. */
|
|
virtual void setup () = 0;
|
|
|
|
/* Rendering state. */
|
|
virtual void set_gamma (float gamma) = 0;
|
|
virtual void set_foreground (float r, float g, float b, float a) = 0;
|
|
virtual void set_background (float r, float g, float b, float a) = 0;
|
|
virtual void set_debug (bool enabled) = 0;
|
|
virtual void set_stem_darkening (bool enabled) { (void) enabled; }
|
|
|
|
/* sRGB framebuffer control; returns false if unsupported. */
|
|
virtual bool set_srgb (bool enabled) = 0;
|
|
|
|
/* Vsync toggle. */
|
|
virtual void toggle_vsync (bool &vsync) = 0;
|
|
|
|
/* Render a frame. */
|
|
virtual void display (glyph_vertex_t *vertices, unsigned int count,
|
|
int width, int height, float mat[16]) = 0;
|
|
};
|
|
|
|
|
|
#ifndef HB_GPU_NO_GLFW
|
|
demo_renderer_t *
|
|
demo_renderer_create_gl (GLFWwindow *window);
|
|
|
|
#ifdef __APPLE__
|
|
demo_renderer_t *
|
|
demo_renderer_create_metal (GLFWwindow *window);
|
|
#endif
|
|
|
|
#ifdef _WIN32
|
|
demo_renderer_t *
|
|
demo_renderer_create_d3d11 (GLFWwindow *window);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#endif /* DEMO_RENDERER_H */
|