From a3b10c713ba3e5b815d7da8118f18a27080566cb Mon Sep 17 00:00:00 2001 From: UIS Date: Sat, 28 Nov 2020 15:50:13 +0300 Subject: [PATCH] Moar optimization, moar speed --- cwd/assets/altcraft/shaders/vert/face.vs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cwd/assets/altcraft/shaders/vert/face.vs b/cwd/assets/altcraft/shaders/vert/face.vs index 1ae2464a..672deaa5 100644 --- a/cwd/assets/altcraft/shaders/vert/face.vs +++ b/cwd/assets/altcraft/shaders/vert/face.vs @@ -30,7 +30,7 @@ out VS_OUT { flat vec3 Color; } vs_out; -//Intel SNB: VS vec4 shader: 54 instructions. 0 loops. 194 cycles. 0:0 spills:fills, 1 sends. Compacted 864 to 848 bytes (2%) +//Intel SNB: VS vec4 shader: 53 instructions. 0 loops. 178 cycles. 0:0 spills:fills, 1 sends. Compacted 848 to 832 bytes (2%) void main() { gl_Position = projView * vec4(positions[gl_VertexID], 1.0); @@ -44,14 +44,10 @@ void main() { uvec4(qinfo, qinfo >> uint(5)) & uint(0x1F) ) * 0.0625 /* /16.0 */; -// tex.xy += subUV.xy * tex.zw; -// tex.zw = subUV.zw * tex.zw * uv; -// UvPosition = tex.xy + tex.zw; - - UvPosition = tex.xy + subUV.xy*tex.zw + subUV.zw*tex.zw*uv; + UvPosition = tex.xy + tex.zw*(subUV.xy + uv*(subUV.zw-subUV.xy)); Layer = phlf.z; - vec2 light = vec2((qinfo >> uint(10)) & uint(0xF)) / 15.0; + vec2 light = vec2((qinfo >> uint(10)) & uint(0xF)) * (1 / 15.0); vs_out.Light = clamp(light.x + (light.y * DayTime), MinLightLevel, 1.0); vs_out.Color = vec3(0.275, 0.63, 0.1) * (qinfo.x>>14); }