mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Note the descriptor set and binding in IO slot.
This commit is contained in:
parent
3173b0d711
commit
524ec504bb
@ -59,6 +59,8 @@ struct {{camel_case(shader_name)}}{{camel_case(shader_stage)}}Info {
|
||||
static constexpr auto kInput{{camel_case(stage_input.name)}} = ShaderStageIOSlot { // {{stage_input.name}}
|
||||
"{{stage_input.name}}", // name
|
||||
{{stage_input.location}}u, // attribute location
|
||||
{{stage_input.descriptor_set}}u, // attribute set
|
||||
{{stage_input.binding}}u, // attribute binding
|
||||
{{stage_input.type.type_name}}, // type
|
||||
{{stage_input.type.bit_width}}u, // bit width of type
|
||||
{{stage_input.type.vec_size}}u, // vec size
|
||||
@ -82,6 +84,8 @@ struct {{camel_case(shader_name)}}{{camel_case(shader_stage)}}Info {
|
||||
static constexpr auto kInput{{camel_case(sampled_image.name)}} = ShaderStageIOSlot { // {{sampled_image.name}}
|
||||
"{{sampled_image.name}}", // name
|
||||
{{sampled_image.location}}u, // attribute location
|
||||
{{sampled_image.descriptor_set}}u, // attribute set
|
||||
{{sampled_image.binding}}u, // attribute binding
|
||||
{{sampled_image.type.type_name}}, // type
|
||||
{{sampled_image.type.bit_width}}u, // bit width of type
|
||||
{{sampled_image.type.vec_size}}u, // vec size
|
||||
@ -97,6 +101,8 @@ struct {{camel_case(shader_name)}}{{camel_case(shader_stage)}}Info {
|
||||
static constexpr auto kOutput{{camel_case(stage_output.name)}} = ShaderStageIOSlot { // {{stage_output.name}}
|
||||
"{{stage_output.name}}", // name
|
||||
{{stage_output.location}}u, // attribute location
|
||||
{{stage_output.descriptor_set}}u, // attribute set
|
||||
{{stage_output.binding}}u, // attribute binding
|
||||
{{stage_output.type.type_name}}, // type
|
||||
{{stage_output.type.bit_width}}u, // bit width of type
|
||||
{{stage_output.type.vec_size}}u, // vec size
|
||||
|
||||
@ -33,13 +33,13 @@ EntityRenderer::EntityRenderer(std::string shaders_directory)
|
||||
VertexBufferBuilder<shader::BoxVertexInfo::PerVertexData> vertex_builder;
|
||||
vertex_builder.SetLabel("Box");
|
||||
vertex_builder.AddVertices({
|
||||
{{100, 100, 0.0}, {Color::Red()}}, // 1
|
||||
{{800, 100, 0.0}, {Color::Green()}}, // 2
|
||||
{{800, 800, 0.0}, {Color::Blue()}}, // 3
|
||||
{{100, 100, 0.0}, {Color::Red()}, {0.0, 0.0}}, // 1
|
||||
{{800, 100, 0.0}, {Color::Green()}, {1.0, 0.0}}, // 2
|
||||
{{800, 800, 0.0}, {Color::Blue()}, {1.0, 1.0}}, // 3
|
||||
|
||||
{{100, 100, 0.0}, {Color::Cyan()}}, // 1
|
||||
{{800, 800, 0.0}, {Color::White()}}, // 3
|
||||
{{100, 800, 0.0}, {Color::Purple()}}, // 4
|
||||
{{100, 100, 0.0}, {Color::Cyan()}, {0.0, 0.0}}, // 1
|
||||
{{800, 800, 0.0}, {Color::White()}, {1.0, 1.0}}, // 3
|
||||
{{100, 800, 0.0}, {Color::Purple()}, {0.0, 1.0}}, // 4
|
||||
});
|
||||
|
||||
vertex_buffer_ =
|
||||
@ -76,13 +76,13 @@ bool EntityRenderer::OnRender(const Surface& surface, RenderPass& pass) {
|
||||
pass.GetTransientsBuffer().EmplaceUniform(uniforms);
|
||||
|
||||
cmd.fragment_bindings
|
||||
.samplers[shader::BoxFragmentInfo::kInputContents1.location] =
|
||||
.samplers[shader::BoxFragmentInfo::kInputContents1.binding] =
|
||||
GetContext()->GetSamplerLibrary()->GetSampler({});
|
||||
cmd.fragment_bindings
|
||||
.samplers[shader::BoxFragmentInfo::kInputContents2.location] =
|
||||
.samplers[shader::BoxFragmentInfo::kInputContents2.binding] =
|
||||
GetContext()->GetSamplerLibrary()->GetSampler({});
|
||||
cmd.fragment_bindings
|
||||
.samplers[shader::BoxFragmentInfo::kInputContents3.location] =
|
||||
.samplers[shader::BoxFragmentInfo::kInputContents3.binding] =
|
||||
GetContext()->GetSamplerLibrary()->GetSampler({});
|
||||
|
||||
cmd.index_buffer = vertex_buffer_.index_buffer;
|
||||
|
||||
@ -50,6 +50,8 @@ struct ShaderUniformSlot {
|
||||
struct ShaderStageIOSlot {
|
||||
const char* name;
|
||||
size_t location;
|
||||
size_t set;
|
||||
size_t binding;
|
||||
ShaderType type;
|
||||
size_t bit_width;
|
||||
size_t vec_size;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user