34 static char PUSH_CONSTANTS_FALLBACK_NAME[] =
"push_constants_fallback";
35 static size_t PUSH_CONSTANTS_FALLBACK_NAME_LEN = strlen(PUSH_CONSTANTS_FALLBACK_NAME);
36 static char SUBPASS_FALLBACK_NAME[] =
"gpu_subpass_img_0";
37 static size_t SUBPASS_FALLBACK_NAME_LEN = strlen(SUBPASS_FALLBACK_NAME);
40 shader_builtins_ =
info.builtins_;
50 all_resources.
extend(
info.geometry_resources_);
53 switch (res.bind_type) {
54 case ShaderCreateInfo::Resource::BindType::IMAGE:
55 case ShaderCreateInfo::Resource::BindType::SAMPLER:
58 case ShaderCreateInfo::Resource::BindType::UNIFORM_BUFFER:
61 case ShaderCreateInfo::Resource::BindType::STORAGE_BUFFER:
71 size_t names_size =
info.interface_names_size_;
76 names_size += PUSH_CONSTANTS_FALLBACK_NAME_LEN + 1;
78 names_size +=
info.subpass_inputs_.size() * SUBPASS_FALLBACK_NAME_LEN;
91 if (
input->location != -1) {
103 if (res.bind_type == ShaderCreateInfo::Resource::BindType::UNIFORM_BUFFER) {
110 int32_t push_constants_fallback_location = -1;
120 input->location =
input->binding = subpass_in.index;
124 if (res.bind_type == ShaderCreateInfo::Resource::BindType::SAMPLER) {
129 else if (res.bind_type == ShaderCreateInfo::Resource::BindType::IMAGE) {
137 int32_t push_constant_location = 1024;
140 input->location = push_constant_location++;
147 if (res.bind_type == ShaderCreateInfo::Resource::BindType::STORAGE_BUFFER) {
155 if (res.bind_type == ShaderCreateInfo::Resource::BindType::STORAGE_BUFFER) {
159 BLI_assert_msg(0,
"Resource type is not supported for Geometry frequency");
167 input->location = constant_id++;
189 const uint32_t resources_len = input_tot_len;
192 init_descriptor_set_layout_info(
info, resources_len, all_resources, push_constants_storage_type);
196 resource_bindings_.fill({});
207 descriptor_set_location_update(
input,
217 if (res.bind_type == ShaderCreateInfo::Resource::BindType::IMAGE) {
218 arrayed =
ELEM(res.image.type,
219 shader::ImageType::Float1DArray,
220 shader::ImageType::Float2DArray,
221 shader::ImageType::FloatCubeArray,
222 shader::ImageType::Int1DArray,
223 shader::ImageType::Int2DArray,
224 shader::ImageType::IntCubeArray,
225 shader::ImageType::Uint1DArray,
226 shader::ImageType::Uint2DArray,
227 shader::ImageType::UintCubeArray,
228 shader::ImageType::AtomicUint2DArray,
229 shader::ImageType::AtomicInt2DArray) ?
233 else if (res.bind_type == ShaderCreateInfo::Resource::BindType::SAMPLER) {
234 arrayed =
ELEM(res.sampler.type,
235 shader::ImageType::Float1DArray,
236 shader::ImageType::Float2DArray,
237 shader::ImageType::FloatCubeArray,
238 shader::ImageType::Int1DArray,
239 shader::ImageType::Int2DArray,
240 shader::ImageType::IntCubeArray,
241 shader::ImageType::Uint1DArray,
242 shader::ImageType::Uint2DArray,
243 shader::ImageType::UintCubeArray,
244 shader::ImageType::Shadow2DArray,
245 shader::ImageType::ShadowCubeArray,
246 shader::ImageType::Depth2DArray,
247 shader::ImageType::DepthCubeArray,
248 shader::ImageType::AtomicUint2DArray,
249 shader::ImageType::AtomicInt2DArray) ?
260 int32_t push_constant_descriptor_set_location = -1;
264 descriptor_set_location_update(push_constant_input,
265 push_constants_fallback_location,
270 push_constants_layout_.
init(
271 info, *
this, push_constants_storage_type, push_constant_descriptor_set_location);