-
-
Save zakorgy/7f34f5cc4cb721501e04431c2ab0f76c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct RectWithSize | |
{ | |
float2 p0; | |
float2 size; | |
}; | |
struct RectWithEndpoint | |
{ | |
float2 p0; | |
float2 p1; | |
}; | |
struct RenderTaskCommonData | |
{ | |
RectWithSize task_rect; | |
float texture_layer_index; | |
float device_pixel_scale; | |
}; | |
struct RenderTaskData | |
{ | |
RenderTaskCommonData common_data; | |
float2 user_data; | |
}; | |
struct PictureTask | |
{ | |
RenderTaskCommonData common_data; | |
float2 content_origin; | |
}; | |
struct ClipArea | |
{ | |
RenderTaskCommonData common_data; | |
float2 screen_origin; | |
}; | |
struct ImageResource | |
{ | |
RectWithEndpoint uv_rect; | |
float layer; | |
float3 user_data; | |
}; | |
struct ImageResourceExtra | |
{ | |
float2 st_tl; | |
float2 st_tr; | |
float2 st_bl; | |
float2 st_br; | |
}; | |
struct Transform | |
{ | |
float4x4 m; | |
float4x4 inv_m; | |
bool is_axis_aligned; | |
}; | |
struct PrimitiveHeader | |
{ | |
RectWithSize local_rect; | |
RectWithSize local_clip_rect; | |
float z; | |
int specific_prim_address; | |
int render_task_index; | |
int clip_task_index; | |
int transform_id; | |
int3 user_data; | |
}; | |
struct VertexInfo | |
{ | |
float2 local_pos; | |
float2 snap_offset; | |
float4 world_pos; | |
}; | |
struct ImageBrushData | |
{ | |
float4 color; | |
float4 background_color; | |
float2 stretch_size; | |
}; | |
#ifndef SPIRV_CROSS_CONSTANT_ID_5 | |
#define SPIRV_CROSS_CONSTANT_ID_5 true | |
#endif | |
static const bool push_constants = SPIRV_CROSS_CONSTANT_ID_5; | |
#ifndef SPIRV_CROSS_CONSTANT_ID_0 | |
#define SPIRV_CROSS_CONSTANT_ID_0 false | |
#endif | |
static const bool alpha_pass = SPIRV_CROSS_CONSTANT_ID_0; | |
#ifndef SPIRV_CROSS_CONSTANT_ID_1 | |
#define SPIRV_CROSS_CONSTANT_ID_1 false | |
#endif | |
static const bool color_target = SPIRV_CROSS_CONSTANT_ID_1; | |
#ifndef SPIRV_CROSS_CONSTANT_ID_2 | |
#define SPIRV_CROSS_CONSTANT_ID_2 false | |
#endif | |
static const bool glyph_transform_f = SPIRV_CROSS_CONSTANT_ID_2; | |
#ifndef SPIRV_CROSS_CONSTANT_ID_3 | |
#define SPIRV_CROSS_CONSTANT_ID_3 false | |
#endif | |
static const bool dithering = SPIRV_CROSS_CONSTANT_ID_3; | |
#ifndef SPIRV_CROSS_CONSTANT_ID_4 | |
#define SPIRV_CROSS_CONSTANT_ID_4 false | |
#endif | |
static const bool debug_overdraw = SPIRV_CROSS_CONSTANT_ID_4; | |
static const RectWithSize _244 = { 0.0f.xx, 0.0f.xx }; | |
ByteAddressBuffer _268 : register(t5, space2); | |
cbuffer Locals : register(b0, space4) | |
{ | |
row_major float4x4 _679_uTransform : packoffset(c0); | |
int _679_uMode : packoffset(c4); | |
}; | |
cbuffer SPIRV_CROSS_RootConstant_pushConstants : register(b0, space0) | |
{ | |
row_major float4x4 pushConstants_uTransform : packoffset(c0); | |
int pushConstants_uMode : packoffset(c4); | |
}; | |
Texture2D<float4> sRenderTasks : register(t7, space2); | |
SamplerState _sRenderTasks_sampler : register(s7, space2); | |
Texture2D<float4> sTransformPalette : register(t6, space2); | |
SamplerState _sTransformPalette_sampler : register(s6, space2); | |
Texture2D<float4> sPrimitiveHeadersF : register(t9, space2); | |
SamplerState _sPrimitiveHeadersF_sampler : register(s9, space2); | |
Texture2D<int4> sPrimitiveHeadersI : register(t10, space2); | |
SamplerState _sPrimitiveHeadersI_sampler : register(s10, space2); | |
Texture2DArray<float4> sColor0 : register(t0, space3); | |
SamplerState _sColor0_sampler : register(s0, space3); | |
Texture2DArray<float4> sColor1 : register(t1, space3); | |
SamplerState _sColor1_sampler : register(s1, space3); | |
Texture2DArray<float4> sColor2 : register(t2, space3); | |
SamplerState _sColor2_sampler : register(s2, space3); | |
Texture2D<float4> sDither : register(t8, space2); | |
SamplerState _sDither_sampler : register(s8, space2); | |
Texture2DArray<float4> sPrevPassAlpha : register(t3, space1); | |
SamplerState _sPrevPassAlpha_sampler : register(s3, space1); | |
Texture2DArray<float4> sPrevPassColor : register(t4, space1); | |
SamplerState _sPrevPassColor_sampler : register(s4, space1); | |
static float4 gl_Position; | |
static float4 vTransformBounds; | |
static float3 aPosition; | |
static float4 vClipMaskUvBounds; | |
static float4 vClipMaskUv; | |
static int4 aData; | |
static float2 vLayerAndPerspective; | |
static float4 vUvSampleBounds; | |
static float2 vUv; | |
static float4 vUvBounds; | |
static float2 vTileRepeat; | |
static float2 vMaskSwizzle; | |
static float4 vColor; | |
static float2 vLocalPos; | |
struct SPIRV_Cross_Input | |
{ | |
float3 aPosition : TEXCOORD0; | |
int4 aData : TEXCOORD1; | |
}; | |
struct SPIRV_Cross_Output | |
{ | |
nointerpolation float4 vTransformBounds : TEXCOORD0; | |
nointerpolation float4 vClipMaskUvBounds : TEXCOORD1; | |
float4 vClipMaskUv : TEXCOORD2; | |
float2 vLocalPos : TEXCOORD3; | |
float2 vUv : TEXCOORD4; | |
nointerpolation float2 vLayerAndPerspective : TEXCOORD5; | |
nointerpolation float4 vUvBounds : TEXCOORD6; | |
nointerpolation float4 vUvSampleBounds : TEXCOORD7; | |
nointerpolation float4 vColor : TEXCOORD8; | |
nointerpolation float2 vMaskSwizzle : TEXCOORD9; | |
nointerpolation float2 vTileRepeat : TEXCOORD10; | |
float4 gl_Position : SV_Position; | |
}; | |
uint3 SPIRV_Cross_textureSize(Texture2DArray<float4> Tex, uint Level, out uint Param) | |
{ | |
uint3 ret; | |
Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); | |
return ret; | |
} | |
PrimitiveHeader fetch_prim_header(int index) | |
{ | |
int2 uv_f = int2(int(2u * (uint(index) % 512u)), int(uint(index) / 512u)); | |
float4 local_rect = sPrimitiveHeadersF.Load(int3(uv_f, 0), int2(0, 0)); | |
float4 local_clip_rect = sPrimitiveHeadersF.Load(int3(uv_f, 0), int2(1, 0)); | |
RectWithSize _559 = { local_rect.xy, local_rect.zw }; | |
PrimitiveHeader ph; | |
ph.local_rect = _559; | |
RectWithSize _565 = { local_clip_rect.xy, local_clip_rect.zw }; | |
ph.local_clip_rect = _565; | |
int2 uv_i = int2(int(2u * (uint(index) % 512u)), int(uint(index) / 512u)); | |
int4 data0 = sPrimitiveHeadersI.Load(int3(uv_i, 0), int2(0, 0)); | |
int4 data1 = sPrimitiveHeadersI.Load(int3(uv_i, 0), int2(1, 0)); | |
ph.z = float(data0.x); | |
ph.render_task_index = data0.y; | |
ph.specific_prim_address = data0.z; | |
ph.clip_task_index = data0.w; | |
ph.transform_id = data1.x; | |
ph.user_data = data1.yzw; | |
return ph; | |
} | |
void fetch_from_gpu_cache_2(out float4 SPIRV_Cross_return_value[2], int address) | |
{ | |
float4 _277[2] = { asfloat(_268.Load4(address * 16 + 0)), asfloat(_268.Load4((address + 1) * 16 + 0)) }; | |
SPIRV_Cross_return_value = _277; | |
} | |
RenderTaskData fetch_render_task_data(int index) | |
{ | |
int2 uv = int2(int(2u * (uint(index) % 512u)), int(uint(index) / 512u)); | |
float4 texel0 = sRenderTasks.Load(int3(uv, 0), int2(0, 0)); | |
float4 texel1 = sRenderTasks.Load(int3(uv, 0), int2(1, 0)); | |
RectWithSize _203 = { texel0.xy, texel0.zw }; | |
RectWithSize task_rect = _203; | |
RenderTaskCommonData _213 = { task_rect, texel1.x, texel1.y }; | |
RenderTaskCommonData common_data = _213; | |
RenderTaskData _219 = { common_data, texel1.zw }; | |
RenderTaskData data = _219; | |
return data; | |
} | |
PictureTask fetch_picture_task(int address) | |
{ | |
int param = address; | |
RenderTaskData task_data = fetch_render_task_data(param); | |
PictureTask _232 = { task_data.common_data, task_data.user_data }; | |
PictureTask task = _232; | |
return task; | |
} | |
ClipArea fetch_clip_area(int index) | |
{ | |
ClipArea area; | |
if (index >= 32767) | |
{ | |
RectWithSize rect = _244; | |
RenderTaskCommonData _248 = { rect, 0.0f, 1.0f }; | |
area.common_data = _248; | |
area.screen_origin = 0.0f.xx; | |
} | |
else | |
{ | |
int param = index; | |
RenderTaskData task_data = fetch_render_task_data(param); | |
area.common_data = task_data.common_data; | |
area.screen_origin = task_data.user_data; | |
} | |
return area; | |
} | |
Transform fetch_transform(int id) | |
{ | |
Transform transform; | |
transform.is_axis_aligned = (id >> 24) == 0; | |
int index = id & 16777215; | |
int2 uv = int2(int(8u * (uint(index) % 128u)), int(uint(index) / 128u)); | |
int2 uv0 = int2(uv.x + 0, uv.y); | |
transform.m[0] = sTransformPalette.Load(int3(uv0, 0), int2(0, 0)); | |
transform.m[1] = sTransformPalette.Load(int3(uv0, 0), int2(1, 0)); | |
transform.m[2] = sTransformPalette.Load(int3(uv0, 0), int2(2, 0)); | |
transform.m[3] = sTransformPalette.Load(int3(uv0, 0), int2(3, 0)); | |
transform.inv_m[0] = sTransformPalette.Load(int3(uv0, 0), int2(4, 0)); | |
transform.inv_m[1] = sTransformPalette.Load(int3(uv0, 0), int2(5, 0)); | |
transform.inv_m[2] = sTransformPalette.Load(int3(uv0, 0), int2(6, 0)); | |
transform.inv_m[3] = sTransformPalette.Load(int3(uv0, 0), int2(7, 0)); | |
return transform; | |
} | |
float2 clamp_rect(float2 pt, RectWithSize rect) | |
{ | |
return clamp(pt, rect.p0, rect.p0 + rect.size); | |
} | |
float4 compute_snap_positions(float4x4 transform, inout RectWithSize snap_rect, float device_pixel_scale) | |
{ | |
snap_rect.size = max(snap_rect.size, (1.0f / device_pixel_scale).xx); | |
float4 world_snap_p0 = mul(float4(snap_rect.p0, 0.0f, 1.0f), transform); | |
float4 world_snap_p1 = mul(float4(snap_rect.p0 + snap_rect.size, 0.0f, 1.0f), transform); | |
float4 world_snap = (float4(world_snap_p0.xy, world_snap_p1.xy) * device_pixel_scale) / float4(world_snap_p0.ww, world_snap_p1.ww); | |
return world_snap; | |
} | |
float2 compute_snap_offset_impl(float2 reference_pos, RectWithSize reference_rect, float4 snap_positions) | |
{ | |
float4 snap_offsets = floor(snap_positions + 0.5f.xxxx) - snap_positions; | |
float2 normalized_snap_pos = (reference_pos - reference_rect.p0) / reference_rect.size; | |
return lerp(snap_offsets.xy, snap_offsets.zw, normalized_snap_pos); | |
} | |
float2 compute_snap_offset(float2 local_pos, float4x4 transform, RectWithSize snap_rect, float device_pixel_scale) | |
{ | |
float4x4 param = transform; | |
RectWithSize param_1 = snap_rect; | |
float param_2 = device_pixel_scale; | |
float4 _419 = compute_snap_positions(param, param_1, param_2); | |
float4 snap_positions = _419; | |
float2 param_3 = local_pos; | |
RectWithSize param_4 = snap_rect; | |
float4 param_5 = snap_positions; | |
float2 snap_offsets = compute_snap_offset_impl(param_3, param_4, param_5); | |
return snap_offsets; | |
} | |
VertexInfo write_vertex(RectWithSize instance_rect, RectWithSize local_clip_rect, float z, Transform transform, PictureTask task, RectWithSize snap_rect) | |
{ | |
float2 local_pos = instance_rect.p0 + (instance_rect.size * aPosition.xy); | |
float2 param = local_pos; | |
RectWithSize param_1 = local_clip_rect; | |
float2 clamped_local_pos = clamp_rect(param, param_1); | |
float2 param_2 = clamped_local_pos; | |
float4x4 param_3 = transform.m; | |
RectWithSize param_4 = snap_rect; | |
float param_5 = task.common_data.device_pixel_scale; | |
float2 snap_offset = compute_snap_offset(param_2, param_3, param_4, param_5); | |
float4 world_pos = mul(float4(clamped_local_pos, 0.0f, 1.0f), transform.m); | |
float2 device_pos = world_pos.xy * task.common_data.device_pixel_scale; | |
float2 final_offset = (snap_offset - task.content_origin) + task.common_data.task_rect.p0; | |
float4x4 _transform; | |
if (push_constants) | |
{ | |
_transform = pushConstants_uTransform; | |
} | |
else | |
{ | |
_transform = _679_uTransform; | |
} | |
gl_Position = mul(float4(device_pos + (final_offset * world_pos.w), z * world_pos.w, world_pos.w), _transform); | |
VertexInfo _709 = { clamped_local_pos, snap_offset, world_pos }; | |
VertexInfo vi = _709; | |
return vi; | |
} | |
void init_transform_vs(float4 local_bounds) | |
{ | |
vTransformBounds = local_bounds; | |
} | |
RectWithEndpoint to_rect_with_endpoint(RectWithSize rect) | |
{ | |
RectWithEndpoint result; | |
result.p0 = rect.p0; | |
result.p1 = rect.p0 + rect.size; | |
return result; | |
} | |
VertexInfo write_transform_vertex(inout RectWithSize local_segment_rect, RectWithSize local_prim_rect, RectWithSize local_clip_rect, float4 clip_edge_mask, float z, Transform transform, PictureTask task) | |
{ | |
RectWithSize param = local_clip_rect; | |
RectWithEndpoint clip_rect = to_rect_with_endpoint(param); | |
RectWithSize param_1 = local_segment_rect; | |
RectWithEndpoint segment_rect = to_rect_with_endpoint(param_1); | |
segment_rect.p0 = clamp(segment_rect.p0, clip_rect.p0, clip_rect.p1); | |
segment_rect.p1 = clamp(segment_rect.p1, clip_rect.p0, clip_rect.p1); | |
RectWithSize param_2 = local_prim_rect; | |
RectWithEndpoint prim_rect = to_rect_with_endpoint(param_2); | |
prim_rect.p0 = clamp(prim_rect.p0, clip_rect.p0, clip_rect.p1); | |
prim_rect.p1 = clamp(prim_rect.p1, clip_rect.p0, clip_rect.p1); | |
float extrude_amount = 2.0f; | |
float4 extrude_distance = extrude_amount.xxxx * clip_edge_mask; | |
local_segment_rect.p0 -= extrude_distance.xy; | |
local_segment_rect.size += (extrude_distance.xy + extrude_distance.zw); | |
float2 local_pos = local_segment_rect.p0 + (local_segment_rect.size * aPosition.xy); | |
float2 task_offset = task.common_data.task_rect.p0 - task.content_origin; | |
float4 world_pos = mul(float4(local_pos, 0.0f, 1.0f), transform.m); | |
float4 final_pos = float4((world_pos.xy * task.common_data.device_pixel_scale) + (task_offset * world_pos.w), z * world_pos.w, world_pos.w); | |
float4x4 _transform; | |
if (push_constants) | |
{ | |
_transform = pushConstants_uTransform; | |
} | |
else | |
{ | |
_transform = _679_uTransform; | |
} | |
gl_Position = mul(final_pos, _transform); | |
float4 param_3 = lerp(float4(prim_rect.p0, prim_rect.p1), float4(segment_rect.p0, segment_rect.p1), clip_edge_mask); | |
init_transform_vs(param_3); | |
VertexInfo _859 = { local_pos, 0.0f.xx, world_pos }; | |
VertexInfo vi = _859; | |
return vi; | |
} | |
void write_clip(float4 world_pos, float2 snap_offset, ClipArea area) | |
{ | |
float2 uv = (world_pos.xy * area.common_data.device_pixel_scale) + (((snap_offset + area.common_data.task_rect.p0) - area.screen_origin) * world_pos.w); | |
vClipMaskUvBounds = float4(area.common_data.task_rect.p0, area.common_data.task_rect.p0 + area.common_data.task_rect.size); | |
vClipMaskUv = float4(uv, area.common_data.texture_layer_index, world_pos.w); | |
} | |
void fetch_from_gpu_cache_3(out float4 SPIRV_Cross_return_value[3], int address) | |
{ | |
float4 _292[3] = { asfloat(_268.Load4(address * 16 + 0)), asfloat(_268.Load4((address + 1) * 16 + 0)), asfloat(_268.Load4((address + 2) * 16 + 0)) }; | |
SPIRV_Cross_return_value = _292; | |
} | |
ImageBrushData fetch_image_data(int address) | |
{ | |
int param = address; | |
float4 _1088[3]; | |
fetch_from_gpu_cache_3(_1088, param); | |
float4 raw_data[3] = _1088; | |
ImageBrushData _1098 = { raw_data[0], raw_data[1], raw_data[2].xy }; | |
ImageBrushData data = _1098; | |
return data; | |
} | |
ImageResource fetch_image_resource(int address) | |
{ | |
int param = address; | |
float4 _299[2]; | |
fetch_from_gpu_cache_2(_299, param); | |
float4 data[2] = _299; | |
RectWithEndpoint _307 = { data[0].xy, data[0].zw }; | |
RectWithEndpoint uv_rect = _307; | |
ImageResource _314 = { uv_rect, data[1].x, data[1].yzw }; | |
return _314; | |
} | |
ImageResourceExtra fetch_image_resource_extra(int address) | |
{ | |
int param = address + 2; | |
float4 _321[2]; | |
fetch_from_gpu_cache_2(_321, param); | |
float4 data[2] = _321; | |
ImageResourceExtra _334 = { data[0].xy, data[0].zw, data[1].xy, data[1].zw }; | |
return _334; | |
} | |
void brush_vs(VertexInfo vi, int prim_address, RectWithSize prim_rect, RectWithSize segment_rect, int4 user_data, float4x4 transform, PictureTask pic_task, int brush_flags, float4 segment_data) | |
{ | |
int param = prim_address; | |
ImageBrushData image_data = fetch_image_data(param); | |
uint _1113_dummy_parameter; | |
float2 texture_size = float2(float3(int3(SPIRV_Cross_textureSize(sColor0, uint(0), _1113_dummy_parameter))).xy); | |
int param_1 = user_data.w; | |
ImageResource res = fetch_image_resource(param_1); | |
float2 uv0 = res.uv_rect.p0; | |
float2 uv1 = res.uv_rect.p1; | |
RectWithSize local_rect = prim_rect; | |
float2 stretch_size = image_data.stretch_size; | |
if (stretch_size.x < 0.0f) | |
{ | |
stretch_size = local_rect.size; | |
} | |
if ((brush_flags & 2) != 0) | |
{ | |
local_rect = segment_rect; | |
stretch_size = local_rect.size; | |
if ((brush_flags & 4) != 0) | |
{ | |
stretch_size.x = segment_data.z - segment_data.x; | |
} | |
if ((brush_flags & 8) != 0) | |
{ | |
stretch_size.y = segment_data.w - segment_data.y; | |
} | |
if ((brush_flags & 16) != 0) | |
{ | |
uv0 = res.uv_rect.p0 + segment_data.xy; | |
uv1 = res.uv_rect.p0 + segment_data.zw; | |
} | |
} | |
float _1188; | |
if ((brush_flags & 1) != 0) | |
{ | |
_1188 = 1.0f; | |
} | |
else | |
{ | |
_1188 = 0.0f; | |
} | |
float perspective_interpolate = _1188; | |
vLayerAndPerspective = float2(res.layer, perspective_interpolate); | |
float2 min_uv = min(uv0, uv1); | |
float2 max_uv = max(uv0, uv1); | |
vUvSampleBounds = float4(min_uv + 0.5f.xx, max_uv - 0.5f.xx) / texture_size.xyxy; | |
float2 f = (vi.local_pos - local_rect.p0) / local_rect.size; | |
int color_mode; | |
int blend_mode; | |
if (alpha_pass) | |
{ | |
color_mode = user_data.x & 65535; | |
blend_mode = user_data.x >> 16; | |
int raster_space = user_data.y; | |
if (color_mode == 0) | |
{ | |
int _umode; | |
if (push_constants) | |
{ | |
_umode = pushConstants_uMode; | |
} | |
else | |
{ | |
_umode = _679_uMode; | |
} | |
color_mode = _umode; | |
} | |
switch (raster_space) | |
{ | |
case 1: | |
{ | |
int param_2 = user_data.w; | |
ImageResourceExtra extra_data = fetch_image_resource_extra(param_2); | |
float2 x = lerp(extra_data.st_tl, extra_data.st_tr, f.x.xx); | |
float2 y = lerp(extra_data.st_bl, extra_data.st_br, f.x.xx); | |
f = lerp(x, y, f.y.xx); | |
break; | |
} | |
default: | |
{ | |
break; | |
} | |
} | |
} | |
float2 repeat = local_rect.size / stretch_size; | |
vUv = lerp(uv0, uv1, f) - min_uv; | |
vUv /= texture_size; | |
vUv *= repeat; | |
if (perspective_interpolate == 0.0f) | |
{ | |
vUv *= vi.world_pos.w; | |
} | |
vUvBounds = float4(min_uv, max_uv) / texture_size.xyxy; | |
if (alpha_pass) | |
{ | |
vTileRepeat = repeat; | |
float opacity = float(user_data.z) / 65535.0f; | |
switch (blend_mode) | |
{ | |
case 0: | |
{ | |
image_data.color.w *= opacity; | |
break; | |
} | |
case 1: | |
{ | |
image_data.color *= opacity; | |
break; | |
} | |
default: | |
{ | |
image_data.color *= opacity; | |
break; | |
} | |
} | |
switch (color_mode) | |
{ | |
case 1: | |
{ | |
vMaskSwizzle = float2(0.0f, 1.0f); | |
vColor = image_data.color; | |
break; | |
} | |
case 7: | |
{ | |
vMaskSwizzle = float2(0.0f, 1.0f); | |
vColor = image_data.color; | |
break; | |
} | |
case 5: | |
{ | |
vMaskSwizzle = float2(1.0f, 0.0f); | |
vColor = image_data.color; | |
break; | |
} | |
case 6: | |
{ | |
vMaskSwizzle = float2(1.0f, 0.0f); | |
vColor = image_data.color; | |
break; | |
} | |
case 9: | |
{ | |
vMaskSwizzle = float2(1.0f, 0.0f); | |
vColor = image_data.color; | |
break; | |
} | |
case 2: | |
{ | |
vMaskSwizzle = float2(1.0f, 0.0f); | |
vColor = image_data.color.w.xxxx; | |
break; | |
} | |
case 3: | |
{ | |
vMaskSwizzle = float2(1.0f, 0.0f); | |
vColor = image_data.color.w.xxxx; | |
break; | |
} | |
case 8: | |
{ | |
vMaskSwizzle = float2(1.0f, 0.0f); | |
vColor = image_data.color.w.xxxx; | |
break; | |
} | |
case 4: | |
{ | |
vMaskSwizzle = float2(-1.0f, 1.0f); | |
vColor = image_data.color.w.xxxx * image_data.background_color; | |
break; | |
} | |
default: | |
{ | |
vMaskSwizzle = 0.0f.xx; | |
vColor = 1.0f.xxxx; | |
break; | |
} | |
} | |
vLocalPos = vi.local_pos; | |
} | |
} | |
void vert_main() | |
{ | |
int prim_header_address = aData.x; | |
int clip_address = aData.y; | |
int segment_index = aData.z & 65535; | |
int edge_flags = (aData.z >> 16) & 255; | |
int brush_flags = (aData.z >> 24) & 255; | |
int segment_user_data = aData.w; | |
int param = prim_header_address; | |
PrimitiveHeader ph = fetch_prim_header(param); | |
RectWithSize segment_rect; | |
float4 segment_data; | |
if (segment_index == 65535) | |
{ | |
segment_rect = ph.local_rect; | |
segment_data = 0.0f.xxxx; | |
} | |
else | |
{ | |
int segment_address = (ph.specific_prim_address + 3) + (segment_index * 2); | |
int param_1 = segment_address; | |
float4 _955[2]; | |
fetch_from_gpu_cache_2(_955, param_1); | |
float4 segment_info[2] = _955; | |
RectWithSize _962 = { segment_info[0].xy, segment_info[0].zw }; | |
segment_rect = _962; | |
segment_rect.p0 += ph.local_rect.p0; | |
segment_data = segment_info[1]; | |
} | |
int param_2 = ph.render_task_index; | |
PictureTask pic_task = fetch_picture_task(param_2); | |
int param_3 = clip_address; | |
ClipArea clip_area = fetch_clip_area(param_3); | |
int param_4 = ph.transform_id; | |
Transform transform = fetch_transform(param_4); | |
VertexInfo vi; | |
if (transform.is_axis_aligned) | |
{ | |
RectWithSize param_5 = segment_rect; | |
RectWithSize param_6 = ph.local_clip_rect; | |
float param_7 = ph.z; | |
Transform param_8 = transform; | |
PictureTask param_9 = pic_task; | |
RectWithSize param_10 = ph.local_rect; | |
VertexInfo _1005 = write_vertex(param_5, param_6, param_7, param_8, param_9, param_10); | |
vi = _1005; | |
if (alpha_pass) | |
{ | |
float4 param_11 = float4(-10000000272564224.0f, -10000000272564224.0f, 10000000272564224.0f, 10000000272564224.0f); | |
init_transform_vs(param_11); | |
} | |
} | |
else | |
{ | |
int4 _1022 = edge_flags.xxxx & int4(1, 2, 4, 8); | |
bool4 edge_mask = bool4(_1022.x != int4(0, 0, 0, 0).x, _1022.y != int4(0, 0, 0, 0).y, _1022.z != int4(0, 0, 0, 0).z, _1022.w != int4(0, 0, 0, 0).w); | |
RectWithSize param_12 = segment_rect; | |
RectWithSize param_13 = ph.local_rect; | |
RectWithSize param_14 = ph.local_clip_rect; | |
float4 param_15 = float4(edge_mask.x ? 1.0f.xxxx.x : 0.0f.xxxx.x, edge_mask.y ? 1.0f.xxxx.y : 0.0f.xxxx.y, edge_mask.z ? 1.0f.xxxx.z : 0.0f.xxxx.z, edge_mask.w ? 1.0f.xxxx.w : 0.0f.xxxx.w); | |
float param_16 = ph.z; | |
Transform param_17 = transform; | |
PictureTask param_18 = pic_task; | |
VertexInfo _1044 = write_transform_vertex(param_12, param_13, param_14, param_15, param_16, param_17, param_18); | |
vi = _1044; | |
} | |
if (alpha_pass) | |
{ | |
float4 param_19 = vi.world_pos; | |
float2 param_20 = vi.snap_offset; | |
ClipArea param_21 = clip_area; | |
write_clip(param_19, param_20, param_21); | |
} | |
VertexInfo param_22 = vi; | |
int param_23 = ph.specific_prim_address; | |
RectWithSize param_24 = ph.local_rect; | |
RectWithSize param_25 = segment_rect; | |
int4 param_26 = int4(ph.user_data, segment_user_data); | |
float4x4 param_27 = transform.m; | |
PictureTask param_28 = pic_task; | |
int param_29 = brush_flags; | |
float4 param_30 = segment_data; | |
brush_vs(param_22, param_23, param_24, param_25, param_26, param_27, param_28, param_29, param_30); | |
gl_Position.y = -gl_Position.y; | |
} | |
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | |
{ | |
aPosition = stage_input.aPosition; | |
aData = stage_input.aData; | |
vert_main(); | |
SPIRV_Cross_Output stage_output; | |
stage_output.gl_Position = gl_Position; | |
stage_output.vTransformBounds = vTransformBounds; | |
stage_output.vClipMaskUvBounds = vClipMaskUvBounds; | |
stage_output.vClipMaskUv = vClipMaskUv; | |
stage_output.vLayerAndPerspective = vLayerAndPerspective; | |
stage_output.vUvSampleBounds = vUvSampleBounds; | |
stage_output.vUv = vUv; | |
stage_output.vUvBounds = vUvBounds; | |
stage_output.vTileRepeat = vTileRepeat; | |
stage_output.vMaskSwizzle = vMaskSwizzle; | |
stage_output.vColor = vColor; | |
stage_output.vLocalPos = vLocalPos; | |
return stage_output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment