Fix some OpenGL shaders

This commit is contained in:
WaluigiWare64 2021-02-03 18:43:27 +00:00 committed by Rayyan Ansari
parent 23c6823393
commit 0ff4590404
4 changed files with 17 additions and 17 deletions

View File

@ -19,8 +19,7 @@
#ifndef GPU3D_OPENGL_SHADERS_H
#define GPU3D_OPENGL_SHADERS_H
#define kShaderHeader "#version 300 es\nprecision mediump float;"
#include "OpenGLSupport.h"
const char* kClearVS = kShaderHeader R"(
@ -241,7 +240,7 @@ flat out ivec3 fPolygonAttr;
const char* kRenderFSCommon = R"(
uniform mediump usampler2D TexMem;
uniform usampler2D TexMem;
uniform sampler2D TexPalMem;
layout(std140) uniform uConfig

View File

@ -24,7 +24,7 @@
#include "NDS.h"
#include "GPU.h"
#include "Config.h"
#include "OpenGLSupport.h"
#include "GPU_OpenGL_shaders.h"
namespace GPU

View File

@ -19,7 +19,9 @@
#ifndef GPU_OPENGL_SHADERS_H
#define GPU_OPENGL_SHADERS_H
#define kShaderHeader "#version 300 es\nprecision mediump float;"
#include "OpenGLSupport.h"
#define kShaderHeader "#version 300 es\nprecision mediump float;\nprecision lowp usampler2D;"
const char* kCompositorVS = kShaderHeader R"(
@ -45,7 +47,7 @@ const char* kCompositorFS_Nearest = kShaderHeader R"(
uniform uint u3DScale;
uniform int u3DXPos;
uniform mediump usampler2D ScreenTex;
uniform usampler2D ScreenTex;
uniform sampler2D _3DTex;
smooth in vec2 fTexcoord;
@ -76,7 +78,7 @@ void main()
float xpos = fTexcoord.x + _3dxpos;
float ypos = mod(fTexcoord.y, 192.0);
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(int(xpos)*int(u3DScale), int(ypos)*int(u3DScale)), 0).bgra
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(vec2(xpos, ypos)*float(u3DScale)), 0).bgra
* vec4(63,63,63,31));
if (_3dpix.a > 0)
@ -97,7 +99,7 @@ void main()
float xpos = fTexcoord.x + _3dxpos;
float ypos = mod(fTexcoord.y, 192.0);
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(int(xpos)*int(u3DScale), int(ypos)*int(u3DScale)), 0).bgra
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(vec2(xpos, ypos)*float(u3DScale)), 0).bgra
* vec4(63,63,63,31));
if (_3dpix.a > 0)
@ -117,7 +119,7 @@ void main()
float xpos = fTexcoord.x + _3dxpos;
float ypos = mod(fTexcoord.y, 192.0);
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(int(xpos)*int(u3DScale), int(ypos)*int(u3DScale)), 0).bgra
ivec4 _3dpix = ivec4(texelFetch(_3DTex, ivec2(vec2(xpos, ypos)*float(u3DScale)), 0).bgra
* vec4(63,63,63,31));
if (_3dpix.a > 0)
@ -180,8 +182,7 @@ out vec4 oColor;
ivec4 Get3DPixel(vec2 pos)
{
return ivec4(texelFetch(_3DTex, ivec2(pos*u3DScale), 0).bgra
* vec4(63,63,63,31));
return ivec4(texelFetch(_3DTex, ivec2(pos*float(u3DScale)), 0).bgra * vec4(63,63,63,31));
}
ivec4 GetFullPixel(ivec4 val1, ivec4 val2, ivec4 val3, ivec4 _3dpix)
@ -241,7 +242,7 @@ ivec4 GetFullPixel(ivec4 val1, ivec4 val2, ivec4 val3, ivec4 _3dpix)
ivec4 imix(ivec4 a, ivec4 b, float x)
{
return ivec4(vec4(a)*(1-x) + vec4(b)*x);
return ivec4(vec4(a)*(1.0-x) + vec4(b)*x);
}
void main()
@ -260,14 +261,14 @@ void main()
float xfract = fract(fTexcoord.x);
float yfract = fract(fTexcoord.y);
float xpos = val3.r + xfract;
float ypos = mod(fTexcoord.y, 192);
float xpos = float(val3.r) + xfract;
float ypos = mod(fTexcoord.y, 192.0);
ivec4 _3dpix = Get3DPixel(vec2(xpos,ypos));
ivec4 p00 = GetFullPixel(val1, val2, val3, _3dpix);
int xdisp = 1 - int(step(255, fTexcoord.x));
int ydisp = 1 - int(step(191, ypos));
int xdisp = 1 - int(step(255.0, fTexcoord.x));
int ydisp = 1 - int(step(191.0, ypos));
ivec4 p01 = GetFullPixel(ivec4(texelFetch(ScreenTex, ivec2(fTexcoord) + ivec2(xdisp+0 ,0), 0)),
ivec4(texelFetch(ScreenTex, ivec2(fTexcoord) + ivec2(xdisp+256,0), 0)),

View File

@ -24,9 +24,9 @@
#include <epoxy/gl.h>
#include "Platform.h"
#define kShaderHeader "#version 300 es\nprecision mediump float;\nprecision lowp usampler2D;"
namespace OpenGL
{