Commit f334b8b6 authored by Lubosz Sarnecki's avatar Lubosz Sarnecki Committed by Jakob Bornecrantz
Browse files

src: Consistently append 2 to equirect2 code.

Rename XRT_FEATURE_OPENXR_LAYER_EQUIRECT to XRT_FEATURE_OPENXR_LAYER_EQUIRECT2.
Rename equirect to equirect2.
Rename shader files.
parent b2337469
......@@ -144,8 +144,8 @@ endif()
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_CYLINDER)
set(XRT_FEATURE_OPENXR_LAYER_CYLINDER ON)
endif()
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_EQUIRECT)
set(XRT_FEATURE_OPENXR_LAYER_EQUIRECT ON)
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_EQUIRECT2)
set(XRT_FEATURE_OPENXR_LAYER_EQUIRECT2 ON)
endif()
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_EQUIRECT_LEGACY)
set(XRT_FEATURE_OPENXR_LAYER_EQUIRECT_LEGACY OFF)
......@@ -303,7 +303,7 @@ message(STATUS "# FEATURE_OPENXR: ${XRT_FEATURE_OPENXR}
message(STATUS "# FEATURE_OPENXR_LAYER_DEPTH: ${XRT_FEATURE_OPENXR_LAYER_DEPTH}")
message(STATUS "# FEATURE_OPENXR_LAYER_CUBE: ${XRT_FEATURE_OPENXR_LAYER_CUBE}")
message(STATUS "# FEATURE_OPENXR_LAYER_CYLINDER: ${XRT_FEATURE_OPENXR_LAYER_CYLINDER}")
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT}")
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT2: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT2}")
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT_LEGACY: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT_LEGACY}")
message(STATUS "# FEATURE_STEAMVR_PLUGIN: ${XRT_FEATURE_STEAMVR_PLUGIN}")
message(STATUS "#")
......
......@@ -19,7 +19,7 @@ EXTENSIONS = (
['XR_KHR_composition_layer_cube', 'XRT_FEATURE_OPENXR_LAYER_CUBE'],
['XR_KHR_composition_layer_cylinder', 'XRT_FEATURE_OPENXR_LAYER_CYLINDER'],
['XR_KHR_composition_layer_equirect', 'XRT_FEATURE_OPENXR_LAYER_EQUIRECT_LEGACY'],
['XR_KHR_composition_layer_equirect2', 'XRT_FEATURE_OPENXR_LAYER_EQUIRECT'],
['XR_KHR_composition_layer_equirect2', 'XRT_FEATURE_OPENXR_LAYER_EQUIRECT2'],
['XR_EXT_debug_utils'],
['XR_MND_headless'],
['XR_MND_swapchain_usage_input_attachment_bit'],
......
......@@ -6,8 +6,8 @@ spirv_shaders(SHADER_HEADERS
shaders/mesh.vert
shaders/layer.frag
shaders/layer.vert
shaders/equirect.vert
shaders/equirect.frag
shaders/equirect2.vert
shaders/equirect2.frag
)
set(CLIENT_SOURCE_FILES)
......
......@@ -263,22 +263,22 @@ client_gl_compositor_layer_cylinder(struct xrt_compositor *xc,
}
static xrt_result_t
client_gl_compositor_layer_equirect(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data)
client_gl_compositor_layer_equirect2(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data)
{
struct client_gl_compositor *c = client_gl_compositor(xc);
struct xrt_swapchain *xscfb;
assert(data->type == XRT_LAYER_EQUIRECT);
assert(data->type == XRT_LAYER_EQUIRECT2);
xscfb = &client_gl_swapchain(xsc)->xscn->base;
struct xrt_layer_data d = *data;
d.flip_y = !d.flip_y;
return xrt_comp_layer_equirect(&c->xcn->base, xdev, xscfb, &d);
return xrt_comp_layer_equirect2(&c->xcn->base, xdev, xscfb, &d);
}
static xrt_result_t
......@@ -442,7 +442,7 @@ client_gl_compositor_init(struct client_gl_compositor *c,
c->base.base.layer_quad = client_gl_compositor_layer_quad;
c->base.base.layer_cube = client_gl_compositor_layer_cube;
c->base.base.layer_cylinder = client_gl_compositor_layer_cylinder;
c->base.base.layer_equirect = client_gl_compositor_layer_equirect;
c->base.base.layer_equirect2 = client_gl_compositor_layer_equirect2;
c->base.base.layer_commit = client_gl_compositor_layer_commit;
c->base.base.destroy = client_gl_compositor_destroy;
c->base.base.poll_events = client_gl_compositor_poll_events;
......
......@@ -330,19 +330,19 @@ client_vk_compositor_layer_cylinder(struct xrt_compositor *xc,
}
static xrt_result_t
client_vk_compositor_layer_equirect(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data)
client_vk_compositor_layer_equirect2(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data)
{
struct client_vk_compositor *c = client_vk_compositor(xc);
struct xrt_swapchain *xscfb;
assert(data->type == XRT_LAYER_EQUIRECT);
assert(data->type == XRT_LAYER_EQUIRECT2);
xscfb = &client_vk_swapchain(xsc)->xscn->base;
return xrt_comp_layer_equirect(&c->xcn->base, xdev, xscfb, data);
return xrt_comp_layer_equirect2(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
......@@ -541,7 +541,7 @@ client_vk_compositor_create(struct xrt_compositor_native *xcn,
c->base.base.layer_quad = client_vk_compositor_layer_quad;
c->base.base.layer_cube = client_vk_compositor_layer_cube;
c->base.base.layer_cylinder = client_vk_compositor_layer_cylinder;
c->base.base.layer_equirect = client_vk_compositor_layer_equirect;
c->base.base.layer_equirect2 = client_vk_compositor_layer_equirect2;
c->base.base.layer_commit = client_vk_compositor_layer_commit;
c->base.base.destroy = client_vk_compositor_destroy;
c->base.base.poll_events = client_vk_compositor_poll_events;
......
......@@ -441,10 +441,10 @@ compositor_layer_cylinder(struct xrt_compositor *xc,
}
static xrt_result_t
compositor_layer_equirect(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data)
compositor_layer_equirect2(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data)
{
return do_single(xc, xdev, xsc, data);
}
......@@ -513,12 +513,12 @@ compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id)
image = &layer->scs[0]->images[cyl->sub.image_index];
comp_renderer_set_cylinder_layer(c->r, i, image, data);
} break;
case XRT_LAYER_EQUIRECT: {
struct xrt_layer_equirect_data *eq =
&layer->data.equirect;
case XRT_LAYER_EQUIRECT2: {
struct xrt_layer_equirect2_data *eq =
&layer->data.equirect2;
struct comp_swapchain_image *image;
image = &layer->scs[0]->images[eq->sub.image_index];
comp_renderer_set_equirect_layer(c->r, i, image, data);
comp_renderer_set_equirect2_layer(c->r, i, image, data);
} break;
case XRT_LAYER_CUBE:
// Should never end up here.
......@@ -1308,7 +1308,7 @@ xrt_gfx_provider_create_native(struct xrt_device *xdev)
c->base.base.layer_quad = compositor_layer_quad;
c->base.base.layer_cube = compositor_layer_cube;
c->base.base.layer_cylinder = compositor_layer_cylinder;
c->base.base.layer_equirect = compositor_layer_equirect;
c->base.base.layer_equirect2 = compositor_layer_equirect2;
c->base.base.layer_commit = compositor_layer_commit;
c->base.base.poll_events = compositor_poll_events;
c->base.base.destroy = compositor_destroy;
......
......@@ -141,8 +141,8 @@ struct comp_shaders
VkShaderModule mesh_vert;
VkShaderModule mesh_frag;
VkShaderModule equirect_vert;
VkShaderModule equirect_frag;
VkShaderModule equirect2_vert;
VkShaderModule equirect2_frag;
VkShaderModule layer_vert;
VkShaderModule layer_frag;
......
......@@ -84,7 +84,7 @@ _init_ubos(struct comp_render_layer *self)
}
static bool
_init_equirect_ubo(struct comp_render_layer *self)
_init_equirect2_ubo(struct comp_render_layer *self)
{
VkBufferUsageFlags usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
VkMemoryPropertyFlags properties =
......@@ -93,17 +93,17 @@ _init_equirect_ubo(struct comp_render_layer *self)
VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
if (!vk_buffer_init(self->vk, sizeof(struct layer_transformation),
usage, properties, &self->equirect_ubo.handle,
&self->equirect_ubo.memory))
usage, properties, &self->equirect2_ubo.handle,
&self->equirect2_ubo.memory))
return false;
VkResult res = self->vk->vkMapMemory(
self->vk->device, self->equirect_ubo.memory, 0, VK_WHOLE_SIZE, 0,
&self->equirect_ubo.data);
self->vk->device, self->equirect2_ubo.memory, 0, VK_WHOLE_SIZE, 0,
&self->equirect2_ubo.data);
vk_check_error("vkMapMemory", res, false);
memcpy(self->equirect_ubo.data, &self->equirect_data,
sizeof(struct layer_equirect_data));
memcpy(self->equirect2_ubo.data, &self->equirect2_data,
sizeof(struct layer_equirect2_data));
return true;
}
......@@ -188,20 +188,20 @@ comp_layer_update_descriptors(struct comp_render_layer *self,
}
void
comp_layer_update_equirect_descriptor(struct comp_render_layer *self,
struct xrt_layer_equirect_data *data)
comp_layer_update_equirect2_descriptor(struct comp_render_layer *self,
struct xrt_layer_equirect2_data *data)
{
_update_descriptor_equirect(self, self->descriptor_equirect,
self->equirect_ubo.handle);
self->equirect2_ubo.handle);
self->equirect_data = (struct layer_equirect_data){
self->equirect2_data = (struct layer_equirect2_data){
.radius = data->radius,
.central_horizontal_angle = data->central_horizontal_angle,
.upper_vertical_angle = data->upper_vertical_angle,
.lower_vertical_angle = data->lower_vertical_angle,
};
memcpy(self->equirect_ubo.data, &self->equirect_data,
sizeof(struct layer_equirect_data));
memcpy(self->equirect2_ubo.data, &self->equirect2_data,
sizeof(struct layer_equirect2_data));
}
void
......@@ -236,7 +236,7 @@ _init(struct comp_render_layer *self,
if (!_init_ubos(self))
return false;
if (!_init_equirect_ubo(self))
if (!_init_equirect2_ubo(self))
return false;
VkDescriptorPoolSize pool_sizes[] = {
......@@ -301,7 +301,7 @@ comp_layer_draw(struct comp_render_layer *self,
break;
case XRT_LAYER_QUAD:
case XRT_LAYER_CYLINDER:
case XRT_LAYER_EQUIRECT: _update_mvp_matrix(self, eye, vp); break;
case XRT_LAYER_EQUIRECT2: _update_mvp_matrix(self, eye, vp); break;
case XRT_LAYER_STEREO_PROJECTION_DEPTH:
case XRT_LAYER_CUBE:
// Should never end up here.
......@@ -309,7 +309,7 @@ comp_layer_draw(struct comp_render_layer *self,
}
if (self->type == XRT_LAYER_EQUIRECT) {
if (self->type == XRT_LAYER_EQUIRECT2) {
const VkDescriptorSet sets[2] = {
self->descriptor_sets[eye],
self->descriptor_equirect,
......@@ -477,7 +477,7 @@ comp_layer_destroy(struct comp_render_layer *self)
for (uint32_t eye = 0; eye < 2; eye++)
vk_buffer_destroy(&self->transformation_ubos[eye], self->vk);
vk_buffer_destroy(&self->equirect_ubo, self->vk);
vk_buffer_destroy(&self->equirect2_ubo, self->vk);
self->vk->vkDestroyDescriptorPool(self->vk->device,
self->descriptor_pool, NULL);
......
......@@ -20,7 +20,7 @@ struct layer_transformation
bool flip_y;
};
struct layer_equirect_data
struct layer_equirect2_data
{
float radius;
float central_horizontal_angle;
......@@ -41,8 +41,8 @@ struct comp_render_layer
struct layer_transformation transformation[2];
struct vk_buffer transformation_ubos[2];
struct layer_equirect_data equirect_data;
struct vk_buffer equirect_ubo;
struct layer_equirect2_data equirect2_data;
struct vk_buffer equirect2_ubo;
VkDescriptorPool descriptor_pool;
VkDescriptorSet descriptor_sets[2];
......@@ -105,5 +105,5 @@ comp_layer_update_cylinder_vertex_buffer(struct comp_render_layer *self,
float central_angle);
void
comp_layer_update_equirect_descriptor(struct comp_render_layer *self,
struct xrt_layer_equirect_data *data);
comp_layer_update_equirect2_descriptor(struct comp_render_layer *self,
struct xrt_layer_equirect2_data *data);
......@@ -407,8 +407,8 @@ _render_eye(struct comp_layer_renderer *self,
? self->pipeline_premultiplied_alpha
: self->pipeline_unpremultiplied_alpha;
if (self->layers[i]->type == XRT_LAYER_EQUIRECT) {
pipeline = self->pipeline_equirect;
if (self->layers[i]->type == XRT_LAYER_EQUIRECT2) {
pipeline = self->pipeline_equirect2;
comp_layer_draw(self->layers[i], eye, pipeline,
pipeline_layout, cmd_buffer,
vertex_buffer, &vp_inv, &vp_inv);
......@@ -553,8 +553,8 @@ _init(struct comp_layer_renderer *self,
return false;
}
if (!_init_graphics_pipeline(self, s->equirect_vert, s->equirect_frag,
true, &self->pipeline_equirect)) {
if (!_init_graphics_pipeline(self, s->equirect2_vert, s->equirect2_frag,
true, &self->pipeline_equirect2)) {
return false;
}
......@@ -696,7 +696,7 @@ comp_layer_renderer_destroy(struct comp_layer_renderer *self)
NULL);
vk->vkDestroyPipeline(vk->device, self->pipeline_unpremultiplied_alpha,
NULL);
vk->vkDestroyPipeline(vk->device, self->pipeline_equirect, NULL);
vk->vkDestroyPipeline(vk->device, self->pipeline_equirect2, NULL);
for (uint32_t i = 0; i < ARRAY_SIZE(self->shader_modules); i++)
vk->vkDestroyShaderModule(vk->device, self->shader_modules[i],
......
......@@ -39,7 +39,7 @@ struct comp_layer_renderer
VkShaderModule shader_modules[2];
VkPipeline pipeline_premultiplied_alpha;
VkPipeline pipeline_unpremultiplied_alpha;
VkPipeline pipeline_equirect;
VkPipeline pipeline_equirect2;
VkDescriptorSetLayout descriptor_set_layout;
VkDescriptorSetLayout descriptor_set_layout_equirect;
......
......@@ -575,21 +575,21 @@ comp_renderer_set_projection_layer(struct comp_renderer *r,
}
void
comp_renderer_set_equirect_layer(struct comp_renderer *r,
uint32_t layer,
struct comp_swapchain_image *image,
struct xrt_layer_data *data)
comp_renderer_set_equirect2_layer(struct comp_renderer *r,
uint32_t layer,
struct comp_swapchain_image *image,
struct xrt_layer_data *data)
{
struct xrt_vec3 s = {1.0f, 1.0f, 1.0f};
struct xrt_matrix_4x4 model_matrix;
math_matrix_4x4_model(&data->equirect.pose, &s, &model_matrix);
math_matrix_4x4_model(&data->equirect2.pose, &s, &model_matrix);
comp_layer_set_flip_y(r->lr->layers[layer], data->flip_y);
struct comp_render_layer *l = r->lr->layers[layer];
l->type = XRT_LAYER_EQUIRECT;
l->visibility = data->equirect.visibility;
l->type = XRT_LAYER_EQUIRECT2;
l->visibility = data->equirect2.visibility;
l->flags = data->flags;
l->view_space =
(data->flags & XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT) != 0;
......@@ -598,13 +598,14 @@ comp_renderer_set_equirect_layer(struct comp_renderer *r,
comp_layer_update_descriptors(
l, image->repeat_sampler,
get_image_view(image, data->flags, data->equirect.sub.array_index));
get_image_view(image, data->flags,
data->equirect2.sub.array_index));
comp_layer_update_equirect_descriptor(l, &data->equirect);
comp_layer_update_equirect2_descriptor(l, &data->equirect2);
for (uint32_t i = 0; i < 2; i++) {
l->transformation[i].offset = data->equirect.sub.rect.offset;
l->transformation[i].extent = data->equirect.sub.rect.extent;
l->transformation[i].offset = data->equirect2.sub.rect.offset;
l->transformation[i].extent = data->equirect2.sub.rect.extent;
}
}
......
......@@ -74,10 +74,10 @@ comp_renderer_set_cylinder_layer(struct comp_renderer *r,
struct xrt_layer_data *data);
void
comp_renderer_set_equirect_layer(struct comp_renderer *r,
uint32_t layer,
struct comp_swapchain_image *image,
struct xrt_layer_data *data);
comp_renderer_set_equirect2_layer(struct comp_renderer *r,
uint32_t layer,
struct comp_swapchain_image *image,
struct xrt_layer_data *data);
void
comp_renderer_allocate_layers(struct comp_renderer *self, uint32_t num_layers);
......
......@@ -22,8 +22,8 @@
#include "shaders/layer.frag.h"
#include "shaders/layer.vert.h"
#include "shaders/equirect.frag.h"
#include "shaders/equirect.vert.h"
#include "shaders/equirect2.frag.h"
#include "shaders/equirect2.vert.h"
#include "shaders/mesh.frag.h"
#include "shaders/mesh.vert.h"
......@@ -89,14 +89,14 @@ comp_shaders_load(struct vk_bundle *vk, struct comp_shaders *s)
sizeof(shaders_mesh_frag), // size
&s->mesh_frag)); // out
C(shader_load(vk, // vk_bundle
shaders_equirect_vert, // data
sizeof(shaders_equirect_vert), // size
&s->equirect_vert)); // out
C(shader_load(vk, // vk_bundle
shaders_equirect_frag, // data
sizeof(shaders_equirect_frag), // size
&s->equirect_frag)); // out
C(shader_load(vk, // vk_bundle
shaders_equirect2_vert, // data
sizeof(shaders_equirect2_vert), // size
&s->equirect2_vert)); // out
C(shader_load(vk, // vk_bundle
shaders_equirect2_frag, // data
sizeof(shaders_equirect2_frag), // size
&s->equirect2_frag)); // out
C(shader_load(vk, // vk_bundle
shaders_layer_vert, // data
......@@ -123,8 +123,8 @@ comp_shaders_close(struct vk_bundle *vk, struct comp_shaders *s)
{
D(mesh_vert);
D(mesh_frag);
D(equirect_vert);
D(equirect_frag);
D(equirect2_vert);
D(equirect2_frag);
D(layer_vert);
D(layer_frag);
......
......@@ -6,8 +6,8 @@ shader_srcs = [
'mesh.vert',
'layer.vert',
'layer.frag',
'equirect.vert',
'equirect.frag'
'equirect2.vert',
'equirect2.frag'
]
shader_headers = []
......
......@@ -98,7 +98,7 @@ if get_option('layer_equirect')
endif
if get_option('layer_equirect2')
have_conf.set('XRT_FEATURE_OPENXR_LAYER_EQUIRECT', true)
have_conf.set('XRT_FEATURE_OPENXR_LAYER_EQUIRECT2', true)
endif
xrt_config_have_h = configure_file(
......
......@@ -96,7 +96,7 @@ enum xrt_layer_type
XRT_LAYER_QUAD,
XRT_LAYER_CUBE,
XRT_LAYER_CYLINDER,
XRT_LAYER_EQUIRECT,
XRT_LAYER_EQUIRECT2,
};
/*!
......@@ -250,12 +250,12 @@ struct xrt_layer_cylinder_data
};
/*!
* All the pure data values associated with a equirect layer.
* All the pure data values associated with a equirect2 layer.
*
* The @ref xrt_swapchain references and @ref xrt_device are provided outside of
* this struct.
*/
struct xrt_layer_equirect_data
struct xrt_layer_equirect2_data
{
enum xrt_layer_eye_visibility visibility;
......@@ -327,7 +327,7 @@ struct xrt_layer_data
struct xrt_layer_quad_data quad;
struct xrt_layer_cube_data cube;
struct xrt_layer_cylinder_data cylinder;
struct xrt_layer_equirect_data equirect;
struct xrt_layer_equirect2_data equirect2;
};
};
......@@ -723,17 +723,17 @@ struct xrt_compositor
const struct xrt_layer_data *data);
/*!
* Adds a equirect layer for submission.
* Adds a equirect2 layer for submission.
*
* @param xc Self pointer
* @param xdev The device the layer is relative to.
* @param xsc Swapchain.
* @param data All of the pure data bits.
*/
xrt_result_t (*layer_equirect)(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data);
xrt_result_t (*layer_equirect2)(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data);
/*!
* Commits all of the submitted layers, it's from this on that the
......@@ -982,19 +982,19 @@ xrt_comp_layer_cylinder(struct xrt_compositor *xc,
}
/*!
* @copydoc xrt_compositor::layer_equirect
* @copydoc xrt_compositor::layer_equirect2
*
* Helper for calling through the function pointer.
*
* @public @memberof xrt_compositor
*/
static inline xrt_result_t
xrt_comp_layer_equirect(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data)
xrt_comp_layer_equirect2(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
const struct xrt_layer_data *data)
{
return xc->layer_equirect(xc, xdev, xsc, data);
return xc->layer_equirect2(xc, xdev, xsc, data);
}
/*!
......
......@@ -21,6 +21,6 @@
#cmakedefine XRT_FEATURE_OPENXR_LAYER_DEPTH
#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT
#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT2
#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT_LEGACY
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment