<commit_before>//------------------------------------------------------------------------------
//  offscreen-glfw.c
//  Simple offscreen rendering.
//------------------------------------------------------------------------------
#define HANDMADE_MATH_IMPLEMENTATION
#define HANDMADE_MATH_NO_SSE
#include "HandmadeMath.h"
#define GLFW_INCLUDE_NONE
#include "GLFW/glfw3.h"
#include "flextgl/flextGL.h"
#define SOKOL_IMPL
#define SOKOL_USE_GLCORE33
#include "sokol_gfx.h"

const int WIDTH = 640;
const int HEIGHT = 480;

typedef struct {
    hmm_mat4 mvp;
} params_t;

int main() {

    /* create window and GL context via GLFW */
    glfwInit();
    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    GLFWwindow* w = glfwCreateWindow(WIDTH, HEIGHT, "Sokol Offscreen GLFW", 0, 0);
    glfwMakeContextCurrent(w);
    glfwSwapInterval(1);
    flextInit(w);

    /* setup sokol_gfx */
    sg_desc desc; 
    sg_init_desc(&desc);
    sg_setup(&desc);
    assert(sg_isvalid());

    /* a render target image */
    sg_image_desc img_desc;
    sg_init_image_desc(&img_desc);
    img_desc.render_target = true;
    img_desc.width = img_desc.height = 512;
    img_desc.color_format = SG_PIXELFORMAT_RGBA8;
    img_desc.depth_format = SG_PIXELFORMAT_DEPTH;
    img_desc.min_filter = img_desc.mag_filter = SG_FILTER_LINEAR;
    img_desc.wrap_u = img_desc.wrap_v = SG_WRAP_REPEAT;
    sg_id img = sg_make_image(&img_desc);
<commit_msg>offscreen-glfw: use MSAA render target if supported<commit_after>//------------------------------------------------------------------------------
//  offscreen-glfw.c
//  Simple offscreen rendering.
//------------------------------------------------------------------------------
#define HANDMADE_MATH_IMPLEMENTATION
#define HANDMADE_MATH_NO_SSE
#include "HandmadeMath.h"
#define GLFW_INCLUDE_NONE
#include "GLFW/glfw3.h"
#include "flextgl/flextGL.h"
#define SOKOL_IMPL
#define SOKOL_USE_GLCORE33
#include "sokol_gfx.h"

const int WIDTH = 640;
const int HEIGHT = 480;

typedef struct {
    hmm_mat4 mvp;
} params_t;

int main() {

    /* create window and GL context via GLFW */
    glfwInit();
    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    GLFWwindow* w = glfwCreateWindow(WIDTH, HEIGHT, "Sokol Offscreen GLFW", 0, 0);
    glfwMakeContextCurrent(w);
    glfwSwapInterval(1);
    flextInit(w);

    /* setup sokol_gfx */
    sg_desc desc; 
    sg_init_desc(&desc);
    sg_setup(&desc);
    assert(sg_isvalid());

    /* a render target image */
    sg_image_desc img_desc;
    sg_init_image_desc(&img_desc);
    img_desc.render_target = true;
    img_desc.width = img_desc.height = 512;
    img_desc.color_format = SG_PIXELFORMAT_RGBA8;
    img_desc.depth_format = SG_PIXELFORMAT_DEPTH;
    img_desc.min_filter = img_desc.mag_filter = SG_FILTER_LINEAR;
    img_desc.wrap_u = img_desc.wrap_v = SG_WRAP_REPEAT;
    /* if supported, use MSAA for offscreen rendering */
    if (sg_query_feature(SG_FEATURE_MSAA_RENDER_TARGETS)) {
        img_desc.sample_count = 4;
    }
    sg_id img = sg_make_image(&img_desc);

{'fraction_non_alphanumeric': 0.18187066974595842, 'fraction_numerical': 0.011836027713625866, 'mean_word_length': 2.820286659316428, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3179441', 'n_tokens_mistral': 1306, 'n_tokens_neox': 1233, 'n_words': 217}