Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Vulkan: Fix wrong descriptor set indices when binding descrip… #2215

Merged
merged 1 commit into from
Sep 14, 2018
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
20 changes: 3 additions & 17 deletions gapil/analysis/reference_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,8 @@ func (v *ReferenceValue) Clone() Value {
func (v *ReferenceValue) field(s *scope, name string) Value {
candidates := make([]Value, 0, len(v.Assignments))
for a := range v.Assignments {
// Check the assignment has an instance. No instance can happen when the
// assignment took place in a sibling block which has not been merged
// into the common scope yet.
// In this particular case, the instance is inaccessible to this block,
// so skipping it is the correct thing to do.
if fh, ok := s.getInstance(a).(fieldHolder); ok {
field := fh.field(s, name)
candidates = append(candidates, field)
}
field := s.getInstance(a).(fieldHolder).field(s, name)
candidates = append(candidates, field)
}
if len(candidates) == 0 {
return v.Unknown.(fieldHolder).field(s, name)
Expand All @@ -191,14 +184,7 @@ func (v *ReferenceValue) field(s *scope, name string) Value {
// in the scope's instances map.
func (v *ReferenceValue) setField(s *scope, name string, val Value) Value {
for a := range v.Assignments {
// Check the assignment has an instance. No instance can happen when the
// assignment took place in a sibling block which has not been merged
// into the common scope yet.
// In this particular case, the instance is inaccessible to this block,
// so skipping it is the correct thing to do.
if fh, ok := s.getInstance(a).(fieldHolder); ok {
s.instances[a] = fh.setField(s, name, val)
}
s.instances[a] = s.getInstance(a).(fieldHolder).setField(s, name, val)
}
return v
}
33 changes: 27 additions & 6 deletions gapis/api/vulkan/api/descriptor.api
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ emptyBufferOffsets {
}

sub void dovkCmdBindDescriptorSets(ref!vkCmdBindDescriptorSetsArgs args) {
_ = PipelineLayouts[args.Layout]
_ = PipelineLayouts[args.Layout]
dynamic_offset_index := MutableU32(0)

computeInfo := lastComputeInfo()
Expand All @@ -704,7 +704,6 @@ sub void dovkCmdBindDescriptorSets(ref!vkCmdBindDescriptorSetsArgs args) {
set := args.DescriptorSets[as!u32(i)]
setObj := DescriptorSets[set]
currentDescriptorSets[args.FirstSet + as!u32(i)] = DescriptorSets[set]
desc_set_buf_offsets := bufferBindingOffsets[as!u32(i)+args.FirstSet]
hasBeenRead := switch (set in ProcessedDescriptorSets.val) {
case true:
MutableBool(true)
Expand All @@ -724,7 +723,6 @@ sub void dovkCmdBindDescriptorSets(ref!vkCmdBindDescriptorSetsArgs args) {
// of the Bindings in order of the binding number.
for j in (0 .. setObj.Layout.MaximumBinding + 1) {
if j in setObj.Bindings {
desc_binding_buf_offsets := desc_set_buf_offsets[as!u32(j)]
binding := setObj.Bindings[j]
for k in (0 .. len(binding.BufferBinding)) {
bufferBinding := binding.BufferBinding[as!u32(k)]
Expand All @@ -741,7 +739,6 @@ sub void dovkCmdBindDescriptorSets(ref!vkCmdBindDescriptorSetsArgs args) {
default:
dynamic_offset_index.Val
}
desc_binding_buf_offsets[as!u32(k)] = binding_offset

// If the offset has changed, then we may have to reprocess this
// descriptor set.
Expand All @@ -758,13 +755,37 @@ sub void dovkCmdBindDescriptorSets(ref!vkCmdBindDescriptorSetsArgs args) {
oldSets := ProcessedDescriptorSets.val[set].bufferOffsets
ProcessedDescriptorSets.val[set] =
ProcessedDescriptorSet(oldSets, true)

}
}
bufferBindingOffsets[as!u32(i)][as!u32(j)][as!u32(k)] = binding_offset
if (bufferBinding.Buffer in Buffers) {
bufferObject := Buffers[bufferBinding.Buffer]
readMemoryInBuffer(bufferObject, binding_offset, bufferBinding.Range)
}
}
for k in (0 .. len(binding.BufferViewBindings)) {
buffer_view := binding.BufferViewBindings[as!u32(k)]
if (buffer_view != as!VkBufferView(0)) {
buffer_view_object := BufferViews[buffer_view]
readMemoryInBuffer(buffer_view_object.Buffer, buffer_view_object.Offset, buffer_view_object.Range)
}
}
for k in (0 .. len(binding.ImageBinding)) {
imageBinding := binding.ImageBinding[as!u32(k)]
_ = Samplers[imageBinding.Sampler]
if (imageBinding.ImageView != as!VkImageView(0)) {
if imageBinding.ImageView in ImageViews {
imageViewObj := ImageViews[imageBinding.ImageView]
imageObj := imageViewObj.Image
rng := imageViewObj.SubresourceRange
readImageSubresource(imageObj, rng)
updateImageQueue(imageObj, rng)
}
}
}
desc_set_buf_offsets[as!u32(j)] = desc_binding_buf_offsets
}
}
bufferBindingOffsets[as!u32(i)+args.FirstSet] = desc_set_buf_offsets
}
}
}
Expand Down