Fix shaders and add mempool reset

This commit is contained in:
Andy Nguyen
2020-10-18 00:13:27 +02:00
committed by Rinnegatamante
parent 591525f4c8
commit 5bd5b98c33
11 changed files with 29 additions and 24 deletions
+1
View File
@@ -17,6 +17,7 @@
#include "gl/rwgl3.h"
#include "gl/rwwdgl.h"
#define PLUGIN_ID 0
// on windows
+8 -4
View File
@@ -1138,6 +1138,11 @@ showRaster(Raster *raster, uint32 flags)
else
vglWaitVblankStart(GL_FALSE);
vglStopRendering();
vglStartRendering();
gVertexBuffer = gVertexBufferPtr;
gVertexBufferIm2D = gVertexBufferPtr + 0xC00000;
gIndices = gIndicesPtr;
gIndicesIm2D = gIndicesPtr + 0x300000;
#endif
}
@@ -1298,6 +1303,8 @@ openGLFW(EngineOpenParams *openparams)
glGlobals.winTitle = openparams->windowtitle;
vglInitExtended(0x1400000, 960, 544, 0x100000, SCE_GXM_MULTISAMPLE_4X);
vglUseVram(GL_TRUE);
vglStartRendering();
makeVideoModeList();
@@ -1488,9 +1495,6 @@ deviceSystemGLFW(DeviceReq req, void *arg, int32 n)
return 0;
case DEVICESETVIDEOMODE:
if(n >= glGlobals.numModes)
return 0;
glGlobals.currentMode = n;
return 1;
case DEVICEGETVIDEOMODEINFO:
@@ -1498,7 +1502,7 @@ deviceSystemGLFW(DeviceReq req, void *arg, int32 n)
rwmode->width = 960;
rwmode->height = 544;
rwmode->depth = 32;
rwmode->flags = glGlobals.modes[n].flags;
rwmode->flags = VIDEOMODEEXCLUSIVE;
return 1;
default:
+1 -1
View File
@@ -19,7 +19,7 @@ void main(
float4 out gl_Position : POSITION
) {
float4 Vertex = mul(u_world, float4(in_pos, 1.0));
gl_Position = mul(u_proj, mul(u_view, Vertex));
gl_Position = mul(u_proj * u_view, Vertex);
float3 Normal = mul(float3x3(u_world), in_normal);
v_tex0 = in_tex0;
+1 -1
View File
@@ -20,7 +20,7 @@ const char *default_vert_src =
" float4 out gl_Position : POSITION\n"
") {\n"
" float4 Vertex = mul(u_world, float4(in_pos, 1.0));\n"
" gl_Position = mul(u_proj, mul(u_view, Vertex));\n"
" gl_Position = mul(u_proj * u_view, Vertex);\n"
" float3 Normal = mul(float3x3(u_world), in_normal);\n"
" v_tex0 = in_tex0;\n"
+3 -3
View File
@@ -6,10 +6,10 @@ float4 main(
float2 v_tex0 : TEXCOORD0,
float2 v_tex1 : TEXCOORD1,
float v_fog : FOG,
uniform float2 u_alpharef,
uniform float4 u_fogColor,
uniform float2 u_alphaRef,
uniform float4 u_colorClamp,
uniform float2 u_fxparams,
uniform float4 u_fogColor,
uniform sampler2D tex0 : TEXUNIT0,
uniform sampler2D tex1 : TEXUNIT1
) {
@@ -17,7 +17,7 @@ float4 main(
float4 envColor = max(pass1, u_colorClamp);
pass1 *= tex2D(tex0, float2(v_tex0.x, 1.0-v_tex0.y));
vec4 pass2 = envColor*shininess*tex2D(tex1, float2(v_tex1.x, 1.0-v_tex1.y));
float4 pass2 = envColor*shininess*tex2D(tex1, float2(v_tex1.x, 1.0-v_tex1.y));
pass1.rgb = lerp(u_fogColor.rgb, pass1.rgb, v_fog);
pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, v_fog);
+2 -2
View File
@@ -21,11 +21,11 @@ void main(
float4 out gl_Position : POSITION
) {
float4 Vertex = mul(u_world, float4(in_pos, 1.0));
gl_Position = mul(u_proj, mul(u_view, Vertex));
gl_Position = mul(u_proj * u_view, Vertex);
float3 Normal = mul(float3x3(u_world), in_normal);
v_tex0 = in_tex0;
v_tex1 = (u_texMatrix * float4(Normal, 1.0)).xy;
v_tex1 = (mul(u_texMatrix, float4(Normal, 1.0))).xy;
v_color = in_color;
v_color.rgb += u_ambLight.rgb*surfAmbient;
+5 -5
View File
@@ -22,11 +22,11 @@ const char *matfx_env_vert_src =
" float4 out gl_Position : POSITION\n"
") {\n"
" float4 Vertex = mul(u_world, float4(in_pos, 1.0));\n"
" gl_Position = mul(u_proj, mul(u_view, Vertex));\n"
" gl_Position = mul(u_proj * u_view, Vertex);\n"
" float3 Normal = mul(float3x3(u_world), in_normal);\n"
" v_tex0 = in_tex0;\n"
" v_tex1 = (u_texMatrix * float4(Normal, 1.0)).xy;\n"
" v_tex1 = (mul(u_texMatrix, float4(Normal, 1.0))).xy;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
@@ -58,10 +58,10 @@ const char *matfx_env_frag_src =
" float2 v_tex0 : TEXCOORD0,\n"
" float2 v_tex1 : TEXCOORD1,\n"
" float v_fog : FOG,\n"
" uniform float2 u_alpharef,\n"
" uniform float4 u_fogColor,\n"
" uniform float2 u_alphaRef,\n"
" uniform float4 u_colorClamp,\n"
" uniform float2 u_fxparams,\n"
" uniform float4 u_fogColor,\n"
" uniform sampler2D tex0 : TEXUNIT0,\n"
" uniform sampler2D tex1 : TEXUNIT1\n"
") {\n"
@@ -69,7 +69,7 @@ const char *matfx_env_frag_src =
" float4 envColor = max(pass1, u_colorClamp);\n"
" pass1 *= tex2D(tex0, float2(v_tex0.x, 1.0-v_tex0.y));\n"
" vec4 pass2 = envColor*shininess*tex2D(tex1, float2(v_tex1.x, 1.0-v_tex1.y));\n"
" float4 pass2 = envColor*shininess*tex2D(tex1, float2(v_tex1.x, 1.0-v_tex1.y));\n"
" pass1.rgb = lerp(u_fogColor.rgb, pass1.rgb, v_fog);\n"
" pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n"
+1 -1
View File
@@ -2,8 +2,8 @@ float4 main(
float4 v_color : COLOR,
float2 v_tex0 : TEXCOORD0,
float v_fog : FOG,
uniform float2 u_alpharef,
uniform float4 u_fogColor,
uniform float2 u_alphaRef,
uniform sampler2D tex0
) {
float4 color = v_color*tex2D(tex0, float2(v_tex0.x, 1.0-v_tex0.y));
+1 -1
View File
@@ -3,8 +3,8 @@ const char *simple_frag_src =
" float4 v_color : COLOR,\n"
" float2 v_tex0 : TEXCOORD0,\n"
" float v_fog : FOG,\n"
" uniform float2 u_alpharef,\n"
" uniform float4 u_fogColor,\n"
" uniform float2 u_alphaRef,\n"
" uniform sampler2D tex0\n"
") {\n"
" float4 color = v_color*tex2D(tex0, float2(v_tex0.x, 1.0-v_tex0.y));\n"
+3 -3
View File
@@ -25,12 +25,12 @@ void main(
float3 SkinVertex = float3(0.0, 0.0, 0.0);
float3 SkinNormal = float3(0.0, 0.0, 0.0);
for(int i = 0; i < 4; i++){
SkinVertex += (u_boneMatrices[int(in_indices[i])] * float4(in_pos, 1.0)).xyz * in_weights[i];
SkinNormal += (float3x3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];
SkinVertex += (mul(u_boneMatrices[int(in_indices[i])], float4(in_pos, 1.0))).xyz * in_weights[i];
SkinNormal += (mul(float3x3(u_boneMatrices[int(in_indices[i])]), in_normal)) * in_weights[i];
}
float4 Vertex = mul(u_world, float4(SkinVertex, 1.0));
gl_Position = u_proj * mul(u_view, Vertex);
gl_Position = mul(u_proj * u_view, Vertex);
float3 Normal = mul(float3x3(u_world), SkinNormal);
v_tex0 = in_tex0;
+3 -3
View File
@@ -26,12 +26,12 @@ const char *skin_vert_src =
" float3 SkinVertex = float3(0.0, 0.0, 0.0);\n"
" float3 SkinNormal = float3(0.0, 0.0, 0.0);\n"
" for(int i = 0; i < 4; i++){\n"
" SkinVertex += (u_boneMatrices[int(in_indices[i])] * float4(in_pos, 1.0)).xyz * in_weights[i];\n"
" SkinNormal += (float3x3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];\n"
" SkinVertex += (mul(u_boneMatrices[int(in_indices[i])], float4(in_pos, 1.0))).xyz * in_weights[i];\n"
" SkinNormal += (mul(float3x3(u_boneMatrices[int(in_indices[i])]), in_normal)) * in_weights[i];\n"
" }\n"
" float4 Vertex = mul(u_world, float4(SkinVertex, 1.0));\n"
" gl_Position = u_proj * mul(u_view, Vertex);\n"
" gl_Position = mul(u_proj * u_view, Vertex);\n"
" float3 Normal = mul(float3x3(u_world), SkinNormal);\n"
" v_tex0 = in_tex0;\n"