63 if (visited_bindings[
attribute.binding]) {
66 visited_bindings[
attribute.binding].set(
true);
69 VkDeviceSize offset = 0;
122 if (occupied_attributes !=
interface.enabled_attr_mask_) {
123 fill_unused_bindings(interface, occupied_attributes);
178void VKVertexAttributeObject::fill_unused_bindings(
const VKShaderInterface &
interface,
184 if (occupied_attributes & location_mask) {
188 if ((interface.enabled_attr_mask_ & location_mask) == 0) {
193 shader::Type attribute_type = interface.get_attribute_type(location);
195 for (
const uint32_t location_offset : IndexRange(num_locations)) {
197 VkVertexInputAttributeDescription attribute_description = {};
198 attribute_description.binding = binding;
199 attribute_description.location = location + location_offset;
200 attribute_description.offset = 0;
201 attribute_description.format =
to_vk_format(attribute_type);
204 VkVertexInputBindingDescription vk_binding_descriptor = {};
205 vk_binding_descriptor.binding = binding;
206 vk_binding_descriptor.stride = 0;
207 vk_binding_descriptor.inputRate = VK_VERTEX_INPUT_RATE_INSTANCE;
208 bindings.append(vk_binding_descriptor);
237 const bool use_instancing)
239 BLI_assert(vertex_buffer || immediate_vertex_buffer);
240 BLI_assert(!(vertex_buffer && immediate_vertex_buffer));
252 bool add_vbo =
false;
254 for (
uint32_t attribute_index = 0; attribute_index < vertex_format.
attr_len; attribute_index++) {
257 buffer_offset += ((attribute_index == 0) ? 0 :
258 vertex_format.
attrs[attribute_index - 1].
size) *
268 const ShaderInput *shader_input = interface.
attr_get(name);
269 if (shader_input ==
nullptr || shader_input->location == -1) {
275 if (r_occupied_attributes & attribute_mask) {
278 r_occupied_attributes |= attribute_mask;
280 for (
const uint32_t location_offset : IndexRange(num_locations)) {
282 VkVertexInputAttributeDescription attribute_description = {};
283 attribute_description.binding = binding;
284 attribute_description.location = shader_input->location + location_offset;
285 attribute_description.offset = attribute_offset + location_offset *
sizeof(
float4);
292 VkVertexInputBindingDescription vk_binding_descriptor = {};
293 vk_binding_descriptor.binding = binding;
294 vk_binding_descriptor.stride = stride;
295 vk_binding_descriptor.inputRate = use_instancing ? VK_VERTEX_INPUT_RATE_INSTANCE :
296 VK_VERTEX_INPUT_RATE_VERTEX;
297 bindings.append(vk_binding_descriptor);
303 if (immediate_vertex_buffer) {
304 buffers.append(*immediate_vertex_buffer);
312 vbos.append(vertex_buffer);
324 std::cout << __FILE__ <<
"::" << __func__ <<
"\n";
328 std::cout <<
" - attribute(binding=" <<
attribute.binding
329 <<
", location=" <<
attribute.location <<
")";
331 if (visited_bindings[
attribute.binding]) {
332 std::cout <<
" WARNING: Already bound\n";
335 visited_bindings[
attribute.binding].set(
true);
338 std::cout <<
" Attach to Buffer\n";
341 std::cout <<
" WARNING: Attach to dummy\n";
MINLINE int max_ii(int a, int b)
#define GPU_BATCH_INST_VBO_MAX_LEN
#define GPU_BATCH_VBO_MAX_LEN
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
ATTR_WARN_UNUSED_RESULT const BMVert * v
const ShaderInput * attr_get(const char *name) const
VkBuffer vk_handle() const
Vector< VKBufferWithOffset > buffers
VKVertexAttributeObject()
VKVertexAttributeObject & operator=(const VKVertexAttributeObject &other)
Vector< VkVertexInputAttributeDescription > attributes
void update_bindings(const VKContext &context, VKBatch &batch)
VkPipelineVertexInputStateCreateInfo info
Vector< VkVertexInputBindingDescription > bindings
void bind(render_graph::VKVertexBufferBindings &r_vertex_buffer_bindings) const
Vector< VKVertexBuffer * > vbos
const GPUVertFormat & device_format_get() const
void device_format_ensure()
VkBuffer vk_handle() const
struct @157336070235062372277311340362362342103123126032::@262166344314164341202215145112231240022370055142 batch
static Context * unwrap(GPUContext *ctx)
VkFormat to_vk_format(const eGPUTextureFormat format)
static uint32_t to_binding_location_len(const GPUVertAttr &attribute)
VecBase< float, 4 > float4
constexpr IntT ceil_division(const IntT x, const IntT y)