Adding SetViewPortCommand

This commit is contained in:
Francisco Javier Trujillo Mata 2022-08-01 12:23:58 +02:00 committed by Sam Lantinga
parent a9f4cda3f9
commit 83c1179744
1 changed files with 15 additions and 1 deletions

View File

@ -347,6 +347,18 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
}
static int
PS2_RenderSetViewPort(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
{
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
const SDL_Rect *viewport = &cmd->data.viewport.rect;
gsKit_set_display_offset(data->gsGlobal, viewport->x, viewport->y);
gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(viewport->x, viewport->y, viewport->w, viewport->h));
return 0;
}
static int
PS2_RenderSetClipRect(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
{
@ -580,8 +592,10 @@ PS2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
{
while (cmd) {
switch (cmd->command) {
case SDL_RENDERCMD_SETVIEWPORT: /* pending to be implemented */
case SDL_RENDERCMD_SETVIEWPORT: {
PS2_RenderSetViewPort(renderer, cmd);
break;
}
case SDL_RENDERCMD_SETCLIPRECT: {
PS2_RenderSetClipRect(renderer, cmd);
break;