Cleanups
This commit is contained in:
parent
c91df88fe2
commit
7225170e97
|
@ -97,16 +97,22 @@ static void gfx_display_ctr_draw(gfx_display_ctx_draw_t *draw,
|
||||||
0x3FFFFFFF);
|
0x3FFFFFFF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(texture->data), texture->width, texture->height,
|
ctrGuSetTexture(GPU_TEXUNIT0,
|
||||||
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR) |
|
VIRT_TO_PHYS(texture->data),
|
||||||
GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
|
texture->width,
|
||||||
|
texture->height,
|
||||||
|
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR)
|
||||||
|
| GPU_TEXTURE_MIN_FILTER(GPU_LINEAR)
|
||||||
|
| GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE)
|
||||||
|
| GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
|
||||||
GPU_RGBA8);
|
GPU_RGBA8);
|
||||||
|
|
||||||
GPU_SetViewport(NULL,
|
GPU_SetViewport(NULL,
|
||||||
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
|
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
|
||||||
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
|
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
|
||||||
ctr->video_mode == CTR_VIDEO_MODE_2D_800X240 ?
|
ctr->video_mode == CTR_VIDEO_MODE_2D_800X240
|
||||||
CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH);
|
? CTR_TOP_FRAMEBUFFER_WIDTH * 2
|
||||||
|
: CTR_TOP_FRAMEBUFFER_WIDTH);
|
||||||
|
|
||||||
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
|
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,8 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw,
|
||||||
GLuint texture = 0;
|
GLuint texture = 0;
|
||||||
gl_core_t *gl = (gl_core_t*)data;
|
gl_core_t *gl = (gl_core_t*)data;
|
||||||
const struct
|
const struct
|
||||||
gl_core_buffer_locations *loc = NULL;
|
gl_core_buffer_locations
|
||||||
|
*loc = NULL;
|
||||||
|
|
||||||
if (!gl || !draw)
|
if (!gl || !draw)
|
||||||
return;
|
return;
|
||||||
|
@ -214,24 +215,26 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
glUseProgram(gl->pipelines.alpha_blend);
|
glUseProgram(gl->pipelines.alpha_blend);
|
||||||
loc = NULL;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loc && loc->flat_ubo_vertex >= 0)
|
if (loc)
|
||||||
glUniform4fv(loc->flat_ubo_vertex,
|
{
|
||||||
(GLsizei)((draw->backend_data_size + 15) / 16),
|
if (loc->flat_ubo_vertex >= 0)
|
||||||
(const GLfloat*)draw->backend_data);
|
glUniform4fv(loc->flat_ubo_vertex,
|
||||||
|
(GLsizei)((draw->backend_data_size + 15) / 16),
|
||||||
|
(const GLfloat*)draw->backend_data);
|
||||||
|
|
||||||
if (loc && loc->flat_ubo_fragment >= 0)
|
if (loc->flat_ubo_fragment >= 0)
|
||||||
glUniform4fv(loc->flat_ubo_fragment,
|
glUniform4fv(loc->flat_ubo_fragment,
|
||||||
(GLsizei)((draw->backend_data_size + 15) / 16),
|
(GLsizei)((draw->backend_data_size + 15) / 16),
|
||||||
(const GLfloat*)draw->backend_data);
|
(const GLfloat*)draw->backend_data);
|
||||||
|
}
|
||||||
if (!loc)
|
else
|
||||||
{
|
{
|
||||||
const math_matrix_4x4 *mat = draw->matrix_data
|
const math_matrix_4x4 *mat = draw->matrix_data
|
||||||
? (const math_matrix_4x4*)draw->matrix_data : (const math_matrix_4x4*)&gl->mvp_no_rot;
|
? (const math_matrix_4x4*)draw->matrix_data
|
||||||
|
: (const math_matrix_4x4*)&gl->mvp_no_rot;
|
||||||
if (gl->pipelines.alpha_blend_loc.flat_ubo_vertex >= 0)
|
if (gl->pipelines.alpha_blend_loc.flat_ubo_vertex >= 0)
|
||||||
glUniform4fv(gl->pipelines.alpha_blend_loc.flat_ubo_vertex,
|
glUniform4fv(gl->pipelines.alpha_blend_loc.flat_ubo_vertex,
|
||||||
4, mat->data);
|
4, mat->data);
|
||||||
|
|
|
@ -87,12 +87,10 @@ static unsigned to_menu_pipeline(
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void gfx_display_vk_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
static void gfx_display_vk_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||||
void *data, unsigned video_width, unsigned video_height)
|
void *data, unsigned video_width, unsigned video_height)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SHADERPIPELINE
|
|
||||||
static uint8_t ubo_scratch_data[768];
|
static uint8_t ubo_scratch_data[768];
|
||||||
static float t = 0.0f;
|
static float t = 0.0f;
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
|
@ -162,8 +160,8 @@ static void gfx_display_vk_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||||
}
|
}
|
||||||
|
|
||||||
t += 0.01;
|
t += 0.01;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
|
static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
|
||||||
void *data, unsigned video_width, unsigned video_height)
|
void *data, unsigned video_width, unsigned video_height)
|
||||||
|
@ -335,7 +333,11 @@ static void gfx_display_vk_scissor_end(void *data,
|
||||||
|
|
||||||
gfx_display_ctx_driver_t gfx_display_ctx_vulkan = {
|
gfx_display_ctx_driver_t gfx_display_ctx_vulkan = {
|
||||||
gfx_display_vk_draw,
|
gfx_display_vk_draw,
|
||||||
|
#ifdef HAVE_SHADERPIPELINE
|
||||||
gfx_display_vk_draw_pipeline,
|
gfx_display_vk_draw_pipeline,
|
||||||
|
#else
|
||||||
|
NULL, /* draw_pipeline */
|
||||||
|
#endif
|
||||||
gfx_display_vk_blend_begin,
|
gfx_display_vk_blend_begin,
|
||||||
gfx_display_vk_blend_end,
|
gfx_display_vk_blend_end,
|
||||||
gfx_display_vk_get_default_mvp,
|
gfx_display_vk_get_default_mvp,
|
||||||
|
|
Loading…
Reference in New Issue