Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RetroPlayer: Update OpenGL/ES Renderers and use RGB565 #13497

Merged
merged 6 commits into from Feb 9, 2018

Conversation

lrusak
Copy link
Contributor

@lrusak lrusak commented Feb 7, 2018

AFAIK libretro gives us frames in RGB565 format. I have only tested this with snes9x2010 so far.

I have build and runtime tested OpenGL and OpenGLES on X11 and GBM respectively.

I'm not sure if this will break the RPi or windows rendering methods but jenkins will tell us.

In the future I want to make it possible to use the 3 different pixel formats that libretro uses, aka:

enum retro_pixel_format
{
   /* 0RGB1555, native endian.
    * 0 bit must be set to 0.
    * This pixel format is default for compatibility concerns only.
    * If a 15/16-bit pixel format is desired, consider using RGB565. */
   RETRO_PIXEL_FORMAT_0RGB1555 = 0,

   /* XRGB8888, native endian.
    * X bits are ignored. */
   RETRO_PIXEL_FORMAT_XRGB8888 = 1,

   /* RGB565, native endian.
    * This pixel format is the recommended format to use if a 15/16-bit
    * format is desired as it is the pixel format that is typically 
    * available on a wide range of low-power devices.
    *
    * It is also natively supported in APIs like OpenGL ES. */
   RETRO_PIXEL_FORMAT_RGB565   = 2,

   /* Ensure sizeof() == sizeof(int). */
   RETRO_PIXEL_FORMAT_UNKNOWN  = INT_MAX
};

@lrusak lrusak added this to the L 18.0-alpha1 milestone Feb 7, 2018
@lrusak lrusak requested a review from garbear February 7, 2018 19:44
@lrusak
Copy link
Contributor Author

lrusak commented Feb 7, 2018

All green! @garbear for final review

@@ -33,6 +41,22 @@ class CRenderSystemBase;
class CWinSystemBase;
class TransformMatrix;

enum GL_SHADER_METHOD

This comment was marked as spam.

{
#if defined(HAS_GL)
CRenderSystemGL *rendering = dynamic_cast<CRenderSystemGL*>(m_rendering);
if (rendering != nullptr)
rendering->EnableShader(SM_TEXTURE);
rendering->EnableShader(ESHADERMETHOD(method));

This comment was marked as spam.

#include "rendering/gles/RenderSystemGLES.h"
#elif defined(TARGET_WINDOWS)
#include "rendering/dx/RenderSystemDX.h"
#endif

This comment was marked as spam.

#include <cstring>

using namespace KODI;
using namespace RETRO;

#define BUFFER_OFFSET(i) (static_cast<char*>(NULL) + (i))

This comment was marked as spam.


glBindTexture(m_textureTarget, 0);
int stride = GetFrameSize() / m_height;

This comment was marked as spam.


glBindTexture(m_textureTarget, 0);
int stride = GetFrameSize() / m_height;
uint8_t* src = m_data.data();

This comment was marked as spam.


glBindTexture(m_textureTarget, renderBuffer->TextureID());

GLint filter = (GetRenderSettings().VideoSettings().GetScalingMethod() == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR);

This comment was marked as spam.

CRenderBufferOpenGLES *renderBuffer = static_cast<CRenderBufferOpenGLES*>(m_renderBuffer);
struct Svertex
{
float x,y,z;

This comment was marked as spam.

@lrusak
Copy link
Contributor Author

lrusak commented Feb 7, 2018

I believe I corrected all the issues

@@ -21,13 +21,10 @@
#include "RPRendererOpenGLES.h"
#include "cores/RetroPlayer/rendering/RenderContext.h"
#include "cores/RetroPlayer/rendering/RenderVideoSettings.h"
#include "guilib/GraphicContext.h"

This comment was marked as spam.

This comment was marked as spam.

TEXTURE_RGBA_BLENDCOLOR,
TEXTURE_RGBA_BOB,
TEXTURE_RGBA_BOB_OES,
MAX

This comment was marked as spam.

@@ -120,119 +59,3 @@ CRPRendererOpenGL::CRPRendererOpenGL(const CRenderSettings &renderSettings, CRen
// Initialize CRPRendererOpenGLES
m_clearColour = m_context.UseLimitedColor() ? (16.0f / 0xff) : 0.0f;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

if (m_pixelformat == GL_RGBA)
{
// XOR Swap RGBA -> BGRA
unsigned char* pixels = (unsigned char*)m_data.data();

This comment was marked as spam.

This comment was marked as spam.

@lrusak
Copy link
Contributor Author

lrusak commented Feb 8, 2018

Dropped the last commit and the GL(ES) Renderer enabling commits. Rebased and pushed.

@garbear for final review

@garbear
Copy link
Member

garbear commented Feb 9, 2018

Good to go

@lrusak lrusak merged commit c713854 into xbmc:master Feb 9, 2018
{
switch (method)
{
case GL_SHADER_METHOD::DEFAULT: return SM_DEFAULT;

This comment was marked as spam.

This comment was marked as spam.

@lrusak lrusak deleted the opengl-rgb565 branch February 11, 2022 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants