This commit is contained in:
twinaphex 2020-09-26 23:51:59 +02:00
parent c91df88fe2
commit 7225170e97
3 changed files with 32 additions and 21 deletions

View File

@ -97,16 +97,22 @@ static void gfx_display_ctr_draw(gfx_display_ctx_draw_t *draw,
0x3FFFFFFF);
#endif
ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(texture->data), 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),
ctrGuSetTexture(GPU_TEXUNIT0,
VIRT_TO_PHYS(texture->data),
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_SetViewport(NULL,
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
ctr->video_mode == CTR_VIDEO_MODE_2D_800X240 ?
CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH);
ctr->video_mode == CTR_VIDEO_MODE_2D_800X240
? CTR_TOP_FRAMEBUFFER_WIDTH * 2
: CTR_TOP_FRAMEBUFFER_WIDTH);
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);

View File

@ -150,7 +150,8 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw,
GLuint texture = 0;
gl_core_t *gl = (gl_core_t*)data;
const struct
gl_core_buffer_locations *loc = NULL;
gl_core_buffer_locations
*loc = NULL;
if (!gl || !draw)
return;
@ -214,24 +215,26 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw,
default:
glUseProgram(gl->pipelines.alpha_blend);
loc = NULL;
break;
}
if (loc && loc->flat_ubo_vertex >= 0)
glUniform4fv(loc->flat_ubo_vertex,
(GLsizei)((draw->backend_data_size + 15) / 16),
(const GLfloat*)draw->backend_data);
if (loc)
{
if (loc->flat_ubo_vertex >= 0)
glUniform4fv(loc->flat_ubo_vertex,
(GLsizei)((draw->backend_data_size + 15) / 16),
(const GLfloat*)draw->backend_data);
if (loc && loc->flat_ubo_fragment >= 0)
glUniform4fv(loc->flat_ubo_fragment,
(GLsizei)((draw->backend_data_size + 15) / 16),
(const GLfloat*)draw->backend_data);
if (!loc)
if (loc->flat_ubo_fragment >= 0)
glUniform4fv(loc->flat_ubo_fragment,
(GLsizei)((draw->backend_data_size + 15) / 16),
(const GLfloat*)draw->backend_data);
}
else
{
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)
glUniform4fv(gl->pipelines.alpha_blend_loc.flat_ubo_vertex,
4, mat->data);

View File

@ -87,12 +87,10 @@ static unsigned to_menu_pipeline(
}
return 0;
}
#endif
static void gfx_display_vk_draw_pipeline(gfx_display_ctx_draw_t *draw,
void *data, unsigned video_width, unsigned video_height)
{
#ifdef HAVE_SHADERPIPELINE
static uint8_t ubo_scratch_data[768];
static float t = 0.0f;
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;
#endif
}
#endif
static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
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_vk_draw,
#ifdef HAVE_SHADERPIPELINE
gfx_display_vk_draw_pipeline,
#else
NULL, /* draw_pipeline */
#endif
gfx_display_vk_blend_begin,
gfx_display_vk_blend_end,
gfx_display_vk_get_default_mvp,