init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#version 450
|
||||
/* Copyright (c) 2023-2024, Mobica Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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 (input_attachment_index = 0, binding = 0) uniform subpassInput in_color_r;
|
||||
layout (input_attachment_index = 1, binding = 1) uniform subpassInput in_color_g;
|
||||
layout (input_attachment_index = 2, binding = 2) uniform subpassInput in_color_b;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color_r = subpassLoad(in_color_r);
|
||||
vec4 color_g = subpassLoad(in_color_g);
|
||||
vec4 color_b = subpassLoad(in_color_b);
|
||||
|
||||
outColor = color_r + color_g + color_b;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
#version 320 es
|
||||
/* Copyright (c) 2023-2024, Mobica Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
|
||||
gl_Position = vec4(uv * 2.0f - 1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
#version 450
|
||||
/* Copyright (c) 2023-2024, Mobica Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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 vec3 in_color;
|
||||
|
||||
layout(location = 0) out vec4 out_color_r;
|
||||
layout(location = 1) out vec4 out_color_g;
|
||||
layout(location = 2) out vec4 out_color_b;
|
||||
|
||||
// The full color is copied to individual attachments.
|
||||
// Each attachment has a single component bit (R, G, B) enabled
|
||||
// via the blend_attachment in ColorWriteEnable::prepare_pipelines.
|
||||
void main()
|
||||
{
|
||||
out_color_r = vec4(in_color, 1.0f);
|
||||
out_color_g = vec4(in_color, 1.0f);
|
||||
out_color_b = vec4(in_color, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
#version 450
|
||||
/* Copyright (c) 2023-2024, Mobica Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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) out vec3 out_color;
|
||||
|
||||
vec2 triangle_positions[3] = vec2[](
|
||||
vec2(0.0, -0.5),
|
||||
vec2(0.5, 0.5),
|
||||
vec2(-0.5, 0.5)
|
||||
);
|
||||
|
||||
vec3 triangle_colors[3] = vec3[](
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(0.0, 1.0, 0.0),
|
||||
vec3(0.0, 0.0, 1.0)
|
||||
);
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(triangle_positions[gl_VertexIndex], 0.0, 1.0);
|
||||
out_color = triangle_colors[gl_VertexIndex];
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
/* Copyright (c) 2024, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
[[vk::input_attachment_index(0)]][[vk::binding(0)]] SubpassInput in_color_r;
|
||||
[[vk::input_attachment_index(1)]][[vk::binding(1)]] SubpassInput in_color_g;
|
||||
[[vk::input_attachment_index(2)]][[vk::binding(2)]] SubpassInput in_color_b;
|
||||
|
||||
float4 main() : SV_TARGET0
|
||||
{
|
||||
float4 color_r = in_color_r.SubpassLoad();
|
||||
float4 color_g = in_color_g.SubpassLoad();
|
||||
float4 color_b = in_color_b.SubpassLoad();
|
||||
|
||||
return color_r + color_g + color_b;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
/* Copyright (c) 2024, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
};
|
||||
|
||||
VSOutput main(uint VertexIndex : SV_VertexID)
|
||||
{
|
||||
VSOutput output = (VSOutput) 0;
|
||||
float2 uv = float2((VertexIndex << 1) & 2, VertexIndex & 2);
|
||||
output.Pos = float4(uv * 2.0f - 1.0f, 0.0f, 1.0f);
|
||||
return output;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
/* Copyright (c) 2024, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float3 Color : COLOR0;
|
||||
};
|
||||
|
||||
struct FSOutput
|
||||
{
|
||||
float4 ColorR : SV_TARGET0;
|
||||
float4 ColorG : SV_TARGET1;
|
||||
float4 ColorB : SV_TARGET2;
|
||||
};
|
||||
|
||||
// The full color is copied to individual attachments.
|
||||
// Each attachment has a single component bit (R, G, B) enabled
|
||||
// via the blend_attachment in ColorWriteEnable::prepare_pipelines.
|
||||
FSOutput main(VSOutput Input)
|
||||
{
|
||||
FSOutput output = (FSOutput)0;
|
||||
output.ColorR = float4(Input.Color, 1.0f);
|
||||
output.ColorG = float4(Input.Color, 1.0f);
|
||||
output.ColorB = float4(Input.Color, 1.0f);
|
||||
return output;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,43 @@
|
||||
/* Copyright (c) 2024, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float3 Color : COLOR0;
|
||||
};
|
||||
|
||||
static float2 triangle_positions[3] = {
|
||||
float2(0.0, -0.5),
|
||||
float2(0.5, 0.5),
|
||||
float2(-0.5, 0.5)
|
||||
};
|
||||
|
||||
static float3 triangle_colors[3] = {
|
||||
float3(1.0, 0.0, 0.0),
|
||||
float3(0.0, 1.0, 0.0),
|
||||
float3(0.0, 0.0, 1.0)
|
||||
};
|
||||
|
||||
VSOutput main(uint VertexIndex : SV_VertexID)
|
||||
{
|
||||
VSOutput output = (VSOutput) 0;
|
||||
output.Pos = float4(triangle_positions[VertexIndex], 0.0, 1.0);
|
||||
output.Color = triangle_colors[VertexIndex];
|
||||
return output;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user