mirror of
https://github.com/libretro/RetroArch
synced 2025-03-17 10:21:26 +00:00
(drivers_display) Cleanups
This commit is contained in:
parent
ccfad9dc9d
commit
490fb75905
@ -21,7 +21,6 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/ctr_common.h"
|
||||
#include "../drivers/ctr_gu.h"
|
||||
#include "../../ctr/gpu_old.h"
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/d3d10_common.h"
|
||||
|
||||
static void gfx_display_d3d10_blend_begin(void *data)
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/d3d11_common.h"
|
||||
|
||||
static void gfx_display_d3d11_blend_begin(void *data)
|
||||
@ -225,7 +224,8 @@ static void gfx_display_d3d11_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
vertex_data.pSysMem = ca->coords.vertex;
|
||||
vertex_data.SysMemPitch = 0;
|
||||
vertex_data.SysMemSlicePitch = 0;
|
||||
d3d11->device->lpVtbl->CreateBuffer(d3d11->device, &desc, &vertex_data,
|
||||
d3d11->device->lpVtbl->CreateBuffer(
|
||||
d3d11->device, &desc, &vertex_data,
|
||||
&d3d11->menu_pipeline_vbo);
|
||||
}
|
||||
}
|
||||
@ -237,7 +237,9 @@ static void gfx_display_d3d11_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
&d3d11->menu_pipeline_vbo, &stride, &offset);
|
||||
}
|
||||
draw->coords->vertices = ca->coords.vertices;
|
||||
d3d11->context->lpVtbl->OMSetBlendState(d3d11->context, d3d11->blend_pipeline, NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
d3d11->context->lpVtbl->OMSetBlendState(
|
||||
d3d11->context, d3d11->blend_pipeline,
|
||||
NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -258,16 +260,19 @@ static void gfx_display_d3d11_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
return;
|
||||
}
|
||||
|
||||
d3d11->context->lpVtbl->IASetPrimitiveTopology(d3d11->context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
d3d11->context->lpVtbl->IASetPrimitiveTopology(
|
||||
d3d11->context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
|
||||
d3d11->ubo_values.time += 0.01f;
|
||||
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE mapped_ubo;
|
||||
d3d11->context->lpVtbl->Map(
|
||||
d3d11->context, (D3D11Resource)d3d11->ubo, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_ubo);
|
||||
d3d11->context, (D3D11Resource)d3d11->ubo,
|
||||
0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_ubo);
|
||||
*(d3d11_uniform_t*)mapped_ubo.pData = d3d11->ubo_values;
|
||||
d3d11->context->lpVtbl->Unmap(d3d11->context, (D3D11Resource)d3d11->ubo, 0);
|
||||
d3d11->context->lpVtbl->Unmap(d3d11->context,
|
||||
(D3D11Resource)d3d11->ubo, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/d3d12_common.h"
|
||||
|
||||
static void gfx_display_d3d12_blend_begin(void *data)
|
||||
@ -88,11 +87,12 @@ static void gfx_display_d3d12_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (vertex_count == 1)
|
||||
{
|
||||
|
||||
sprite->pos.x = draw->x / (float)d3d12->chain.viewport.Width;
|
||||
sprite->pos.y = (d3d12->chain.viewport.Height - draw->y - draw->height) /
|
||||
(float)d3d12->chain.viewport.Height;
|
||||
sprite->pos.w = draw->width / (float)d3d12->chain.viewport.Width;
|
||||
sprite->pos.h = draw->height / (float)d3d12->chain.viewport.Height;
|
||||
sprite->pos.x = draw->x / (float)d3d12->chain.viewport.Width;
|
||||
sprite->pos.y =
|
||||
(d3d12->chain.viewport.Height - draw->y - draw->height) /
|
||||
(float)d3d12->chain.viewport.Height;
|
||||
sprite->pos.w = draw->width / (float)d3d12->chain.viewport.Width;
|
||||
sprite->pos.h = draw->height / (float)d3d12->chain.viewport.Height;
|
||||
|
||||
sprite->coords.u = 0.0f;
|
||||
sprite->coords.v = 0.0f;
|
||||
@ -104,18 +104,18 @@ static void gfx_display_d3d12_draw(gfx_display_ctx_draw_t *draw,
|
||||
else
|
||||
sprite->params.scaling = 1.0f;
|
||||
|
||||
sprite->params.rotation = draw->rotation;
|
||||
sprite->params.rotation = draw->rotation;
|
||||
|
||||
sprite->colors[3] = DXGI_COLOR_RGBA(
|
||||
sprite->colors[3] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
|
||||
0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]);
|
||||
sprite->colors[2] = DXGI_COLOR_RGBA(
|
||||
sprite->colors[2] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[4], 0xFF * draw->coords->color[5],
|
||||
0xFF * draw->coords->color[6], 0xFF * draw->coords->color[7]);
|
||||
sprite->colors[1] = DXGI_COLOR_RGBA(
|
||||
sprite->colors[1] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[8], 0xFF * draw->coords->color[9],
|
||||
0xFF * draw->coords->color[10], 0xFF * draw->coords->color[11]);
|
||||
sprite->colors[0] = DXGI_COLOR_RGBA(
|
||||
sprite->colors[0] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[12], 0xFF * draw->coords->color[13],
|
||||
0xFF * draw->coords->color[14], 0xFF * draw->coords->color[15]);
|
||||
}
|
||||
@ -201,8 +201,8 @@ static void gfx_display_d3d12_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
D3D12_RANGE read_range;
|
||||
void* vertex_data_begin;
|
||||
|
||||
d3d12->menu_pipeline_vbo_view.StrideInBytes = 2 * sizeof(float);
|
||||
d3d12->menu_pipeline_vbo_view.SizeInBytes =
|
||||
d3d12->menu_pipeline_vbo_view.StrideInBytes = 2 * sizeof(float);
|
||||
d3d12->menu_pipeline_vbo_view.SizeInBytes =
|
||||
ca->coords.vertices * d3d12->menu_pipeline_vbo_view.StrideInBytes;
|
||||
d3d12->menu_pipeline_vbo_view.BufferLocation = d3d12_create_buffer(
|
||||
d3d12->device, d3d12->menu_pipeline_vbo_view.SizeInBytes,
|
||||
@ -210,11 +210,14 @@ static void gfx_display_d3d12_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
|
||||
read_range.Begin = 0;
|
||||
read_range.End = 0;
|
||||
D3D12Map(d3d12->menu_pipeline_vbo, 0, &read_range, &vertex_data_begin);
|
||||
memcpy(vertex_data_begin, ca->coords.vertex, d3d12->menu_pipeline_vbo_view.SizeInBytes);
|
||||
D3D12Map(d3d12->menu_pipeline_vbo, 0,
|
||||
&read_range, &vertex_data_begin);
|
||||
memcpy(vertex_data_begin, ca->coords.vertex,
|
||||
d3d12->menu_pipeline_vbo_view.SizeInBytes);
|
||||
D3D12Unmap(d3d12->menu_pipeline_vbo, 0, NULL);
|
||||
}
|
||||
D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->menu_pipeline_vbo_view);
|
||||
D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1,
|
||||
&d3d12->menu_pipeline_vbo_view);
|
||||
draw->coords->vertices = ca->coords.vertices;
|
||||
break;
|
||||
}
|
||||
@ -223,13 +226,15 @@ static void gfx_display_d3d12_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
case VIDEO_SHADER_MENU_4:
|
||||
case VIDEO_SHADER_MENU_5:
|
||||
case VIDEO_SHADER_MENU_6:
|
||||
D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->frame.vbo_view);
|
||||
D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1,
|
||||
&d3d12->frame.vbo_view);
|
||||
draw->coords->vertices = 4;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
D3D12IASetPrimitiveTopology(d3d12->queue.cmd, D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
D3D12IASetPrimitiveTopology(d3d12->queue.cmd,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
|
||||
d3d12->ubo_values.time += 0.01f;
|
||||
|
||||
@ -244,7 +249,8 @@ static void gfx_display_d3d12_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
D3D12Unmap(d3d12->ubo, 0, NULL);
|
||||
}
|
||||
D3D12SetGraphicsRootConstantBufferView(
|
||||
d3d12->queue.cmd, ROOT_ID_UBO, d3d12->ubo_view.BufferLocation);
|
||||
d3d12->queue.cmd, ROOT_ID_UBO,
|
||||
d3d12->ubo_view.BufferLocation);
|
||||
}
|
||||
|
||||
void gfx_display_d3d12_scissor_begin(void *data,
|
||||
|
@ -25,18 +25,17 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/d3d_common.h"
|
||||
#include "../common/d3d8_common.h"
|
||||
|
||||
static const float d3d8_vertexes[] = {
|
||||
static const float d3d8_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const float d3d8_tex_coords[] = {
|
||||
static const float d3d8_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
@ -55,7 +54,7 @@ static const float *gfx_display_d3d8_get_default_tex_coords(void)
|
||||
|
||||
static void *gfx_display_d3d8_get_default_mvp(void *data)
|
||||
{
|
||||
static float id[] = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
static float id[16] = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f
|
||||
|
@ -25,18 +25,17 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/d3d_common.h"
|
||||
#include "../common/d3d9_common.h"
|
||||
|
||||
static const float d3d9_cg_vertexes[] = {
|
||||
static const float d3d9_cg_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const float d3d9_cg_tex_coords[] = {
|
||||
static const float d3d9_cg_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
@ -55,7 +54,7 @@ static const float *gfx_display_d3d9_cg_get_default_tex_coords(void)
|
||||
|
||||
static void *gfx_display_d3d9_cg_get_default_mvp(void *data)
|
||||
{
|
||||
static float id[] = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
static float id[16] = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f
|
||||
|
@ -25,18 +25,17 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/d3d_common.h"
|
||||
#include "../common/d3d9_common.h"
|
||||
|
||||
static const float d3d9_hlsl_vertexes[] = {
|
||||
static const float d3d9_hlsl_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const float d3d9_hlsl_tex_coords[] = {
|
||||
static const float d3d9_hlsl_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
@ -55,7 +54,7 @@ static const float *gfx_display_d3d9_hlsl_get_default_tex_coords(void)
|
||||
|
||||
static void *gfx_display_d3d9_hlsl_get_default_mvp(void *data)
|
||||
{
|
||||
static float id[] = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
static float id[16] = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f
|
||||
@ -96,10 +95,8 @@ static void gfx_display_d3d9_hlsl_blend_end(void *data)
|
||||
{
|
||||
d3d9_video_t *d3d = (d3d9_video_t*)data;
|
||||
|
||||
if (!d3d)
|
||||
return;
|
||||
|
||||
IDirect3DDevice9_SetRenderState(d3d->dev, D3DRS_ALPHABLENDENABLE, false);
|
||||
if (d3d)
|
||||
IDirect3DDevice9_SetRenderState(d3d->dev, D3DRS_ALPHABLENDENABLE, false);
|
||||
}
|
||||
|
||||
static void gfx_display_d3d9_bind_texture(gfx_display_ctx_draw_t *draw,
|
||||
|
@ -14,16 +14,11 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if 0
|
||||
#include <clamping.h>
|
||||
#include <queues/message_queue.h>
|
||||
#endif
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../../config.def.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
|
@ -20,19 +20,18 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/gl1_common.h"
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
static const GLfloat gl1_menu_vertexes[] = {
|
||||
#include "../common/gl1_common.h"
|
||||
|
||||
static const GLfloat gl1_menu_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const GLfloat gl1_menu_tex_coords[] = {
|
||||
static const GLfloat gl1_menu_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
@ -139,8 +138,10 @@ static void gfx_display_gl1_draw(gfx_display_ctx_draw_t *draw,
|
||||
vertices3 = (float*)malloc(sizeof(float) * 3 * draw->coords->vertices);
|
||||
for (i = 0; i < draw->coords->vertices; i++)
|
||||
{
|
||||
memcpy(&vertices3[i*3], &draw->coords->vertex[i*2], sizeof(float) * 2);
|
||||
vertices3[i*3+2] = 0.0f;
|
||||
memcpy(&vertices3[i * 3],
|
||||
&draw->coords->vertex[i * 2],
|
||||
sizeof(float) * 2);
|
||||
vertices3[i * 3 + 2] = 0.0f;
|
||||
}
|
||||
glVertexPointer(3, GL_FLOAT, 0, vertices3);
|
||||
}
|
||||
|
@ -19,11 +19,10 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/gl2_common.h"
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../common/gl2_common.h"
|
||||
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
static int scx0, scx1, scy0, scy1;
|
||||
|
||||
@ -67,14 +66,14 @@ static bool scissor_is_outside_rectangle(
|
||||
#define MALI_BUG
|
||||
#endif
|
||||
|
||||
static const GLfloat gl2_vertexes[] = {
|
||||
static const GLfloat gl2_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const GLfloat gl2_tex_coords[] = {
|
||||
static const GLfloat gl2_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
@ -186,8 +185,8 @@ gfx_display_gl2_discard_draw_rectangle(gfx_display_ctx_draw_t *draw,
|
||||
|
||||
/* Have to update scissor_set_rectangle() if the
|
||||
* video dimensions change */
|
||||
if ((width != last_video_width) ||
|
||||
(height != last_video_height))
|
||||
if ( (width != last_video_width)
|
||||
|| (height != last_video_height))
|
||||
{
|
||||
scissor_set_rectangle(0,
|
||||
width - 1,
|
||||
|
@ -20,27 +20,25 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "../common/gl3_common.h"
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/gl3_common.h"
|
||||
|
||||
static const float gl3_vertexes[] = {
|
||||
static const float gl3_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const float gl3_tex_coords[] = {
|
||||
static const float gl3_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
1, 0
|
||||
};
|
||||
|
||||
static const float gl3_colors[] = {
|
||||
static const float gl3_colors[16] = {
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
@ -148,7 +146,7 @@ static void gfx_display_gl3_draw(gfx_display_ctx_draw_t *draw,
|
||||
const float *tex_coord = NULL;
|
||||
const float *color = NULL;
|
||||
GLuint texture = 0;
|
||||
gl3_t *gl = (gl3_t*)data;
|
||||
gl3_t *gl = (gl3_t*)data;
|
||||
const struct
|
||||
gl3_buffer_locations
|
||||
*loc = NULL;
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#import "../common/metal_common.h"
|
||||
|
||||
static const float *gfx_display_metal_get_default_vertices(void)
|
||||
@ -46,19 +45,15 @@ static void *gfx_display_metal_get_default_mvp(void *data)
|
||||
static void gfx_display_metal_blend_begin(void *data)
|
||||
{
|
||||
MetalDriver *md = (__bridge MetalDriver *)data;
|
||||
if (!md)
|
||||
return;
|
||||
|
||||
md.display.blend = YES;
|
||||
if (md)
|
||||
md.display.blend = YES;
|
||||
}
|
||||
|
||||
static void gfx_display_metal_blend_end(void *data)
|
||||
{
|
||||
MetalDriver *md = (__bridge MetalDriver *)data;
|
||||
if (!md)
|
||||
return;
|
||||
|
||||
md.display.blend = NO;
|
||||
if (md)
|
||||
md.display.blend = NO;
|
||||
}
|
||||
|
||||
static void gfx_display_metal_draw(gfx_display_ctx_draw_t *draw,
|
||||
@ -67,10 +62,8 @@ static void gfx_display_metal_draw(gfx_display_ctx_draw_t *draw,
|
||||
unsigned video_height)
|
||||
{
|
||||
MetalDriver *md = (__bridge MetalDriver *)data;
|
||||
if (!md || !draw)
|
||||
return;
|
||||
|
||||
[md.display draw:draw];
|
||||
if (md && draw)
|
||||
[md.display draw:draw];
|
||||
}
|
||||
|
||||
static void gfx_display_metal_draw_pipeline(
|
||||
@ -81,10 +74,8 @@ static void gfx_display_metal_draw_pipeline(
|
||||
unsigned video_height)
|
||||
{
|
||||
MetalDriver *md = (__bridge MetalDriver *)data;
|
||||
if (!md || !draw)
|
||||
return;
|
||||
|
||||
[md.display drawPipeline:draw];
|
||||
if (md && draw)
|
||||
[md.display drawPipeline:draw];
|
||||
}
|
||||
|
||||
static void gfx_display_metal_scissor_begin(
|
||||
@ -93,11 +84,15 @@ static void gfx_display_metal_scissor_begin(
|
||||
unsigned video_height,
|
||||
int x, int y, unsigned width, unsigned height)
|
||||
{
|
||||
MTLScissorRect r;
|
||||
MetalDriver *md = (__bridge MetalDriver *)data;
|
||||
if (!md)
|
||||
return;
|
||||
|
||||
MTLScissorRect r = {.x = (NSUInteger)x, .y = (NSUInteger)y, .width = width, .height = height};
|
||||
r.x = (NSUInteger)x;
|
||||
r.y = (NSUInteger)y;
|
||||
r.width = width;
|
||||
r.height = height;
|
||||
[md.display setScissorRect:r];
|
||||
}
|
||||
|
||||
@ -106,24 +101,22 @@ static void gfx_display_metal_scissor_end(void *data,
|
||||
unsigned video_height)
|
||||
{
|
||||
MetalDriver *md = (__bridge MetalDriver *)data;
|
||||
if (!md)
|
||||
return;
|
||||
|
||||
[md.display clearScissorRect];
|
||||
if (md)
|
||||
[md.display clearScissorRect];
|
||||
}
|
||||
|
||||
gfx_display_ctx_driver_t gfx_display_ctx_metal = {
|
||||
.draw = gfx_display_metal_draw,
|
||||
.draw_pipeline = gfx_display_metal_draw_pipeline,
|
||||
.blend_begin = gfx_display_metal_blend_begin,
|
||||
.blend_end = gfx_display_metal_blend_end,
|
||||
.get_default_mvp = gfx_display_metal_get_default_mvp,
|
||||
.get_default_vertices = gfx_display_metal_get_default_vertices,
|
||||
.get_default_tex_coords = gfx_display_metal_get_default_tex_coords,
|
||||
.font_type = FONT_DRIVER_RENDER_METAL_API,
|
||||
.type = GFX_VIDEO_DRIVER_METAL,
|
||||
.ident = "metal",
|
||||
.handles_transform = NO,
|
||||
.scissor_begin = gfx_display_metal_scissor_begin,
|
||||
.scissor_end = gfx_display_metal_scissor_end
|
||||
gfx_display_metal_draw,
|
||||
gfx_display_metal_draw_pipeline,
|
||||
gfx_display_metal_blend_begin,
|
||||
gfx_display_metal_blend_end,
|
||||
gfx_display_metal_get_default_mvp,
|
||||
gfx_display_metal_get_default_vertices,
|
||||
gfx_display_metal_get_default_tex_coords,
|
||||
FONT_DRIVER_RENDER_METAL_API,
|
||||
GFX_VIDEO_DRIVER_METAL,
|
||||
"metal",
|
||||
false,
|
||||
gfx_display_metal_scissor_begin,
|
||||
gfx_display_metal_scissor_end
|
||||
};
|
||||
|
@ -21,17 +21,16 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/rsx_common.h"
|
||||
|
||||
static const float rsx_vertexes[] = {
|
||||
static const float rsx_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const float rsx_tex_coords[] = {
|
||||
static const float rsx_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
@ -86,16 +85,16 @@ static void gfx_display_rsx_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (!draw->texture)
|
||||
return;
|
||||
|
||||
vp.x = fabs(draw->x);
|
||||
vp.y = fabs(rsx->height - draw->y - draw->height);
|
||||
vp.w = draw->width <= rsx->width ? draw->width : rsx->width;
|
||||
vp.h = draw->height <= rsx->height ? draw->height : rsx->height;
|
||||
vp.min = 0.0f;
|
||||
vp.max = 1.0f;
|
||||
vp.scale[0] = vp.w*0.5f;
|
||||
vp.scale[1] = vp.h*-0.5f;
|
||||
vp.scale[2] = (vp.max - vp.min)*0.5f;
|
||||
vp.scale[3] = 0.0f;
|
||||
vp.x = fabs(draw->x);
|
||||
vp.y = fabs(rsx->height - draw->y - draw->height);
|
||||
vp.w = (draw->width <= rsx->width) ? draw->width : rsx->width;
|
||||
vp.h = (draw->height <= rsx->height) ? draw->height : rsx->height;
|
||||
vp.min = 0.0f;
|
||||
vp.max = 1.0f;
|
||||
vp.scale[0] = vp.w*0.5f;
|
||||
vp.scale[1] = vp.h*-0.5f;
|
||||
vp.scale[2] = (vp.max - vp.min)*0.5f;
|
||||
vp.scale[3] = 0.0f;
|
||||
vp.offset[0] = vp.x + vp.w*0.5f;
|
||||
vp.offset[1] = vp.y + vp.h*0.5f;
|
||||
vp.offset[2] = (vp.max + vp.min)*0.5f;
|
||||
@ -125,7 +124,8 @@ static void gfx_display_rsx_draw(gfx_display_ctx_draw_t *draw,
|
||||
rsxBindVertexArrayAttrib(rsx->context, rsx->uv_index->index, 0, rsx->uv_offset, sizeof(rsx_vertex_t), 2, GCM_VERTEX_DATA_TYPE_F32, GCM_LOCATION_RSX);
|
||||
rsxBindVertexArrayAttrib(rsx->context, rsx->col_index->index, 0, rsx->col_offset, sizeof(rsx_vertex_t), 4, GCM_VERTEX_DATA_TYPE_F32, GCM_LOCATION_RSX);
|
||||
|
||||
rsxSetVertexProgramParameter(rsx->context, rsx->vpo, rsx->proj_matrix, (float *)&rsx->mvp_no_rot);
|
||||
rsxSetVertexProgramParameter(rsx->context,
|
||||
rsx->vpo, rsx->proj_matrix, (float *)&rsx->mvp_no_rot);
|
||||
rsxClearSurface(rsx->context, GCM_CLEAR_Z);
|
||||
rsxDrawVertexArray(rsx->context, GCM_TYPE_TRIANGLE_STRIP, 0, draw->coords->vertices);
|
||||
}
|
||||
|
@ -14,11 +14,8 @@
|
||||
*/
|
||||
#include <time.h>
|
||||
|
||||
#include <queues/message_queue.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
static void gfx_display_switch_draw(gfx_display_ctx_draw_t *draw,
|
||||
|
@ -23,25 +23,24 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/vita2d_common.h"
|
||||
#include <defines/psp_defines.h>
|
||||
|
||||
static const float vita2d_vertexes[] = {
|
||||
static const float vita2d_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const float vita2d_tex_coords[] = {
|
||||
static const float vita2d_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
1, 0
|
||||
};
|
||||
|
||||
static const float vita2d_colors[] = {
|
||||
static const float vita2d_colors[16] = {
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
|
@ -22,25 +22,24 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/vulkan_common.h"
|
||||
|
||||
/* Will do Y-flip later, but try to make it similar to GL. */
|
||||
static const float vk_vertexes[] = {
|
||||
static const float vk_vertexes[8] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const float vk_tex_coords[] = {
|
||||
static const float vk_tex_coords[8] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
0, 0,
|
||||
1, 0
|
||||
};
|
||||
|
||||
static const float vk_colors[] = {
|
||||
static const float vk_colors[16] = {
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "../gfx_display.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../common/gx2_common.h"
|
||||
#include "../../wiiu/system/memory.h"
|
||||
#include "../../wiiu/wiiu_dbg.h"
|
||||
@ -166,20 +165,23 @@ static void gfx_display_wiiu_draw(gfx_display_ctx_draw_t *draw,
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite_vertex_t* v;
|
||||
if (wiiu->vertex_cache.current + 1 > wiiu->vertex_cache.size)
|
||||
return;
|
||||
|
||||
sprite_vertex_t* v = wiiu->vertex_cache.v + wiiu->vertex_cache.current;
|
||||
v->pos.x = draw->x;
|
||||
v->pos.y = wiiu->color_buffer.surface.height - draw->y - draw->height;
|
||||
v->pos.width = draw->width;
|
||||
v->pos.height = draw->height;
|
||||
v->coord.u = 0.0f;
|
||||
v->coord.v = 0.0f;
|
||||
v->coord.width = 1.0f;
|
||||
v->coord.height = 1.0f;
|
||||
v = wiiu->vertex_cache.v + wiiu->vertex_cache.current;
|
||||
v->pos.x = draw->x;
|
||||
v->pos.y = wiiu->color_buffer.surface.height -
|
||||
draw->y - draw->height;
|
||||
v->pos.width = draw->width;
|
||||
v->pos.height = draw->height;
|
||||
v->coord.u = 0.0f;
|
||||
v->coord.v = 0.0f;
|
||||
v->coord.width = 1.0f;
|
||||
v->coord.height = 1.0f;
|
||||
|
||||
v->color = COLOR_RGBA(0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
|
||||
v->color = COLOR_RGBA(
|
||||
0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
|
||||
0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]);
|
||||
|
||||
if (draw->texture)
|
||||
@ -193,8 +195,10 @@ static void gfx_display_wiiu_draw(gfx_display_ctx_draw_t *draw,
|
||||
GX2SetShaderMode(GX2_SHADER_MODE_GEOMETRY_SHADER);
|
||||
GX2SetShader(&sprite_shader);
|
||||
#if 0
|
||||
GX2SetGeometryShaderInputRingBuffer(wiiu->input_ring_buffer, wiiu->input_ring_buffer_size);
|
||||
GX2SetGeometryShaderOutputRingBuffer(wiiu->output_ring_buffer, wiiu->output_ring_buffer_size);
|
||||
GX2SetGeometryShaderInputRingBuffer(wiiu->input_ring_buffer,
|
||||
wiiu->input_ring_buffer_size);
|
||||
GX2SetGeometryShaderOutputRingBuffer(wiiu->output_ring_buffer,
|
||||
wiiu->output_ring_buffer_size);
|
||||
#endif
|
||||
GX2SetVertexUniformBlock(sprite_shader.vs.uniformBlocks[0].offset,
|
||||
sprite_shader.vs.uniformBlocks[0].size,
|
||||
@ -202,8 +206,10 @@ static void gfx_display_wiiu_draw(gfx_display_ctx_draw_t *draw,
|
||||
GX2SetVertexUniformBlock(sprite_shader.vs.uniformBlocks[1].offset,
|
||||
sprite_shader.vs.uniformBlocks[1].size,
|
||||
wiiu->ubo_tex);
|
||||
GX2SetAttribBuffer(0, wiiu->vertex_cache.size * sizeof(*wiiu->vertex_cache.v),
|
||||
sizeof(*wiiu->vertex_cache.v), wiiu->vertex_cache.v);
|
||||
GX2SetAttribBuffer(0, wiiu->vertex_cache.size
|
||||
* sizeof(*wiiu->vertex_cache.v),
|
||||
sizeof(*wiiu->vertex_cache.v),
|
||||
wiiu->vertex_cache.v);
|
||||
}
|
||||
|
||||
static void gfx_display_wiiu_draw_pipeline(
|
||||
@ -231,16 +237,23 @@ static void gfx_display_wiiu_draw_pipeline(
|
||||
|
||||
draw->coords->vertex = wiiu->menu_shader_vbo;
|
||||
draw->coords->vertices = ca->coords.vertices;
|
||||
GX2SetAttribBuffer(0, draw->coords->vertices * 2 * sizeof(float), 2 * sizeof(float), wiiu->menu_shader_vbo);
|
||||
GX2SetBlendControl(GX2_RENDER_TARGET_0, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_ONE,
|
||||
GX2_BLEND_COMBINE_MODE_ADD, GX2_DISABLE, 0, 0, 0);
|
||||
GX2SetAttribBuffer(0,
|
||||
draw->coords->vertices * 2 * sizeof(float),
|
||||
2 * sizeof(float), wiiu->menu_shader_vbo);
|
||||
GX2SetBlendControl(GX2_RENDER_TARGET_0,
|
||||
GX2_BLEND_MODE_SRC_ALPHA,
|
||||
GX2_BLEND_MODE_ONE,
|
||||
GX2_BLEND_COMBINE_MODE_ADD,
|
||||
GX2_DISABLE, 0, 0, 0);
|
||||
|
||||
break;
|
||||
case VIDEO_SHADER_MENU_3:
|
||||
case VIDEO_SHADER_MENU_4:
|
||||
case VIDEO_SHADER_MENU_5:
|
||||
case VIDEO_SHADER_MENU_6:
|
||||
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->v), sizeof(*wiiu->v), wiiu->v);
|
||||
GX2SetAttribBuffer(0,
|
||||
4 * sizeof(*wiiu->v),
|
||||
sizeof(*wiiu->v), wiiu->v);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@ -248,7 +261,9 @@ static void gfx_display_wiiu_draw_pipeline(
|
||||
|
||||
if (!wiiu->menu_shader_ubo)
|
||||
{
|
||||
wiiu->menu_shader_ubo = MEM2_alloc(sizeof(*wiiu->menu_shader_ubo), GX2_UNIFORM_BLOCK_ALIGNMENT);
|
||||
wiiu->menu_shader_ubo = MEM2_alloc(
|
||||
sizeof(*wiiu->menu_shader_ubo),
|
||||
GX2_UNIFORM_BLOCK_ALIGNMENT);
|
||||
matrix_4x4_ortho(wiiu->menu_shader_ubo->mvp, 0, 1, 1, 0, -1, 1);
|
||||
wiiu->menu_shader_ubo->OutputSize.width = wiiu->color_buffer.surface.width;
|
||||
wiiu->menu_shader_ubo->OutputSize.height = wiiu->color_buffer.surface.height;
|
||||
|
Loading…
x
Reference in New Issue
Block a user