120 if (srt.img_premultiplied) {
126 float4 color =
float4(srt.scope_to_extended_srgb(image_color.rgb), 1.0f);
132 pos.
x = texel.
x - srt.image_width / 2;
138 int channel = texel.
x % 3;
139 int column = texel.
x / 3;
142 float other_channels = 0.6f;
145 pos.
x = column - srt.image_width / 2;
146 pos.
y = (
position.r - 0.5f) * srt.image_height;
147 color.rgb =
mix(color.rgb,
float3(1, other_channels, other_channels), factor);
150 pos.
x = column - srt.image_width / 2 + srt.image_width / 3;
151 pos.
y = (
position.g - 0.5f) * srt.image_height;
152 color.rgb =
mix(color.rgb,
float3(other_channels, 1, other_channels), factor);
155 pos.
x = column - srt.image_width / 2 + srt.image_width * 2 / 3;
156 pos.
y = (
position.b - 0.5f) * srt.image_height;
157 color.rgb =
mix(color.rgb,
float3(other_channels, other_channels, 1), factor);
163 float vec_size =
min(srt.image_width, srt.image_height);
164 pos = yuv.yz * vec_size;
179 float4 clip_pos = srt.ModelViewProjectionMatrix *
float4(pos * srt.inv_render_scale, 0.0f, 1.0f);
181 float2(srt.view_width, srt.view_height));
191 int index = view_pos.
y * srt.view_width + view_pos.
x;
192 if (srt.raster_buf[
index].col_a > 50 * 255) {
198 float raster_size = srt.scope_point_size;
199 int px_size =
max(
int(
ceil(raster_size)), 1);
200 float factor =
max(raster_size / px_size * srt.inv_render_scale, 1.0f / 255.0f);
206 srt.put_pixel(view_pos.
x, view_pos.
y, color);
210 px_size =
min(px_size, 16);
211 int x_min = view_pos.
x - px_size / 2;
212 int x_max = x_min + px_size;
213 int y_min = view_pos.
y - px_size / 2;
214 int y_max = y_min + px_size;
215 x_min =
clamp(x_min, 0, srt.view_width);
216 x_max =
clamp(x_max, 0, srt.view_width);
217 y_min =
clamp(y_min, 0, srt.view_height);
218 y_max =
clamp(y_max, 0, srt.view_height);
219 for (
int y = y_min;
y < y_max;
y++) {
220 for (
int x = x_min;
x < x_max;
x++) {
221 srt.put_pixel(
x,
y, color);
252 frag_out.color =
float4(0.0f);
259 int view_index = view_pos.
y * srt.view_width + view_pos.
x;
261 if (data.col_a != 0) {
262 float4 pix =
float4(data.col_r, data.col_g, data.col_b, data.col_a) / 255.0f;
263 frag_out.color.rgb = pix.rgb / pix.a;
266 frag_out.color.
w = 1.0f -
exp(-pix.a * srt.alpha_exponent);