This commit is contained in:
xsl
2025-09-04 10:54:47 +08:00
commit 6bc8f61b18
1808 changed files with 208268 additions and 0 deletions
@@ -0,0 +1,56 @@
#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 (binding = 1) uniform Col
{
vec4 data[8];
} color;
layout (location = 0) in vec2 inUV;
layout (location = 1) flat in uint colorOffset;
layout (location = 0) out vec4 outColor;
vec4 sampleTexture(vec2 uv)
{
vec4 c00 = color.data[0 + colorOffset];
vec4 c01 = color.data[1 + colorOffset];
vec4 c02 = color.data[2 + colorOffset];
vec4 c03 = color.data[3 + colorOffset];
vec4 b0 = mix(c00, c01, uv.x);
vec4 b1 = mix(c02, c03, uv.x);
vec4 p0 = mix(b0, b1, uv.y);
return p0;
}
void main()
{
outColor = sampleTexture(inUV);
}
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) in vec3 inPos;
layout (location = 1) in vec2 inUv;
layout (binding = 0) uniform Ubo
{
mat4 projection;
mat4 view;
mat4 model;
} ubo;
layout (location = 0) out vec2 outUV;
layout (location = 1) out uint colorOffset;
void main()
{
outUV = inUv;
colorOffset = inPos.z == 1.0f ? 4 : 0;
gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0f);
}
Binary file not shown.
@@ -0,0 +1,53 @@
/* 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.
*/
Texture2D textureColor : register(t1);
SamplerState samplerColor : register(s1);
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float2 UV : TEXCOORD0;
[[vk::location(1)]] uint ColorOffset : TEXCOORD1;
};
struct Col
{
float4 data[8];
};
[[vk::binding(1, 0)]]
ConstantBuffer<Col> color : register(b1);
float4 sampleTexture(VSOutput input)
{
float4 c00 = color.data[0 + input.ColorOffset];
float4 c01 = color.data[1 + input.ColorOffset];
float4 c02 = color.data[2 + input.ColorOffset];
float4 c03 = color.data[3 + input.ColorOffset];
float4 b0 = lerp(c00, c01, input.UV.x);
float4 b1 = lerp(c02, c03, input.UV.x);
float4 p0 = lerp(b0, b1, input.UV.y);
return p0;
}
float4 main(VSOutput input) : SV_TARGET0
{
return sampleTexture(input);
}
Binary file not shown.
@@ -0,0 +1,48 @@
/* 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 VSInput
{
[[vk::location(0)]] float3 Pos : POSITION0;
[[vk::location(1)]] float2 UV : TEXCOORD0;
};
struct UBO
{
float4x4 projection;
float4x4 view;
float4x4 model;
};
[[vk::binding(0, 0)]]
ConstantBuffer<UBO> ubo : register(b0);
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float2 UV : TEXCOORD0;
[[vk::location(1)]] nointerpolation uint ColorOffset : TEXCOORD1;
};
VSOutput main(VSInput input)
{
VSOutput output = (VSOutput) 0;
output.UV = input.UV;
output.ColorOffset = input.Pos.z == 1.0 ? 4 : 0;
output.Pos = mul(ubo.projection, mul(ubo.view, mul(ubo.model, float4(input.Pos.xyz, 1.0))));
return output;
}
Binary file not shown.