Commit 99b4c868 authored by Vlad Zakharchenko's avatar Vlad Zakharchenko
Browse files

Added compressed bit-streams for test purposes

parent e474c0a3
0 0 31 389 2048 436
180 0 0
29 7 31 389 2047 436
180 0 0
103 9 22 459 1012 318
0 0 0
28 7 119 380 999 473
0 0 0
0 332 344 978 653 663
180 0 90
182 10 121 575 987 353
0 0 0
29 7 31 389 1023 436
0 0 0
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
precision highp float;
precision highp sampler2DArray;
layout(std140, binding = 0) uniform ubo {
mat4 modelViewProj;
};
layout (binding = 1) uniform sampler2DArray tex;
layout (location = 0) out vec4 fragColor;
void main() {
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
layout (location = 0) in vec4 pos;
layout(std140, binding = 0) uniform ubo {
mat4 modelViewProj;
};
void main() {
gl_Position = modelViewProj * vec4(pos.xyz, 1.0);
}
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
precision highp float;
precision highp sampler2DArray;
layout(std140, binding = 0) uniform ubo {
mat4 modelViewProj;
};
layout (binding = 1) uniform sampler2DArray tex;
layout (location = 0) in vec2 texcoord;
layout (location = 0) out vec4 fragColor;
void main() {
float r = texture(tex, vec3(texcoord, 0.0)).r;
fragColor = vec4(r,r,r,0.5);
}
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
layout (location = 0) in vec2 pos;
layout (location = 1) in vec2 texcoord;
layout (location = 0) out vec2 vTexcoord;
layout(std140, binding = 0) uniform ubo {
mat4 modelViewProj;
};
void main() {
gl_Position = modelViewProj * vec4(pos.x, 0.0, pos.y, 1.0);
vTexcoord = texcoord;
}
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#extension GL_OES_EGL_image_external_essl3 : require
precision highp float;
layout (binding = 0) uniform samplerExternalOES tex;
layout (location = 0) in vec2 texcoord;
layout (location = 0) out vec4 fragColor;
void main() {
fragColor = texture(tex, texcoord);
}
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
layout (location = 0) in vec2 pos;
layout (location = 1) in vec2 texcoord;
layout (location = 0) out vec2 vTexcoord;
void main() {
gl_Position = vec4(pos, 0.0, 1.0);
vTexcoord = texcoord;
}
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
precision highp float;
layout (location = 0) in vec4 vColor;
layout (location = 0) out vec4 fragColor;
void main() {
fragColor = vColor;
}
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#extension GL_EXT_YUV_target : enable
#extension GL_OES_gpu_shader5 : enable
precision highp float;
precision highp sampler2DArray;
#define NUM_LAYERS 2
#if NUM_LAYERS == 1
layout(points, max_vertices = 8) out;
#elif NUM_LAYERS == 2
layout(points, max_vertices = 16) out;
#endif
layout(points, invocations = 32) in;
#ifndef GL_EXT_YUV_target
#define itu_709 0
vec3 yuv_2_rgb(vec3 yuv, int mode) {
const mat3x3 mat = mat3x3(1.0f, 1.0f, 1.0f, 0.0f, -0.18733f, 1.85563f, 1.57480f, -0.46813f, 0.0f);
return mat * vec3(yuv[0], yuv[1] - 0.5f, yuv[2] - 0.5f);
}
#endif
//#define DISABLE_GEOMETRY_MAP
//#define DISABLE_ATTRIBUTE_MAP
//#define DISABLE_OCCUPANCY_MAP
#define ENABLE_HUAWEI_WORKAROUND
in vs_out {
ivec2 block_info;
} vs_data[];
layout(std140, binding = 0) uniform ubo {
int lod_scale, layer_index,
frame_width, frame_height,
occupancy_resolution, padding_0;
ivec2 padding_1;
mat4 modelViewProj;
};
struct patch_data_t {
uvec2 p2d_shift_uv;
uvec2 size_uv;
uint index;
uint p3d_shift_tangent_axis,
p3d_shift_bitangent_axis,
p3d_shift_min_normal_axis;
uint tangent_axis,
bitangent_axis,
normal_axis;
uint orientation_index;
int projection_transform, d1;
uvec2 padding_2;
mat4 canvasToPatchMatrix;
};
layout(std140, binding = 1) uniform patch_data_ubo {
patch_data_t patch_data;
};
out gl_PerVertex {
vec4 gl_Position;
#ifndef ENABLE_HUAWEI_WORKAROUND
float gl_PointSize;
#endif
};
layout(location = 0) out vec4 vColor;
layout(binding = 0) uniform sampler2DArray occupancy_image;
layout(binding = 1) uniform sampler2DArray geometry_image;
layout(binding = 2) uniform sampler2DArray attribute_image_y;
layout(binding = 3) uniform sampler2DArray attribute_image_uv;
ivec2 canvasToPatch(ivec2 uv0, ivec2 xy, ivec2 uvDim, mat4x2 canvasToPatchMat) {
return ivec2(canvasToPatchMat * vec4(xy - uv0, uvDim - ivec2(1)));
}
int getOccupancyValue(ivec2 p) {
float u = float(2 * p.x + 1) / float(2 * frame_width),
v = float(2 * p.y + 1) / float(2 * frame_height);
return int(texture(occupancy_image, vec3(u, v, 0)).r * 255.0f);
}
int getGeometryValue(ivec3 p) {
return int(texelFetch(geometry_image, p, 0).r * 255.0f);
}
vec4 getAttributeValue(ivec3 p) {
ivec3 p1 = ivec3(p[0] / 2, p[1] / 2, p[2]);
float y = texelFetch(attribute_image_y, p, 0).r;
vec2 uv = texelFetch(attribute_image_uv, p1, 0).rg;
return vec4(yuv_2_rgb(vec3(y, uv), itu_709), 1.0);
}
float generateNormalCoord(float depth, patch_data_t patch_data) {
return max(float(patch_data.d1) +
float(patch_data.projection_transform) * depth, 0.0f) * float(lod_scale);
}
void generatePoints(ivec2 uv, ivec2 xy, patch_data_t patch_data) {
vec4 pos, color;
int depth;
int nu = (uv[0] * lod_scale), nv = (uv[1] * lod_scale);
float u1 = float(patch_data.p3d_shift_tangent_axis),
v1 = float(patch_data.p3d_shift_bitangent_axis);
for (int layer_index = 0; layer_index < NUM_LAYERS; layer_index++) {
#ifndef DISABLE_GEOMETRY_MAP
depth = getGeometryValue(ivec3(xy, layer_index));
#else
depth = 0;
#endif
pos[patch_data.normal_axis] = generateNormalCoord(float(depth), patch_data);
pos[patch_data.tangent_axis] = (float(nu) + u1);
pos[patch_data.bitangent_axis] = (float(nv) + v1);
pos.w = float(1);
#ifndef DISABLE_ATTRIBUTE_MAP
color = getAttributeValue(ivec3(xy, layer_index));
#else
color = vec4(1.0f, 1.0f, 1.0f, 0.5f);
#endif
gl_Position = modelViewProj * pos;
#ifndef ENABLE_HUAWEI_WORKAROUND
gl_PointSize = 2.0;
#endif
vColor = color;
EmitVertex(); EndPrimitive();
}
}
void processBlock(ivec2 xy0) {
ivec2 patch_2d_shift_uv_t = ivec2(patch_data.p2d_shift_uv) * occupancy_resolution;
ivec2 patch_size_uv_t = ivec2(patch_data.size_uv) * occupancy_resolution;
for (int i = 0; i<1; i++) {
for (int j = 0; j< 8; j++) {
ivec2 xy = xy0 + ivec2(j, i);
int occupancy_value = getOccupancyValue(xy);
if (occupancy_value == 0) continue;
ivec2 uv = canvasToPatch(
patch_2d_shift_uv_t,
xy,
patch_size_uv_t,
mat4x2(patch_data.canvasToPatchMatrix)
);
generatePoints(uv, xy, patch_data);
}
}
}
void main() {
ivec2 bxy = vs_data[0].block_info;
ivec2 xy0 = bxy * occupancy_resolution;
int col = gl_InvocationID % 2, row = gl_InvocationID / 2;
processBlock(xy0 + ivec2(col * 8, row));
}
#version 320 es
/* Copyright (c) 2020, Futurewei Technologies., Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
layout(location = 0) in ivec2 vBlock;
out vs_out {
ivec2 block_info;
} vs_data;
void main() {
vs_data.block_info = vBlock;
}
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