mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zesterer/better-lod' into 'master'
Reverted bad shader changes See merge request veloren/veloren!4145
This commit is contained in:
commit
8babe65353
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
uniform texture2D t_src_color;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
layout(location = 0) out vec2 uv;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#define HAS_SHADOW_MAPS
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <globals.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
uniform texture2D t_src_color;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
uniform texture2D t_src_color;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
uniform texture2D t_src_color;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#define FIGURE_SHADER
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -58,7 +58,7 @@ vec4 fxaa(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution,
|
||||
vec2 v_rgbSW, vec2 v_rgbSE,
|
||||
vec2 v_rgbM) {
|
||||
vec4 color;
|
||||
mediump vec2 inverseVP = vec2(1.0 / resolution.x, 1.0 / resolution.y);
|
||||
vec2 inverseVP = vec2(1.0 / resolution.x, 1.0 / resolution.y);
|
||||
vec3 rgbNW = texture(sampler2D(tex, smplr), v_rgbNW).xyz;
|
||||
vec3 rgbNE = texture(sampler2D(tex, smplr), v_rgbNE).xyz;
|
||||
vec3 rgbSW = texture(sampler2D(tex, smplr), v_rgbSW).xyz;
|
||||
@ -74,7 +74,7 @@ vec4 fxaa(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution,
|
||||
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
||||
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
||||
|
||||
mediump vec2 dir;
|
||||
vec2 dir;
|
||||
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
||||
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
||||
|
||||
@ -121,11 +121,11 @@ vec4 fxaa_apply(
|
||||
vec2 resolution,
|
||||
float sampleScale
|
||||
) {
|
||||
mediump vec2 v_rgbNW;
|
||||
mediump vec2 v_rgbNE;
|
||||
mediump vec2 v_rgbSW;
|
||||
mediump vec2 v_rgbSE;
|
||||
mediump vec2 v_rgbM;
|
||||
vec2 v_rgbNW;
|
||||
vec2 v_rgbNE;
|
||||
vec2 v_rgbSW;
|
||||
vec2 v_rgbSE;
|
||||
vec2 v_rgbM;
|
||||
|
||||
float fxaa_scale = textureSize(sampler2D(tex, smplr), 0).x / resolution.x * sampleScale;
|
||||
|
||||
|
@ -78,12 +78,13 @@ vec4 textureBicubic(texture2D tex, sampler sampl, vec2 texCoords) {
|
||||
}
|
||||
|
||||
vec4 textureMaybeBicubic(texture2D tex, sampler sampl, vec2 texCoords) {
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
|
||||
// TODO: Allow regular `texture` to be used when cause of light leaking issues is found
|
||||
//#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
|
||||
return textureBicubic(tex, sampl, texCoords);
|
||||
#else
|
||||
vec2 offset = (texCoords + vec2(-1.0, 0.5)) / textureSize(sampler2D(tex, sampl), 0);
|
||||
return texture(sampler2D(tex, sampl), offset);
|
||||
#endif
|
||||
//#else
|
||||
// vec2 offset = (texCoords + vec2(-1.0, 0.5)) / textureSize(sampler2D(tex, sampl), 0);
|
||||
// return texture(sampler2D(tex, sampl), offset);
|
||||
//#endif
|
||||
}
|
||||
|
||||
// 16 bit version (each of the 2 8-bit components are combined after bilinear sampling)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <globals.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
// #extension ARB_texture_storage : enable
|
||||
|
||||
#include <constants.glsl>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
// #extension ARB_texture_storage : enable
|
||||
|
||||
#define FIGURE_SHADER
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// However, in the future we might apply some depth transforms here.
|
||||
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
// #extension ARB_texture_storage : enable
|
||||
|
||||
#include <constants.glsl>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
// #extension ARB_texture_storage : enable
|
||||
|
||||
#include <constants.glsl>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
#extension GL_EXT_samplerless_texture_functions : enable
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
layout(push_constant) uniform Params {
|
||||
// Size of the source image.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
// #extension ARB_texture_storage : enable
|
||||
|
||||
#include <constants.glsl>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
// #extension ARB_texture_storage : enable
|
||||
|
||||
#define FIGURE_SHADER
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
@ -111,7 +111,13 @@ void main() {
|
||||
uint v_atlas_pos = pos_atlas_pos_norm_ao.y;
|
||||
|
||||
// Expand the model vertex position bits into float values
|
||||
vec3 v_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 8, 16)) & uvec3(0xFFu, 0xFFu, 0x0FFFu)) - ivec3(VERT_EXTRA_NEG_XY, VERT_EXTRA_NEG_XY, VERT_EXTRA_NEG_Z));
|
||||
// TODO: Use this instead, see [https://gitlab.com/veloren/veloren/-/merge_requests/3091]
|
||||
//vec3 v_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 8, 16)) & uvec3(0xFFu, 0xFFu, 0x0FFFu)) - ivec3(VERT_EXTRA_NEG_XY, VERT_EXTRA_NEG_XY, VERT_EXTRA_NEG_Z));
|
||||
vec3 v_pos = vec3(
|
||||
float(v_pos_norm & 0xFFu) - VERT_EXTRA_NEG_XY,
|
||||
float((v_pos_norm >> 8) & 0xFFu) - VERT_EXTRA_NEG_XY,
|
||||
float((v_pos_norm >> 16) & 0x0FFFu) - VERT_EXTRA_NEG_Z
|
||||
);
|
||||
|
||||
// Position of the sprite block in the chunk
|
||||
// Used for highlighting the selected sprite, and for opening doors
|
||||
@ -188,7 +194,14 @@ void main() {
|
||||
// Shader@0x000001AABD89BEE0(112,43-53): error X4576: Input array signature parameter cannot be indexed dynamically.
|
||||
//vec3 norm = (inst_mat[(v_pos_norm >> 30u) & 3u].xyz);
|
||||
uint index = v_pos_norm >> 30u & 3u;
|
||||
vec3 norm = (inst_mat[index].xyz);
|
||||
vec3 norm;
|
||||
if (index == 0) {
|
||||
norm = (inst_mat[0].xyz);
|
||||
} else if (index == 1) {
|
||||
norm = (inst_mat[1].xyz);
|
||||
} else {
|
||||
norm = (inst_mat[2].xyz);
|
||||
}
|
||||
|
||||
f_norm = normalize(mix(-norm, norm, v_pos_norm >> 29u & 1u));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
// #extension GL_ARB_texture_storage : require
|
||||
|
||||
#include <constants.glsl>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
@ -71,7 +71,9 @@ const float EXTRA_NEG_Z = 32768.0;
|
||||
|
||||
void main() {
|
||||
// over it (if this vertex to see if it intersects.
|
||||
vec3 f_chunk_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0xFFFFu)) - ivec3(0, 0, EXTRA_NEG_Z));
|
||||
// TODO: Use the following, see [https://gitlab.com/veloren/veloren/-/merge_requests/3091]
|
||||
//vec3 f_chunk_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0xFFFFu)) - ivec3(0, 0, EXTRA_NEG_Z));
|
||||
vec3 f_chunk_pos = vec3(v_pos_norm & 0x3Fu, (v_pos_norm >> 6) & 0x3Fu, float((v_pos_norm >> 12) & 0xFFFFu) - EXTRA_NEG_Z);
|
||||
|
||||
f_pos = (model_mat * vec4(f_chunk_pos, 1.0)).xyz - focus_off.xyz;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <constants.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <globals.glsl>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <globals.glsl>
|
||||
#include <constants.glsl>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 420 core
|
||||
#version 430 core
|
||||
|
||||
#include <globals.glsl>
|
||||
|
||||
|
@ -14,6 +14,7 @@ use super::{
|
||||
};
|
||||
use common_base::{prof_span, prof_span_alloc};
|
||||
use std::sync::Arc;
|
||||
use tracing::warn;
|
||||
|
||||
/// All the pipelines
|
||||
pub struct Pipelines {
|
||||
@ -401,6 +402,13 @@ fn create_shader_module(
|
||||
.compile_into_spirv(source, kind, file_name, "main", Some(options))
|
||||
.map_err(|e| (file_name, e))?;
|
||||
|
||||
if spv.get_num_warnings() > 0 {
|
||||
warn!(
|
||||
"shaderc emitted compilation warnings for {file_name}:\n\n{}",
|
||||
spv.get_warning_messages()
|
||||
);
|
||||
}
|
||||
|
||||
let label = [file_name, "\n\n", source].concat();
|
||||
Ok(device.create_shader_module(&wgpu::ShaderModuleDescriptor {
|
||||
label: Some(&label),
|
||||
|
@ -72,6 +72,7 @@ pub fn run(mut global_state: GlobalState, event_loop: EventLoop, server: Option<
|
||||
|
||||
match event {
|
||||
winit::event::Event::NewEvents(_) => {
|
||||
event_span.take();
|
||||
prof_span!(span, "Process Events");
|
||||
event_span = Some(span);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user