Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion impeller/compiler/code_gen_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct {{camel_case(shader_name)}}{{camel_case(shader_stage)}}Shader {
{{stage_input.type.vec_size}}u, // vec size
{{stage_input.type.columns}}u, // number of columns
{{stage_input.offset}}u, // offset for interleaved layout
{{stage_input.relaxed_precision}}, // relaxed precision
};
{% endfor %}
{% endif %}
Expand Down Expand Up @@ -140,7 +141,9 @@ struct {{camel_case(shader_name)}}{{camel_case(shader_stage)}}Shader {
{{stage_output.type.type_name}}, // type
{{stage_output.type.bit_width}}u, // bit width of type
{{stage_output.type.vec_size}}u, // vec size
{{stage_output.type.columns}}u // number of columns
{{stage_output.type.columns}}u, // number of columns
{{stage_output.offset}}u, // offset for interleaved layout
{{stage_output.relaxed_precision}}, // relaxed precision
};
{% endfor %}
static constexpr std::array<const ShaderStageIOSlot*, {{length(stage_outputs)}}> kAllShaderStageOutputs = {
Expand Down
5 changes: 4 additions & 1 deletion impeller/compiler/reflector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -655,12 +655,15 @@ std::optional<nlohmann::json::object_t> Reflector::ReflectResource(
CompilerBackend::ExtendedResourceIndex::kPrimary, resource.id);
result["ext_res_1"] = compiler_.GetExtendedMSLResourceBinding(
CompilerBackend::ExtendedResourceIndex::kSecondary, resource.id);
result["relaxed_precision"] =
compiler_->get_decoration(
resource.id, spv::Decoration::DecorationRelaxedPrecision) == 1;
result["offset"] = offset.value_or(0u);
auto type = ReflectType(resource.type_id);
if (!type.has_value()) {
return std::nullopt;
}
result["type"] = std::move(type.value());
result["offset"] = offset.value_or(0u);
return result;
}

Expand Down
23 changes: 13 additions & 10 deletions impeller/core/shader_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,25 @@ struct ShaderStageIOSlot {
size_t vec_size;
size_t columns;
size_t offset;
bool relaxed_precision;

constexpr size_t GetHash() const {
return fml::HashCombine(name, location, set, binding, type, bit_width,
vec_size, columns, offset);
vec_size, columns, offset, relaxed_precision);
}

constexpr bool operator==(const ShaderStageIOSlot& other) const {
return name == other.name && //
location == other.location && //
set == other.set && //
binding == other.binding && //
type == other.type && //
bit_width == other.bit_width && //
vec_size == other.vec_size && //
columns == other.columns && //
offset == other.offset;
return name == other.name && //
location == other.location && //
set == other.set && //
binding == other.binding && //
type == other.type && //
bit_width == other.bit_width && //
vec_size == other.vec_size && //
columns == other.columns && //
offset == other.offset && //
relaxed_precision == other.relaxed_precision //
;
}
};

Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/shaders/blending/porter_duff_blend.vert
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ in vec2 vertices;
in vec2 texture_coords;
in vec4 color;

out vec2 v_texture_coords;
out mediump vec2 v_texture_coords;
out mediump f16vec4 v_color;

void main() {
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/shaders/blending/vertices_uber.frag
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ frag_info;

uniform f16sampler2D texture_sampler;

in highp vec2 v_texture_coords;
in mediump vec2 v_texture_coords;
in mediump f16vec4 v_color;

out f16vec4 frag_color;
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/shaders/texture_uv_fill.vert
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ frame_info;

in vec2 position;

out vec2 v_texture_coords;
out mediump vec2 v_texture_coords;

void main() {
gl_Position = frame_info.mvp * vec4(position, 0.0, 1.0);
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/shaders/tiled_texture_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ uniform FragInfo {
}
frag_info;

in highp vec2 v_texture_coords;
in mediump vec2 v_texture_coords;

out f16vec4 frag_color;

Expand Down
3 changes: 2 additions & 1 deletion impeller/renderer/shader_stage_compatibility_checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class ShaderStageCompatibilityChecker {
input_slot->bit_width != output_slot->bit_width ||
input_slot->vec_size != output_slot->vec_size ||
input_slot->columns != output_slot->columns ||
input_slot->offset != output_slot->offset) {
input_slot->offset != output_slot->offset ||
input_slot->relaxed_precision != output_slot->relaxed_precision) {
Comment on lines +50 to +51
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks

return false;
}
}
Expand Down
42 changes: 21 additions & 21 deletions impeller/tools/malioc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3628,9 +3628,9 @@
"load_store"
],
"longest_path_cycles": [
0.109375,
0.015625,
0.015625,
0.015625,
0.109375,
0.0,
4.0,
0.0
Expand All @@ -3647,9 +3647,9 @@
"load_store"
],
"shortest_path_cycles": [
0.109375,
0.015625,
0.015625,
0.015625,
0.109375,
0.0,
4.0,
0.0
Expand All @@ -3658,9 +3658,9 @@
"load_store"
],
"total_cycles": [
0.109375,
0.015625,
0.015625,
0.015625,
0.109375,
0.0,
4.0,
0.0
Expand Down Expand Up @@ -5321,7 +5321,7 @@
"longest_path_cycles": [
0.078125,
0.078125,
0.015625,
0.078125,
0.0,
3.0,
0.0
Expand All @@ -5340,7 +5340,7 @@
"shortest_path_cycles": [
0.078125,
0.078125,
0.015625,
0.078125,
0.0,
3.0,
0.0
Expand All @@ -5351,7 +5351,7 @@
"total_cycles": [
0.078125,
0.078125,
0.015625,
0.078125,
0.0,
3.0,
0.0
Expand All @@ -5360,7 +5360,7 @@
"stack_spill_bytes": 0,
"thread_occupancy": 100,
"uniform_registers_used": 16,
"work_registers_used": 9
"work_registers_used": 8
}
}
},
Expand Down Expand Up @@ -6605,9 +6605,9 @@
"load_store"
],
"longest_path_cycles": [
0.078125,
0.015625,
0.015625,
0.015625,
0.078125,
0.0,
4.0,
0.0
Expand All @@ -6624,9 +6624,9 @@
"load_store"
],
"shortest_path_cycles": [
0.078125,
0.015625,
0.015625,
0.015625,
0.078125,
0.0,
4.0,
0.0
Expand All @@ -6635,9 +6635,9 @@
"load_store"
],
"total_cycles": [
0.078125,
0.015625,
0.015625,
0.015625,
0.078125,
0.0,
4.0,
0.0
Expand All @@ -6646,7 +6646,7 @@
"stack_spill_bytes": 0,
"thread_occupancy": 100,
"uniform_registers_used": 22,
"work_registers_used": 9
"work_registers_used": 8
}
}
}
Expand Down Expand Up @@ -7840,7 +7840,7 @@
"longest_path_cycles": [
0.078125,
0.078125,
0.015625,
0.078125,
0.0,
3.0,
0.0
Expand All @@ -7859,7 +7859,7 @@
"shortest_path_cycles": [
0.078125,
0.078125,
0.015625,
0.078125,
0.0,
3.0,
0.0
Expand All @@ -7870,7 +7870,7 @@
"total_cycles": [
0.078125,
0.078125,
0.015625,
0.078125,
0.0,
3.0,
0.0
Expand All @@ -7879,7 +7879,7 @@
"stack_spill_bytes": 0,
"thread_occupancy": 100,
"uniform_registers_used": 32,
"work_registers_used": 9
"work_registers_used": 8
}
}
}
Expand Down