Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Monado
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Monado
Monado
Commits
6136da1d
Commit
6136da1d
authored
Oct 17, 2019
by
Pete Black
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check return values from vulkan functions in texture setup
parent
24506398
Pipeline
#71228
failed with stages
in 3 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
7 deletions
+45
-7
src/xrt/compositor/main/comp_distortion.c
src/xrt/compositor/main/comp_distortion.c
+45
-7
No files found.
src/xrt/compositor/main/comp_distortion.c
View file @
6136da1d
...
...
@@ -229,6 +229,7 @@ comp_distortion_destroy(struct comp_distortion *d)
if
(
d
->
distortion_model
=
XRT_DISTORTION_MODEL_MESHUV
)
{
vk
->
vkDestroyDescriptorSetLayout
(
vk
->
device
,
d
->
tex_descriptor_set_layout
,
NULL
);
// TODO: cleanup texture resources
}
_buffer_destroy
(
vk
,
&
d
->
ubo_handle
);
...
...
@@ -1059,7 +1060,13 @@ comp_distortion_init_textures(struct comp_distortion *d,
};
ret
=
vk_init_cmd_buffer
(
&
c
->
vk
,
&
cmd_buffer
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to initialise command buffer!"
);
}
ret
=
vk_init_cmd_buffer
(
&
c
->
vk
,
&
cmd_buffer_2
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to initialise command buffer 2!"
);
}
d
->
vbo_mesh
.
tex_width
=
16
;
d
->
vbo_mesh
.
tex_height
=
16
;
...
...
@@ -1067,20 +1074,31 @@ comp_distortion_init_textures(struct comp_distortion *d,
vk
,
d
->
vbo_mesh
.
tex_width
,
d
->
vbo_mesh
.
tex_height
,
VK_FORMAT_R32G32B32A32_SFLOAT
,
&
d
->
vbo_mesh
.
tex_memory
,
&
d
->
vbo_mesh
.
tex_image
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to create image!"
);
}
ret
=
vk_set_image_layout
(
vk
,
cmd_buffer
,
d
->
vbo_mesh
.
tex_image
,
VK_ACCESS_HOST_WRITE_BIT
,
VK_ACCESS_HOST_WRITE_BIT
,
VK_IMAGE_LAYOUT_UNDEFINED
,
VK_IMAGE_LAYOUT_GENERAL
,
srr
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to queue transition to GENERAL layout!"
);
}
ret
=
vk_submit_cmd_buffer
(
vk
,
cmd_buffer
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to transition to GENERAL layout!"
);
}
vk
->
vkGetImageMemoryRequirements
(
vk
->
device
,
d
->
vbo_mesh
.
tex_image
,
&
mem_reqs
);
// Set memory allocation size to required memory size
float
dummy_data
[
16
*
16
*
4
];
int
rowOffset
=
16
*
4
;
for
(
uint32_t
i
=
0
;
i
<
16
;
i
++
)
{
for
(
uint32_t
j
=
0
;
j
<
64
;
j
+=
4
)
{
// create some dummy data for testing (16x16 green image)
int
dim
=
16
;
float
dummy_data
[
dim
*
dim
*
4
];
int
rowOffset
=
dim
*
4
;
for
(
uint32_t
i
=
0
;
i
<
dim
;
i
++
)
{
for
(
uint32_t
j
=
0
;
j
<
dim
*
4
;
j
+=
4
)
{
dummy_data
[
j
+
(
i
*
rowOffset
)]
=
0
.
0
f
;
dummy_data
[
j
+
1
+
(
i
*
rowOffset
)]
=
1
.
0
f
;
dummy_data
[
j
+
2
+
(
i
*
rowOffset
)]
=
0
.
0
f
;
...
...
@@ -1091,18 +1109,38 @@ comp_distortion_init_textures(struct comp_distortion *d,
void
*
data_ptr
;
ret
=
vk
->
vkMapMemory
(
vk
->
device
,
d
->
vbo_mesh
.
tex_memory
,
0
,
mem_reqs
.
size
,
0
,
&
data_ptr
);
memcpy
(
data_ptr
,
dummy_data
,
16
*
16
*
4
*
4
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to map memory for distortion texture!"
);
}
memcpy
(
data_ptr
,
dummy_data
,
dim
*
dim
*
4
*
4
);
vk
->
vkUnmapMemory
(
vk
->
device
,
d
->
vbo_mesh
.
tex_memory
);
ret
=
vk_create_sampler
(
vk
,
&
d
->
vbo_mesh
.
tex_sampler
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to create sampler!"
);
}
ret
=
vk_set_image_layout
(
vk
,
cmd_buffer_2
,
d
->
vbo_mesh
.
tex_image
,
VK_ACCESS_HOST_WRITE_BIT
,
VK_ACCESS_SHADER_READ_BIT
,
VK_IMAGE_LAYOUT_UNDEFINED
,
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
,
srr
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to queue transition to "
"SHADER_READ_ONLY_OPTIMAL layout!"
);
}
ret
=
vk_submit_cmd_buffer
(
vk
,
cmd_buffer_2
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to transition to SHADER_READ_ONLY_OPTIMAL layout!"
);
}
ret
=
vk_create_view
(
vk
,
d
->
vbo_mesh
.
tex_image
,
VK_FORMAT_R32G32B32A32_SFLOAT
,
srr
,
&
d
->
vbo_mesh
.
tex_image_view
);
if
(
ret
!=
VK_SUCCESS
)
{
VK_DEBUG
(
vk
,
"Failed to transition to create image view!"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment