mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 20:01:22 +00:00
This patch make GLSL writer support emitting f16 types, f16 literals, f16 constructor and convertor. Unittests are also implemented, and end-to-end testcases are updated for GLSL extension requirement. The GLSL writer will require `GL_AMD_gpu_shader_half_float` extension if f16 WGSL extension is enabled, emit f16 literal as `1.23hf`, and map f16 types as follow: WGSL type -> GLSL type f16 -> float16_t vec2<f16> -> f16vec2 vec3<f16> -> f16vec3 vec4<f16> -> f16vec4 mat2x2<f16> -> f16mat2 mat2x3<f16> -> f16mat2x3 mat2x4<f16> -> f16mat2x4 mat3x2<f16> -> f16mat3x2 mat3x3<f16> -> f16mat3 mat3x4<f16> -> f16mat3x4 mat4x2<f16> -> f16mat4x2 mat4x3<f16> -> f16mat4x3 mat4x4<f16> -> f16mat4 Bug: tint:1473, tint:1502 Change-Id: I7e788f82be2873911961c891a644200c1cbb74db Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95684 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com> Reviewed-by: Ben Clayton <bclayton@google.com>
15 lines
311 B
GLSL
15 lines
311 B
GLSL
#version 310 es
|
|
#extension GL_AMD_gpu_shader_half_float : require
|
|
precision mediump float;
|
|
|
|
layout(location = 0) out vec4 value;
|
|
vec4 tint_symbol() {
|
|
return vec4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f);
|
|
}
|
|
|
|
void main() {
|
|
vec4 inner_result = tint_symbol();
|
|
value = inner_result;
|
|
return;
|
|
}
|