mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
shaders: add lowp or mediump when possible
This allows the gpu to use less bits for the floats when it is not needed at all, thus using less resources.
This commit is contained in:
parent
866a03728e
commit
25e8fbbde8
@ -15,7 +15,7 @@
|
||||
|
||||
#define FOG
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
|
||||
#include "minosoft:tint"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#version 330 core
|
||||
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
|
||||
#include "minosoft:tint"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#version 330 core
|
||||
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform float uFlashProgress;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define DISABLE_MIPMAPS
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
|
||||
#include "minosoft:tint"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define FOG
|
||||
#define DISABLE_ALPHA_DISCARD
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
|
||||
#include "minosoft:tint"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define FOG
|
||||
#define DISABLE_ALPHA_DISCARD
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
|
||||
#include "minosoft:tint"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform sampler2D uTexture;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform sampler2D uTexture;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform sampler2D uTexture;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform sampler2D uTexture;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform sampler2D uTexture;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform sampler2D uTexture;
|
||||
uniform vec4 uTintColor;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform sampler2D uTexture;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
in vec4 finTintColor;
|
||||
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#version 330 core
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#version 330 core
|
||||
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
in vec2 finUV;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define DISABLE_MIPMAPS
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
#include "minosoft:tint"
|
||||
#include "minosoft:texture"
|
||||
|
@ -36,23 +36,23 @@ layout(std140) uniform uSpriteBuffer
|
||||
#if defined SHADER_TYPE_VERTEX
|
||||
uint animationArray1; float animationLayer1;
|
||||
uint animationArray2; float animationLayer2;
|
||||
float animationInterpolation;
|
||||
lowp float animationInterpolation;
|
||||
#ifndef HAS_GEOMETRY_SHADER
|
||||
flat out uint finAnimationArray1; out float finAnimationLayer1;
|
||||
flat out uint finAnimationArray2; out float finAnimationLayer2;
|
||||
out vec2 finAnimationUV;
|
||||
out float finAnimationInterpolation;
|
||||
out mediump vec2 finAnimationUV;
|
||||
out lowp float finAnimationInterpolation;
|
||||
#endif
|
||||
#elif defined SHADER_TYPE_GEOMETRY
|
||||
flat out uint finAnimationArray1; out float finAnimationLayer1;
|
||||
flat out uint finAnimationArray2; out float finAnimationLayer2;
|
||||
out vec2 finAnimationUV;
|
||||
out float finAnimationInterpolation;
|
||||
out mediump vec2 finAnimationUV;
|
||||
out lowp float finAnimationInterpolation;
|
||||
#elif defined SHADER_TYPE_FRAGMENT
|
||||
flat in uint finAnimationArray1; in float finAnimationLayer1;
|
||||
flat in uint finAnimationArray2; in float finAnimationLayer2;
|
||||
in vec2 finAnimationUV;
|
||||
in float finAnimationInterpolation;
|
||||
in mediump vec2 finAnimationUV;
|
||||
in lowp float finAnimationInterpolation;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -12,10 +12,10 @@
|
||||
*/
|
||||
|
||||
|
||||
vec4 getRGBColor(uint color) {
|
||||
lowp vec4 getRGBColor(uint color) {
|
||||
return vec4(((color >> 16u) & 0xFFu) / 255.0f, ((color >> 8u) & 0xFFu) / 255.0f, (color & 0xFFu) / 255.0f, 1.0f);
|
||||
}
|
||||
|
||||
vec4 getRGBAColor(uint color) {
|
||||
lowp vec4 getRGBAColor(uint color) {
|
||||
return vec4(((color >> 24u) & 0xFFu) / 255.0f, ((color >> 16u) & 0xFFu) / 255.0f, ((color >> 8u) & 0xFFu) / 255.0f, (color & 0xFFu) / 255.0f);
|
||||
}
|
||||
|
@ -17,6 +17,6 @@ layout(std140) uniform uLightMapBuffer
|
||||
};
|
||||
|
||||
|
||||
vec4 getLight(uint light) {
|
||||
lowp vec4 getLight(uint light) {
|
||||
return uLightMap[light];
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ uniform sampler2DArray uTextures[10];
|
||||
// ToDo: Those methods are just stupid and workaround an opengl crash with mesa drivers
|
||||
|
||||
|
||||
vec4 getTexture(uint textureId, vec3 uv, uint mipmapLevel) {
|
||||
lowp vec4 getTexture(uint textureId, vec3 uv, uint mipmapLevel) {
|
||||
float lod = float(mipmapLevel);
|
||||
#ifdef UNIFORM_ARRAY_AS_ARRAY
|
||||
return textureLod(uTextures[textureId], uv, lod);
|
||||
@ -43,11 +43,11 @@ vec4 getTexture(uint textureId, vec3 uv, uint mipmapLevel) {
|
||||
#endif
|
||||
}
|
||||
|
||||
vec4 getTexture(uint textureId, vec3 uv, int mipmapLevel) {
|
||||
lowp vec4 getTexture(uint textureId, vec3 uv, int mipmapLevel) {
|
||||
return getTexture(textureId, uv, uint(mipmapLevel));
|
||||
}
|
||||
|
||||
vec4 getTexture(uint textureId, vec3 uv) {
|
||||
lowp vec4 getTexture(uint textureId, vec3 uv) {
|
||||
#ifdef FIXED_MIPMAP_LEVEL
|
||||
return getTexture(textureId, uv, FIXED_MIPMAP_LEVEL);
|
||||
#else
|
||||
|
@ -15,11 +15,11 @@
|
||||
#define INCLUDE_MINOSOFT_TINT
|
||||
|
||||
#ifdef SHADER_TYPE_VERTEX
|
||||
out vec4 finTintColor;
|
||||
out lowp vec4 finTintColor;
|
||||
#endif
|
||||
|
||||
#ifdef SHADER_TYPE_FRAGMENT
|
||||
in vec4 finTintColor;
|
||||
in lowp vec4 finTintColor;
|
||||
|
||||
|
||||
void applyTint() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const vec2 CONST_UV[4] = vec2[](
|
||||
const mediump vec2 CONST_UV[4] = vec2[](
|
||||
vec2(+ 0.0f, + 0.0f),
|
||||
vec2(+ 0.0f, + 1.0f),
|
||||
vec2(+ 1.0f, + 1.0f),
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define UV_UNPACK_BITS 12u
|
||||
#define UV_UNPACK_MASK ((1u << UV_UNPACK_BITS) - 1u)
|
||||
|
||||
vec2 uv_unpack(uint raw) {
|
||||
mediump vec2 uv_unpack(uint raw) {
|
||||
float x = float((raw >> (1u * UV_UNPACK_BITS)) & UV_UNPACK_MASK) * (1.0f / float(UV_UNPACK_MASK));
|
||||
float y = float((raw >> (0u * UV_UNPACK_BITS)) & UV_UNPACK_MASK) * (1.0f / float(UV_UNPACK_MASK));
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#version 330 core
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
#include "minosoft:tint"
|
||||
#include "minosoft:texture"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define FOG
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
#include "minosoft:tint"
|
||||
#include "minosoft:texture"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define FOG
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
|
||||
#include "minosoft:tint"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define DISTANCE_MULTIPLIER 0.03f
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform vec3 uCloudsColor;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#version 330 core
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform vec4 uTintColor;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
precision highp float;
|
||||
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
in vec3 finFragmentPosition;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#version 330 core
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform vec4 uSkyColor;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#version 330 core
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform vec4 uTintColor;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#version 330 core
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform float uIntensity;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#version 330 core
|
||||
|
||||
out vec4 foutColor;
|
||||
out lowp vec4 foutColor;
|
||||
|
||||
uniform vec4 uTintColor;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user