c/render: Remove old layer render shaders

This commit is contained in:
Jakob Bornecrantz 2023-10-12 13:31:44 +01:00
parent 2245811d1e
commit d0617c04d5
11 changed files with 0 additions and 383 deletions

View file

@ -93,8 +93,6 @@ if(XRT_HAVE_VULKAN)
shaders/layer.comp
shaders/mesh.frag
shaders/mesh.vert
shaders/layer.frag
shaders/layer.vert
shaders/layer_cylinder.frag
shaders/layer_cylinder.vert
shaders/layer_equirect2.frag
@ -102,14 +100,7 @@ if(XRT_HAVE_VULKAN)
shaders/layer_projection.vert
shaders/layer_quad.vert
shaders/layer_shared.frag
shaders/equirect1.vert
shaders/equirect1.frag
shaders/equirect2.vert
shaders/equirect2.frag
)
if(XRT_FEATURE_OPENXR_LAYER_CUBE)
list(APPEND SHADERS shaders/cube.vert shaders/cube.frag)
endif()
spirv_shaders(
SHADER_HEADERS

View file

@ -139,17 +139,6 @@ struct render_shaders
VkShaderModule mesh_vert;
VkShaderModule mesh_frag;
VkShaderModule equirect1_vert;
VkShaderModule equirect1_frag;
VkShaderModule equirect2_vert;
VkShaderModule equirect2_frag;
VkShaderModule cube_vert;
VkShaderModule cube_frag;
VkShaderModule layer_vert;
VkShaderModule layer_frag;
/*
* New layer renderer.

View file

@ -30,12 +30,6 @@
#include "shaders/clear.comp.h"
#include "shaders/layer.comp.h"
#include "shaders/distortion.comp.h"
#include "shaders/layer.frag.h"
#include "shaders/layer.vert.h"
#include "shaders/equirect1.frag.h"
#include "shaders/equirect1.vert.h"
#include "shaders/equirect2.frag.h"
#include "shaders/equirect2.vert.h"
#include "shaders/layer_cylinder.frag.h"
#include "shaders/layer_cylinder.vert.h"
#include "shaders/layer_equirect2.frag.h"
@ -123,20 +117,6 @@ render_shaders_load(struct render_shaders *s, struct vk_bundle *vk)
LOAD(mesh_vert);
LOAD(mesh_frag);
LOAD(equirect1_vert);
LOAD(equirect1_frag);
LOAD(equirect2_vert);
LOAD(equirect2_frag);
#ifdef XRT_FEATURE_OPENXR_LAYER_CUBE
LOAD(cube_vert);
LOAD(cube_frag);
#endif
LOAD(layer_vert);
LOAD(layer_frag);
LOAD(layer_cylinder_frag);
LOAD(layer_cylinder_vert);
LOAD(layer_equirect2_frag);
@ -159,16 +139,6 @@ render_shaders_close(struct render_shaders *s, struct vk_bundle *vk)
D(ShaderModule, s->layer_comp);
D(ShaderModule, s->mesh_vert);
D(ShaderModule, s->mesh_frag);
D(ShaderModule, s->equirect1_vert);
D(ShaderModule, s->equirect1_frag);
D(ShaderModule, s->equirect2_vert);
D(ShaderModule, s->equirect2_frag);
#ifdef XRT_FEATURE_OPENXR_LAYER_CUBE
D(ShaderModule, s->cube_vert);
D(ShaderModule, s->cube_frag);
#endif
D(ShaderModule, s->layer_vert);
D(ShaderModule, s->layer_frag);
D(ShaderModule, s->layer_cylinder_frag);
D(ShaderModule, s->layer_cylinder_vert);

View file

@ -1,27 +0,0 @@
// Copyright 2020 Simon Zeni <simon@bl4ckb0ne.ca>
// Author: Simon Zeni <simon@bl4ckb0ne.ca>
// Author: Bjorn Swenson <bjorn@collabora.com>
// SPDX-License-Identifier: BSL-1.0
#version 460
layout (binding = 0, std140) uniform Transformation
{
mat4 mvp;
ivec2 offset;
ivec2 extent;
bool flip_y;
} ubo;
layout (binding = 1) uniform samplerCube cube;
layout (location = 0) in vec2 uv;
layout (location = 0) out vec4 out_color;
void main ()
{
vec2 frag_coord = vec2(uv) * 2 - 1;
vec4 view_dir = normalize(ubo.mvp * vec4(frag_coord.x, frag_coord.y, 1, 1));
out_color = texture(cube, view_dir.xyz);
}

View file

@ -1,36 +0,0 @@
// Copyright 2020 Simon Zeni <simon@bl4ckb0ne.ca>
// Author: Simon Zeni <simon@bl4ckb0ne.ca>
// Author: Bjorn Swenson <bjorn@collabora.com>
// SPDX-License-Identifier: BSL-1.0
#version 460
layout (binding = 0, std140) uniform Transformation
{
mat4 mvp;
ivec2 offset;
ivec2 extent;
bool flip_y;
} transformation;
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 uv;
layout (location = 0) out vec2 out_uv;
const mat4 mvp = mat4(
2, 0, 0, 0,
0, 2, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
);
void main() {
gl_Position = mvp * vec4(position, 1.0);
gl_Position.y *= -1.;
out_uv = uv;
if (transformation.flip_y) {
out_uv.y = 1.0 - out_uv.y;
}
}

View file

@ -1,51 +0,0 @@
// Copyright 2020 Collabora Ltd.
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
// SPDX-License-Identifier: BSL-1.0
#version 460
layout (set = 0, binding = 0, std140) uniform Transformation
{
mat4 mvp;
ivec2 offset;
ivec2 extent;
bool flip_y;
} ubo;
layout (set = 0, binding = 1) uniform sampler2D image;
layout (set = 1, binding = 0, std140) uniform Equirect
{
vec2 scale;
vec2 bias;
float radius;
} equirect;
layout (location = 0) in vec2 uv;
layout (location = 0) out vec4 out_color;
const float PI = 3.1416;
void main ()
{
vec2 uv_sub = vec2(ubo.offset) + uv * vec2(ubo.extent);
uv_sub /= textureSize(image, 0);
vec2 frag_coord = vec2(uv_sub) * 2 - 1;
vec4 view_dir = normalize(ubo.mvp * vec4(frag_coord.x, -frag_coord.y, 1, 1));
float lat = atan(view_dir.x, -view_dir.z) / (2 * PI);
float lon = acos(view_dir.y) / PI;
lat *= equirect.scale.x;
lon *= equirect.scale.y;
lat += equirect.bias.x;
lon += equirect.bias.y;
out_color = texture(image, vec2(lat, lon));
}

View file

@ -1,38 +0,0 @@
// Copyright 2020 Collabora Ltd.
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
// SPDX-License-Identifier: BSL-1.0
#version 460
layout (binding = 0, std140) uniform Transformation {
mat4 mvp;
ivec2 offset;
ivec2 extent;
bool flip_y;
} transformation;
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 uv;
layout (location = 0) out vec2 out_uv;
out gl_PerVertex {
vec4 gl_Position;
};
const mat4 mvp = mat4(
2, 0, 0, 0,
0, 2, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
);
void main()
{
gl_Position = mvp * vec4 (position, 1.0f);
gl_Position.y = -gl_Position.y;
out_uv = uv;
if (transformation.flip_y) {
out_uv.y = 1.0 - out_uv.y;
}
}

View file

@ -1,79 +0,0 @@
// Copyright 2020 Collabora Ltd.
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
// SPDX-License-Identifier: BSL-1.0
#version 460
layout (set = 0, binding = 0, std140) uniform Transformation {
mat4 mvp;
ivec2 offset;
ivec2 extent;
bool flip_y;
} ubo;
layout (set = 0, binding = 1) uniform sampler2D image;
layout (set = 1, binding = 0, std140) uniform Equirect {
float radius;
float central_horizontal_angle;
float upper_vertical_angle;
float lower_vertical_angle;
} equirect;
layout (location = 0) in vec2 uv;
layout (location = 0) out vec4 out_color;
const float PI = 3.1416;
void main ()
{
vec2 uv_sub = vec2(ubo.offset) + uv * vec2(ubo.extent);
uv_sub /= textureSize(image, 0);
vec2 frag_coord = vec2(uv_sub) * 2 - 1;
vec4 view_dir = normalize(ubo.mvp * vec4(frag_coord.x, -frag_coord.y, 1, 1));
float lat = atan(view_dir.x, -view_dir.z) / (2 * PI);
float lon = acos(view_dir.y) / PI;
#undef DEBUG
#ifdef DEBUG
int lat_int = int(lat * 1000.0);
int lon_int = int(lon * 1000.0);
if (lat < 0.001 && lat > -0.001) {
out_color = vec4(1, 0, 0, 1);
} else if (lat_int % 50 == 0) {
out_color = vec4(1, 1, 1, 1);
} else if (lon_int % 50 == 0) {
out_color = vec4(1, 1, 1, 1);
} else {
out_color = vec4(lat, lon, 0, 1);
}
#endif
float chan = equirect.central_horizontal_angle / (PI * 2.0f);
// Normalize [0, 2π] to [0, 1]
float uhan = chan / 2.0f;
float lhan = -chan / 2.0f;
// Normalize [-π/2, π/2] to [0, 1]
float uvan = equirect.upper_vertical_angle / PI + 0.5f;
float lvan = equirect.lower_vertical_angle / PI + 0.5f;
if (lon < uvan && lon > lvan && lat < uhan && lat > lhan) {
#ifdef DEBUG
out_color += texture(image, vec2(lat, lon)) / 2.0;
#else
out_color = texture(image, vec2(lat, lon));
} else {
out_color = vec4(0, 0, 0, 0);
}
#endif
}

View file

@ -1,41 +0,0 @@
// Copyright 2020 Collabora Ltd.
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
// SPDX-License-Identifier: BSL-1.0
#version 460
layout (binding = 0, std140) uniform Transformation
{
mat4 mvp;
ivec2 offset;
ivec2 extent;
bool flip_y;
} transformation;
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 uv;
layout (location = 0) out vec2 out_uv;
out gl_PerVertex
{
vec4 gl_Position;
};
const mat4 mvp = mat4(
2, 0, 0, 0,
0, 2, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
);
void main() {
gl_Position = mvp * vec4 (position, 1.0f);
gl_Position.y = -gl_Position.y;
out_uv = uv;
if (transformation.flip_y) {
out_uv.y = 1.0 - out_uv.y;
}
}

View file

@ -1,27 +0,0 @@
// Copyright 2020 Collabora Ltd.
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
// SPDX-License-Identifier: BSL-1.0
#version 460
layout (binding = 0, std140) uniform Transformation
{
mat4 mvp;
ivec2 offset;
ivec2 extent;
bool flip_y;
} ubo;
layout (binding = 1) uniform sampler2D image;
layout (location = 0) in vec2 uv;
layout (location = 0) out vec4 out_color;
void main ()
{
vec2 uv_sub = vec2(ubo.offset) + uv * vec2(ubo.extent);
uv_sub /= textureSize(image, 0);
out_color = texture(image, uv_sub);
}

View file

@ -1,34 +0,0 @@
// Copyright 2020 Collabora Ltd.
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
// SPDX-License-Identifier: BSL-1.0
#version 460
layout (binding = 0, std140) uniform Transformation
{
mat4 mvp;
ivec2 offset;
ivec2 extent;
bool flip_y;
} transformation;
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 uv;
layout (location = 0) out vec2 out_uv;
out gl_PerVertex
{
vec4 gl_Position;
};
void main() {
gl_Position = transformation.mvp * vec4 (position, 1.0f);
gl_Position.y = -gl_Position.y;
out_uv = uv;
if (transformation.flip_y) {
out_uv.y = 1.0 - out_uv.y;
}
}