22#ifndef BACKENDS_GRAPHICS_OPENGL_PIPELINES_LIBRETRO_H
23#define BACKENDS_GRAPHICS_OPENGL_PIPELINES_LIBRETRO_H
25#include "graphics/opengl/system_headers.h"
28#include "backends/graphics/opengl/pipelines/shader.h"
30#include "common/array.h"
45class LibRetroTextureTarget;
55 void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
override;
62 void enableLinearFiltering(
bool enabled) { _linearFiltering = enabled; }
63 void setRotation(
Common::RotationMode rotation) {
if (_rotation != rotation) { _rotation = rotation; setPipelineState(); } }
65 void setDisplaySizes(uint inputWidth, uint inputHeight,
const Common::Rect &outputRect);
71 bool isAnimated()
const {
return _isAnimated; }
73 static bool isSupportedByContext() {
74 return OpenGLContext.shadersSupported
75 && OpenGLContext.multitextureSupported
76 && OpenGLContext.framebufferObjectSupported;
79 void activateInternal()
override;
80 void deactivateInternal()
override;
81 void drawTextureInternal(
const Texture &texture,
const GLfloat *coordinates,
const GLfloat *texcoords)
override;
86 void setPipelineState();
88 void setupPassUniforms(
const uint
id);
89 void setShaderTexUniforms(
const Common::String &prefix, Shader *shader,
const Texture &texture);
94 ShaderPipeline _inputPipeline;
95 ShaderPipeline _outputPipeline;
98 const LibRetro::ShaderPreset *_shaderPreset;
104 bool _linearFiltering;
114 struct LibRetroTexture {
115 LibRetroTexture() : textureData(nullptr), glTexture(nullptr) {}
116 LibRetroTexture(
Graphics::Surface *tD, Texture *glTex) : textureData(tD), glTexture(glTex) {}
125 TextureArray _textures;
129 : shaderPass(nullptr), shader(nullptr), target(nullptr), texCoords(), texSamplers(),
130 inputTexture(nullptr), vertexCoord(), hasFrameCount(false), prevCount(0) {}
131 Pass(
const LibRetro::ShaderPass *sP, Shader *s, TextureTarget *t)
132 : shaderPass(sP), shader(s), target(t), texCoords(), texSamplers(),
133 inputTexture(nullptr), vertexCoord(), hasFrameCount(false), prevCount(0) {}
135 const LibRetro::ShaderPass *shaderPass;
137 TextureTarget *target;
180 TexCoordAttributeArray texCoords;
232 TextureSamplerArray texSamplers;
240 void buildTexSamplers(
const uint
id,
const TextureArray &textures,
const Common::StringArray &aliases);
252 GLfloat vertexCoord[2*4];
269 void renderPass(
const Pass &pass);
270 void renderPassSetupCoordinates(
const Pass &pass);
271 void renderPassSetupTextures(
const Pass &pass);
Definition: archive.h:141
Definition: archive.h:330
Definition: libretro.h:50
void setProjectionMatrix(const Math::Matrix4 &projectionMatrix) override
void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) override
Definition: pipeline.h:40
RotationMode
Definition: rotationmode.h:44
Definition: formatinfo.h:28
Definition: libretro.h:142
uint index
Definition: libretro.h:173
Common::String name
Definition: libretro.h:146
Type
Definition: libretro.h:148
@ kTypeTexture
Definition: libretro.h:152
@ kTypePrev
Definition: libretro.h:162
@ kTypePass
Definition: libretro.h:157
Type type
Definition: libretro.h:168
Definition: libretro.h:194
uint unit
Definition: libretro.h:198
Type
Definition: libretro.h:200
@ kTypePass
Definition: libretro.h:209
@ kTypeTexture
Definition: libretro.h:204
@ kTypePrev
Definition: libretro.h:214
Type type
Definition: libretro.h:220
uint index
Definition: libretro.h:225