Lay base for OpenGL ES support
This commit is contained in:
parent
3fad5dcbbb
commit
ea00d69866
|
@ -126,7 +126,7 @@ if (ENABLE_OGLRENDERER)
|
|||
elseif (APPLE)
|
||||
target_link_libraries(core ${EPOXY_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(core rt ${EPOXY_LIBRARIES})
|
||||
target_link_libraries(core rt GLESv2)
|
||||
endif()
|
||||
else()
|
||||
if (WIN32)
|
||||
|
|
|
@ -62,8 +62,8 @@ bool GLRenderer::BuildRenderShader(u32 flags, const char* vs, const char* fs)
|
|||
glBindAttribLocation(prog, 1, "vColor");
|
||||
glBindAttribLocation(prog, 2, "vTexcoord");
|
||||
glBindAttribLocation(prog, 3, "vPolygonAttr");
|
||||
glBindFragDataLocation(prog, 0, "oColor");
|
||||
glBindFragDataLocation(prog, 1, "oAttr");
|
||||
//glBindFragDataLocation(prog, 0, "oColor");
|
||||
//glBindFragDataLocation(prog, 1, "oAttr");
|
||||
|
||||
if (!OpenGL::LinkShaderProgram(RenderShader[flags]))
|
||||
return false;
|
||||
|
@ -109,16 +109,16 @@ bool GLRenderer::Init()
|
|||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
|
||||
glDepthRange(0, 1);
|
||||
glClearDepth(1.0);
|
||||
glDepthRangef(0.0, 1.0);
|
||||
glClearDepthf(1.0);
|
||||
|
||||
|
||||
if (!OpenGL::BuildShaderProgram(kClearVS, kClearFS, ClearShaderPlain, "ClearShader"))
|
||||
return false;
|
||||
|
||||
glBindAttribLocation(ClearShaderPlain[2], 0, "vPosition");
|
||||
glBindFragDataLocation(ClearShaderPlain[2], 0, "oColor");
|
||||
glBindFragDataLocation(ClearShaderPlain[2], 1, "oAttr");
|
||||
//glBindFragDataLocation(ClearShaderPlain[2], 0, "oColor");
|
||||
//glBindFragDataLocation(ClearShaderPlain[2], 1, "oAttr");
|
||||
|
||||
if (!OpenGL::LinkShaderProgram(ClearShaderPlain))
|
||||
return false;
|
||||
|
@ -154,7 +154,7 @@ bool GLRenderer::Init()
|
|||
return false;
|
||||
|
||||
glBindAttribLocation(FinalPassEdgeShader[2], 0, "vPosition");
|
||||
glBindFragDataLocation(FinalPassEdgeShader[2], 0, "oColor");
|
||||
//glBindFragDataLocation(FinalPassEdgeShader[2], 0, "oColor");
|
||||
|
||||
if (!OpenGL::LinkShaderProgram(FinalPassEdgeShader))
|
||||
return false;
|
||||
|
@ -170,7 +170,7 @@ bool GLRenderer::Init()
|
|||
glUniform1i(uni_id, 1);
|
||||
|
||||
glBindAttribLocation(FinalPassFogShader[2], 0, "vPosition");
|
||||
glBindFragDataLocation(FinalPassFogShader[2], 0, "oColor");
|
||||
//glBindFragDataLocation(FinalPassFogShader[2], 0, "oColor");
|
||||
|
||||
if (!OpenGL::LinkShaderProgram(FinalPassFogShader))
|
||||
return false;
|
||||
|
@ -281,7 +281,7 @@ bool GLRenderer::Init()
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5_A1, 1024, 48, 0, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5_A1, 1024, 48, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, NULL);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
|
@ -1170,7 +1170,7 @@ void GLRenderer::RenderFrame()
|
|||
ShaderConfig.uFogShift = RenderFogShift;
|
||||
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, ShaderConfigUBO);
|
||||
void* unibuf = glMapBuffer(GL_UNIFORM_BUFFER, GL_WRITE_ONLY);
|
||||
void* unibuf = glMapBufferRange(GL_UNIFORM_BUFFER, 0, GL_BUFFER_SIZE, GL_WRITE_ONLY);
|
||||
if (unibuf) memcpy(unibuf, &ShaderConfig, sizeof(ShaderConfig));
|
||||
glUnmapBuffer(GL_UNIFORM_BUFFER);
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ void GLRenderer::RenderFrame()
|
|||
else if (mask & (1<<5)) vram = GPU::VRAM_F;
|
||||
else if (mask & (1<<6)) vram = GPU::VRAM_G;
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i*8, 1024, 8, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, vram);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i*8, 1024, 8, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, vram);
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
@ -1295,11 +1295,12 @@ void GLRenderer::PrepareCaptureFrame()
|
|||
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferID[original_fb]);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, FramebufferID[3]);
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
GLenum drawBuffer[] = {GL_COLOR_ATTACHMENT0};
|
||||
glDrawBuffers(1, drawBuffer);
|
||||
glBlitFramebuffer(0, 0, ScreenW, ScreenH, 0, 0, 256, 192, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferID[3]);
|
||||
glReadPixels(0, 0, 256, 192, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
||||
glReadPixels(0, 0, 256, 192, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
|
||||
u32* GLRenderer::GetLine(int line)
|
||||
|
@ -1308,7 +1309,7 @@ u32* GLRenderer::GetLine(int line)
|
|||
|
||||
if (line == 0)
|
||||
{
|
||||
u8* data = (u8*)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
u8* data = (u8*)glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, GL_BUFFER_SIZE, GL_READ_ONLY);
|
||||
if (data) memcpy(&Framebuffer[stride*0], data, 4*stride*192);
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef GPU3D_OPENGL_SHADERS_H
|
||||
#define GPU3D_OPENGL_SHADERS_H
|
||||
|
||||
#define kShaderHeader "#version 140"
|
||||
#define kShaderHeader "#version 300 es\nprecision mediump float;"
|
||||
|
||||
|
||||
const char* kClearVS = kShaderHeader R"(
|
||||
|
@ -41,16 +41,16 @@ uniform uvec4 uColor;
|
|||
uniform uint uOpaquePolyID;
|
||||
uniform uint uFogFlag;
|
||||
|
||||
out vec4 oColor;
|
||||
out vec4 oAttr;
|
||||
layout (location = 0) out vec4 oColor;
|
||||
layout (location = 1) out vec4 oAttr;
|
||||
|
||||
void main()
|
||||
{
|
||||
oColor = vec4(uColor).bgra / 31.0;
|
||||
oAttr.r = float(uOpaquePolyID) / 63.0;
|
||||
oAttr.g = 0;
|
||||
oAttr.g = 0.0;
|
||||
oAttr.b = float(uFogFlag);
|
||||
oAttr.a = 1;
|
||||
oAttr.a = 1.0;
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -84,7 +84,7 @@ layout(std140) uniform uConfig
|
|||
int uFogShift;
|
||||
};
|
||||
|
||||
out vec4 oColor;
|
||||
layout (location = 0) out vec4 oColor;
|
||||
|
||||
// make up for crapo zbuffer precision
|
||||
bool isless(float a, float b)
|
||||
|
@ -117,7 +117,7 @@ void main()
|
|||
|
||||
int polyid = int(attr.r * 63.0);
|
||||
|
||||
if (attr.g != 0)
|
||||
if (attr.g != 0.0)
|
||||
{
|
||||
vec4 depthU = texelFetch(DepthBuffer, coord + ivec2(0,-scale), 0);
|
||||
vec4 attrU = texelFetch(AttrBuffer, coord + ivec2(0,-scale), 0);
|
||||
|
@ -141,7 +141,7 @@ void main()
|
|||
if ((uDispCnt & (1<<4)) != 0)
|
||||
ret.a = 0.5;
|
||||
else
|
||||
ret.a = 1;
|
||||
ret.a = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ layout(std140) uniform uConfig
|
|||
int uFogShift;
|
||||
};
|
||||
|
||||
out vec4 oColor;
|
||||
layout (location = 0) out vec4 oColor;
|
||||
|
||||
vec4 CalculateFog(float depth)
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ void main()
|
|||
vec4 depth = texelFetch(DepthBuffer, coord, 0);
|
||||
vec4 attr = texelFetch(AttrBuffer, coord, 0);
|
||||
|
||||
if (attr.b != 0) ret = CalculateFog(depth.r);
|
||||
if (attr.b != 0.0) ret = CalculateFog(depth.r);
|
||||
|
||||
oColor = ret;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ flat out ivec3 fPolygonAttr;
|
|||
|
||||
const char* kRenderFSCommon = R"(
|
||||
|
||||
uniform usampler2D TexMem;
|
||||
uniform mediump usampler2D TexMem;
|
||||
uniform sampler2D TexPalMem;
|
||||
|
||||
layout(std140) uniform uConfig
|
||||
|
@ -260,8 +260,8 @@ smooth in vec4 fColor;
|
|||
smooth in vec2 fTexcoord;
|
||||
flat in ivec3 fPolygonAttr;
|
||||
|
||||
out vec4 oColor;
|
||||
out vec4 oAttr;
|
||||
layout (location = 0) out vec4 oColor;
|
||||
layout (location = 2) out vec4 oAttr;
|
||||
|
||||
int TexcoordWrap(int c, int maxc, int mode)
|
||||
{
|
||||
|
@ -307,7 +307,7 @@ vec4 TextureFetch_I2(ivec2 addr, ivec4 st, int wrapmode, float alpha0)
|
|||
addr.y = (addr.y << 2) + pixel.r;
|
||||
vec4 color = texelFetch(TexPalMem, ivec2(addr.y&0x3FF, addr.y>>10), 0);
|
||||
|
||||
return vec4(color.rgb, (pixel.r>0)?1:alpha0);
|
||||
return vec4(color.rgb, (pixel.r>0)?1.0:alpha0);
|
||||
}
|
||||
|
||||
vec4 TextureFetch_I4(ivec2 addr, ivec4 st, int wrapmode, float alpha0)
|
||||
|
@ -323,7 +323,7 @@ vec4 TextureFetch_I4(ivec2 addr, ivec4 st, int wrapmode, float alpha0)
|
|||
addr.y = (addr.y << 3) + pixel.r;
|
||||
vec4 color = texelFetch(TexPalMem, ivec2(addr.y&0x3FF, addr.y>>10), 0);
|
||||
|
||||
return vec4(color.rgb, (pixel.r>0)?1:alpha0);
|
||||
return vec4(color.rgb, (pixel.r>0)?1.0:alpha0);
|
||||
}
|
||||
|
||||
vec4 TextureFetch_I8(ivec2 addr, ivec4 st, int wrapmode, float alpha0)
|
||||
|
@ -337,7 +337,7 @@ vec4 TextureFetch_I8(ivec2 addr, ivec4 st, int wrapmode, float alpha0)
|
|||
addr.y = (addr.y << 3) + pixel.r;
|
||||
vec4 color = texelFetch(TexPalMem, ivec2(addr.y&0x3FF, addr.y>>10), 0);
|
||||
|
||||
return vec4(color.rgb, (pixel.r>0)?1:alpha0);
|
||||
return vec4(color.rgb, (pixel.r>0)?1.0:alpha0);
|
||||
}
|
||||
|
||||
vec4 TextureFetch_Compressed(ivec2 addr, ivec4 st, int wrapmode)
|
||||
|
@ -601,7 +601,7 @@ vec4 FinalColor()
|
|||
if ((uDispCnt & (1<<1)) == 0)
|
||||
{
|
||||
// toon
|
||||
vec3 tooncolor = uToonColors[int(vcol.r * 31)].rgb;
|
||||
vec3 tooncolor = uToonColors[int(vcol.r * 31.0)].rgb;
|
||||
vcol.rgb = tooncolor;
|
||||
}
|
||||
else
|
||||
|
@ -638,7 +638,7 @@ vec4 FinalColor()
|
|||
{
|
||||
if ((uDispCnt & (1<<1)) != 0)
|
||||
{
|
||||
vec3 tooncolor = uToonColors[int(vcol.r * 31)].rgb;
|
||||
vec3 tooncolor = uToonColors[int(vcol.r * 31.0)].rgb;
|
||||
col.rgb = min(col.rgb + tooncolor, 1.0);
|
||||
}
|
||||
}
|
||||
|
@ -698,13 +698,13 @@ const char* kRenderFS_ZO = R"(
|
|||
void main()
|
||||
{
|
||||
vec4 col = FinalColor();
|
||||
if (col.a < 30.5/31) discard;
|
||||
if (col.a < 30.5/31.0) discard;
|
||||
|
||||
oColor = col;
|
||||
oAttr.r = float((fPolygonAttr.x >> 24) & 0x3F) / 63.0;
|
||||
oAttr.g = 0;
|
||||
oAttr.g = 0.0;
|
||||
oAttr.b = float((fPolygonAttr.x >> 15) & 0x1);
|
||||
oAttr.a = 1;
|
||||
oAttr.a = 1.0;
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -715,13 +715,13 @@ smooth in float fZ;
|
|||
void main()
|
||||
{
|
||||
vec4 col = FinalColor();
|
||||
if (col.a < 30.5/31) discard;
|
||||
if (col.a < 30.5/31.0) discard;
|
||||
|
||||
oColor = col;
|
||||
oAttr.r = float((fPolygonAttr.x >> 24) & 0x3F) / 63.0;
|
||||
oAttr.g = 0;
|
||||
oAttr.g = 0.0;
|
||||
oAttr.b = float((fPolygonAttr.x >> 15) & 0x1);
|
||||
oAttr.a = 1;
|
||||
oAttr.a = 1.0;
|
||||
gl_FragDepth = fZ;
|
||||
}
|
||||
)";
|
||||
|
@ -731,10 +731,10 @@ const char* kRenderFS_ZE = R"(
|
|||
void main()
|
||||
{
|
||||
vec4 col = FinalColor();
|
||||
if (col.a < 30.5/31) discard;
|
||||
if (col.a < 30.5/31.0) discard;
|
||||
|
||||
oAttr.g = 1;
|
||||
oAttr.a = 1;
|
||||
oAttr.g = 1.0;
|
||||
oAttr.a = 1.0;
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -745,10 +745,10 @@ smooth in float fZ;
|
|||
void main()
|
||||
{
|
||||
vec4 col = FinalColor();
|
||||
if (col.a < 30.5/31) discard;
|
||||
if (col.a < 30.5/31.0) discard;
|
||||
|
||||
oAttr.g = 1;
|
||||
oAttr.a = 1;
|
||||
oAttr.g = 1.0;
|
||||
oAttr.a = 1.0;
|
||||
gl_FragDepth = fZ;
|
||||
}
|
||||
)";
|
||||
|
@ -758,12 +758,12 @@ const char* kRenderFS_ZT = R"(
|
|||
void main()
|
||||
{
|
||||
vec4 col = FinalColor();
|
||||
if (col.a < 0.5/31) discard;
|
||||
if (col.a >= 30.5/31) discard;
|
||||
if (col.a < 0.5/31.0) discard;
|
||||
if (col.a >= 30.5/31.0) discard;
|
||||
|
||||
oColor = col;
|
||||
oAttr.b = 0;
|
||||
oAttr.a = 1;
|
||||
oAttr.b = 0.0;
|
||||
oAttr.a = 1.0;
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -774,12 +774,12 @@ smooth in float fZ;
|
|||
void main()
|
||||
{
|
||||
vec4 col = FinalColor();
|
||||
if (col.a < 0.5/31) discard;
|
||||
if (col.a >= 30.5/31) discard;
|
||||
if (col.a < 0.5/31.0) discard;
|
||||
if (col.a >= 30.5/31.0) discard;
|
||||
|
||||
oColor = col;
|
||||
oAttr.b = 0;
|
||||
oAttr.a = 1;
|
||||
oAttr.b = 0.0;
|
||||
oAttr.a = 1.0;
|
||||
gl_FragDepth = fZ;
|
||||
}
|
||||
)";
|
||||
|
|
|
@ -45,7 +45,7 @@ bool GLCompositor::Init()
|
|||
|
||||
glBindAttribLocation(CompShader[i][2], 0, "vPosition");
|
||||
glBindAttribLocation(CompShader[i][2], 1, "vTexcoord");
|
||||
glBindFragDataLocation(CompShader[i][2], 0, "oColor");
|
||||
//glBindFragDataLocation(CompShader[i][2], 0, "oColor");
|
||||
|
||||
if (!OpenGL::LinkShaderProgram(CompShader[i]))
|
||||
return false;
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#ifndef GPU_OPENGL_SHADERS_H
|
||||
#define GPU_OPENGL_SHADERS_H
|
||||
|
||||
const char* kCompositorVS = R"(#version 140
|
||||
#define kShaderHeader "#version 300 es\nprecision mediump float;"
|
||||
|
||||
const char* kCompositorVS = kShaderHeader R"(
|
||||
|
||||
in vec2 vPosition;
|
||||
in vec2 vTexcoord;
|
||||
|
@ -38,17 +40,17 @@ void main()
|
|||
}
|
||||
)";
|
||||
|
||||
const char* kCompositorFS_Nearest = R"(#version 140
|
||||
const char* kCompositorFS_Nearest = kShaderHeader R"(
|
||||
|
||||
uniform uint u3DScale;
|
||||
uniform int u3DXPos;
|
||||
|
||||
uniform usampler2D ScreenTex;
|
||||
uniform mediump usampler2D ScreenTex;
|
||||
uniform sampler2D _3DTex;
|
||||
|
||||
smooth in vec2 fTexcoord;
|
||||
|
||||
out vec4 oColor;
|
||||
layout (location = 0) out vec4 oColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -73,8 +75,8 @@ void main()
|
|||
// 3D on top, blending
|
||||
|
||||
float xpos = fTexcoord.x + _3dxpos;
|
||||
float ypos = mod(fTexcoord.y, 192);
|
||||
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(vec2(xpos, ypos)*u3DScale), 0).bgra
|
||||
float ypos = mod(fTexcoord.y, 192.0);
|
||||
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(int(xpos)*int(u3DScale), int(ypos)*int(u3DScale)), 0).bgra
|
||||
* vec4(63,63,63,31));
|
||||
|
||||
if (_3dpix.a > 0)
|
||||
|
@ -94,8 +96,8 @@ void main()
|
|||
// 3D on bottom, blending
|
||||
|
||||
float xpos = fTexcoord.x + _3dxpos;
|
||||
float ypos = mod(fTexcoord.y, 192);
|
||||
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(vec2(xpos, ypos)*u3DScale), 0).bgra
|
||||
float ypos = mod(fTexcoord.y, 192.0);
|
||||
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(int(xpos)*int(u3DScale), int(ypos)*int(u3DScale)), 0).bgra
|
||||
* vec4(63,63,63,31));
|
||||
|
||||
if (_3dpix.a > 0)
|
||||
|
@ -114,8 +116,8 @@ void main()
|
|||
// 3D on top, normal/fade
|
||||
|
||||
float xpos = fTexcoord.x + _3dxpos;
|
||||
float ypos = mod(fTexcoord.y, 192);
|
||||
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(vec2(xpos, ypos)*u3DScale), 0).bgra
|
||||
float ypos = mod(fTexcoord.y, 192.0);
|
||||
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(int(xpos)*int(u3DScale), int(ypos)*int(u3DScale)), 0).bgra
|
||||
* vec4(63,63,63,31));
|
||||
|
||||
if (_3dpix.a > 0)
|
||||
|
@ -165,7 +167,7 @@ void main()
|
|||
|
||||
|
||||
|
||||
const char* kCompositorFS_Linear = R"(#version 140
|
||||
const char* kCompositorFS_Linear = kShaderHeader R"(
|
||||
|
||||
uniform uint u3DScale;
|
||||
|
||||
|
@ -325,7 +327,7 @@ void main()
|
|||
|
||||
// HUGE TEST ZONE ARRLGD
|
||||
|
||||
const char* kCompositorVS_xBRZ = R"(#version 140
|
||||
const char* kCompositorVS_xBRZ = kShaderHeader R"(
|
||||
|
||||
#define BLEND_NONE 0
|
||||
#define BLEND_NORMAL 1
|
||||
|
@ -406,7 +408,7 @@ void main()
|
|||
}
|
||||
)";
|
||||
|
||||
const char* kCompositorFS_xBRZ = R"(#version 140
|
||||
const char* kCompositorFS_xBRZ = kShaderHeader R"(
|
||||
|
||||
#define BLEND_NONE 0
|
||||
#define BLEND_NORMAL 1
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include <GLES3/gl32.h>
|
||||
|
||||
|
||||
#include "Platform.h"
|
||||
|
|
|
@ -66,7 +66,7 @@ GLuint OSDVertexBuffer;
|
|||
volatile bool Rendering;
|
||||
|
||||
|
||||
bool Init(QOpenGLFunctions_3_2_Core* f)
|
||||
bool Init(QOpenGLExtraFunctions* f)
|
||||
{
|
||||
if (f)
|
||||
{
|
||||
|
@ -76,7 +76,6 @@ bool Init(QOpenGLFunctions_3_2_Core* f)
|
|||
|
||||
GLuint pid = Shader->programId();
|
||||
f->glBindAttribLocation(pid, 0, "vPosition");
|
||||
f->glBindFragDataLocation(pid, 0, "oColor");
|
||||
|
||||
Shader->link();
|
||||
|
||||
|
@ -112,7 +111,7 @@ bool Init(QOpenGLFunctions_3_2_Core* f)
|
|||
return true;
|
||||
}
|
||||
|
||||
void DeInit(QOpenGLFunctions_3_2_Core* f)
|
||||
void DeInit(QOpenGLExtraFunctions* f)
|
||||
{
|
||||
for (auto it = ItemQueue.begin(); it != ItemQueue.end(); )
|
||||
{
|
||||
|
@ -344,7 +343,7 @@ void AddMessage(u32 color, const char* text)
|
|||
ItemQueue.push_back(item);
|
||||
}
|
||||
|
||||
void Update(QOpenGLFunctions_3_2_Core* f)
|
||||
void Update(QOpenGLExtraFunctions* f)
|
||||
{
|
||||
if (!Config::ShowOSD)
|
||||
{
|
||||
|
@ -420,7 +419,7 @@ void DrawNative(QPainter& painter)
|
|||
Rendering = false;
|
||||
}
|
||||
|
||||
void DrawGL(QOpenGLFunctions_3_2_Core* f, float w, float h)
|
||||
void DrawGL(QOpenGLExtraFunctions* f, float w, float h)
|
||||
{
|
||||
if (!Config::ShowOSD) return;
|
||||
if (!mainWindow || !mainWindow->panel) return;
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
namespace OSD
|
||||
{
|
||||
|
||||
bool Init(QOpenGLFunctions_3_2_Core* f);
|
||||
void DeInit(QOpenGLFunctions_3_2_Core* f);
|
||||
bool Init(QOpenGLExtraFunctions* f);
|
||||
void DeInit(QOpenGLExtraFunctions* f);
|
||||
|
||||
void AddMessage(u32 color, const char* text);
|
||||
|
||||
void Update(QOpenGLFunctions_3_2_Core* f);
|
||||
void Update(QOpenGLExtraFunctions* f);
|
||||
void DrawNative(QPainter& painter);
|
||||
void DrawGL(QOpenGLFunctions_3_2_Core* f, float w, float h);
|
||||
void DrawGL(QOpenGLExtraFunctions* f, float w, float h);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#ifndef OSD_SHADERS_H
|
||||
#define OSD_SHADERS_H
|
||||
|
||||
const char* kScreenVS_OSD = R"(#version 140
|
||||
#define kShaderHeader "#version 300 es\nprecision mediump float;"
|
||||
|
||||
const char* kScreenVS_OSD = kShaderHeader R"(
|
||||
|
||||
uniform vec2 uScreenSize;
|
||||
|
||||
|
@ -37,10 +39,10 @@ void main()
|
|||
|
||||
vec2 osdpos = (vPosition * vec2(uOSDSize * uScaleFactor));
|
||||
fTexcoord = osdpos;
|
||||
osdpos += uOSDPos;
|
||||
osdpos += vec2(uOSDPos);
|
||||
|
||||
fpos.xy = ((osdpos * 2.0) / uScreenSize * uScaleFactor) - 1.0;
|
||||
fpos.y *= -1;
|
||||
fpos.y *= -1.0;
|
||||
fpos.z = 0.0;
|
||||
fpos.w = 1.0;
|
||||
|
||||
|
@ -48,13 +50,13 @@ void main()
|
|||
}
|
||||
)";
|
||||
|
||||
const char* kScreenFS_OSD = R"(#version 140
|
||||
const char* kScreenFS_OSD = kShaderHeader R"(
|
||||
|
||||
uniform sampler2D OSDTex;
|
||||
|
||||
smooth in vec2 fTexcoord;
|
||||
|
||||
out vec4 oColor;
|
||||
layout (location = 0) out vec4 oColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1064,7 +1064,6 @@ void ScreenPanelGL::initializeGL()
|
|||
GLuint pid = screenShader->programId();
|
||||
glBindAttribLocation(pid, 0, "vPosition");
|
||||
glBindAttribLocation(pid, 1, "vTexcoord");
|
||||
glBindFragDataLocation(pid, 0, "oColor");
|
||||
|
||||
screenShader->link();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLContext>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLFunctions_3_2_Core>
|
||||
#include <QOpenGLExtraFunctions>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
#include "FrontendUtil.h"
|
||||
|
@ -156,7 +156,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
class ScreenPanelGL : public QOpenGLWidget, public ScreenHandler, protected QOpenGLFunctions_3_2_Core
|
||||
class ScreenPanelGL : public QOpenGLWidget, public ScreenHandler, protected QOpenGLExtraFunctions
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#ifndef MAIN_SHADERS_H
|
||||
#define MAIN_SHADERS_H
|
||||
|
||||
const char* kScreenVS = R"(#version 140
|
||||
#define kShaderHeader "#version 300 es\nprecision mediump float;"
|
||||
|
||||
const char* kScreenVS = kShaderHeader R"(
|
||||
|
||||
uniform vec2 uScreenSize;
|
||||
uniform mat2x3 uTransform;
|
||||
|
@ -37,7 +39,7 @@ void main()
|
|||
fpos.xy = vec3(vPosition, 1.0) * uTransform * uScaleFactor;
|
||||
|
||||
fpos.xy = ((fpos.xy * 2.0) / (uScreenSize * uScaleFactor)) - 1.0;
|
||||
fpos.y *= -1;
|
||||
fpos.y *= -1.0;
|
||||
fpos.z = 0.0;
|
||||
fpos.w = 1.0;
|
||||
|
||||
|
@ -46,13 +48,13 @@ void main()
|
|||
}
|
||||
)";
|
||||
|
||||
const char* kScreenFS = R"(#version 140
|
||||
const char* kScreenFS = kShaderHeader R"(
|
||||
|
||||
uniform sampler2D ScreenTex;
|
||||
|
||||
smooth in vec2 fTexcoord;
|
||||
|
||||
out vec4 oColor;
|
||||
layout (location = 0) out vec4 oColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue