Vulkan: Push constants #104880
|
@ -205,8 +205,6 @@ class VKPushConstants : NonCopyable {
|
||||||
*
|
*
|
||||||
* TODO: this function still needs to convert the input_data layout to that
|
* TODO: this function still needs to convert the input_data layout to that
|
||||||
* what the storage type is expected.
|
* what the storage type is expected.
|
||||||
* TODO: Current implementation has a work around for missing implementation
|
|
||||||
* of builtin uniforms. Builtin uniforms should eventually also be supported.
|
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void push_constant_set(int32_t location,
|
void push_constant_set(int32_t location,
|
||||||
|
@ -216,11 +214,7 @@ class VKPushConstants : NonCopyable {
|
||||||
{
|
{
|
||||||
const VKPushConstantsLayout::PushConstantLayout *push_constant_layout = layout_->find(
|
const VKPushConstantsLayout::PushConstantLayout *push_constant_layout = layout_->find(
|
||||||
location);
|
location);
|
||||||
if (push_constant_layout == nullptr) {
|
BLI_assert(push_constant_layout);
|
||||||
/* TODO: Currently the builtin uniforms are set using a predefined location each time a
|
|
||||||
* shader is bound. This needs to be fixed in the VKShaderInterface.*/
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BLI_assert_msg(push_constant_layout->offset + comp_len * array_size * sizeof(T) <=
|
BLI_assert_msg(push_constant_layout->offset + comp_len * array_size * sizeof(T) <=
|
||||||
layout_->size_in_bytes(),
|
layout_->size_in_bytes(),
|
||||||
"Tried to write outside the push constant allocated memory.");
|
"Tried to write outside the push constant allocated memory.");
|
||||||
|
|
|
@ -116,6 +116,20 @@ void VKShaderInterface::init(const shader::ShaderCreateInfo &info)
|
||||||
|
|
||||||
sort_inputs();
|
sort_inputs();
|
||||||
|
|
||||||
|
/* Builtin Uniforms */
|
||||||
|
for (int32_t u_int = 0; u_int < GPU_NUM_UNIFORMS; u_int++) {
|
||||||
|
GPUUniformBuiltin u = static_cast<GPUUniformBuiltin>(u_int);
|
||||||
|
const ShaderInput *uni = this->uniform_get(builtin_uniform_name(u));
|
||||||
|
builtins_[u] = (uni != nullptr) ? uni->location : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Builtin Uniforms Blocks */
|
||||||
|
for (int32_t u_int = 0; u_int < GPU_NUM_UNIFORM_BLOCKS; u_int++) {
|
||||||
|
GPUUniformBlockBuiltin u = static_cast<GPUUniformBlockBuiltin>(u_int);
|
||||||
|
const ShaderInput *block = this->ubo_get(builtin_uniform_block_name(u));
|
||||||
|
builtin_blocks_[u] = (block != nullptr) ? block->binding : -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Determine the descriptor set locations after the inputs have been sorted.*/
|
/* Determine the descriptor set locations after the inputs have been sorted.*/
|
||||||
descriptor_set_locations_ = Array<VKDescriptorSet::Location>(input_tot_len);
|
descriptor_set_locations_ = Array<VKDescriptorSet::Location>(input_tot_len);
|
||||||
uint32_t descriptor_set_location = 0;
|
uint32_t descriptor_set_location = 0;
|
||||||
|
|
Loading…
Reference in New Issue