Skip to content

Commit

Permalink
nv2a/gl: Rebase line width feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Dec 31, 2024
1 parent 5ca3f92 commit 2fd8881
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hw/xbox/nv2a/pgraph/gl/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,10 @@ void pgraph_gl_draw_begin(NV2AState *d)
if (!anti_aliasing && pgraph_reg_r(pg, NV_PGRAPH_SETUPRASTER) &
NV_PGRAPH_SETUPRASTER_LINESMOOTHENABLE) {
glEnable(GL_LINE_SMOOTH);
glLineWidth(MIN(r->supportedSmoothLineWidthRange[1], pg->surface_scale_factor));
} else {
glDisable(GL_LINE_SMOOTH);
glLineWidth(MIN(r->supportedAliasedLineWidthRange[1], pg->surface_scale_factor));
}
if (!anti_aliasing && pgraph_reg_r(pg, NV_PGRAPH_SETUPRASTER) &
NV_PGRAPH_SETUPRASTER_POLYSMOOTHENABLE) {
Expand Down
4 changes: 4 additions & 0 deletions hw/xbox/nv2a/pgraph/gl/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static void pgraph_gl_init(NV2AState *d, Error **errp)
PGRAPHState *pg = &d->pgraph;

pg->gl_renderer_state = g_malloc0(sizeof(*pg->gl_renderer_state));
PGRAPHGLState *r = pg->gl_renderer_state;

/* fire up opengl */
glo_set_current(g_nv2a_context_render);
Expand All @@ -51,6 +52,9 @@ static void pgraph_gl_init(NV2AState *d, Error **errp)
/* Internal RGB565 texture format */
assert(glo_check_extension("GL_ARB_ES2_compatibility"));

glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, r->supportedSmoothLineWidthRange);
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, r->supportedAliasedLineWidthRange);

pgraph_gl_init_surfaces(pg);
pgraph_gl_init_reports(d);
pgraph_gl_init_textures(d);
Expand Down
3 changes: 3 additions & 0 deletions hw/xbox/nv2a/pgraph/gl/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ typedef struct PGRAPHGLState {
GLint pvideo_color_key_loc;
GLint palette_loc[256];
} disp_rndr;

GLfloat supportedAliasedLineWidthRange[2];
GLfloat supportedSmoothLineWidthRange[2];
} PGRAPHGLState;

extern GloContext *g_nv2a_context_render;
Expand Down

0 comments on commit 2fd8881

Please sign in to comment.