17
17
namespace rx
18
18
{
19
19
20
- namespace BufferUtils_comp = vk::InternalShader::BufferUtils_comp;
21
20
namespace ConvertVertex_comp = vk::InternalShader::ConvertVertex_comp;
22
21
namespace ImageClear_frag = vk::InternalShader::ImageClear_frag;
23
22
namespace ImageCopy_frag = vk::InternalShader::ImageCopy_frag;
@@ -32,7 +31,6 @@ namespace
32
31
// All internal shaders assume there is only one descriptor set, indexed at 0
33
32
constexpr uint32_t kSetIndex = 0 ;
34
33
35
- constexpr uint32_t kBufferClearOutputBinding = 0 ;
36
34
constexpr uint32_t kConvertIndexDestinationBinding = 0 ;
37
35
constexpr uint32_t kConvertVertexDestinationBinding = 0 ;
38
36
constexpr uint32_t kConvertVertexSourceBinding = 1 ;
@@ -51,27 +49,6 @@ constexpr uint32_t kOverlayDrawGraphWidgetsBinding = 2;
51
49
constexpr uint32_t kOverlayDrawCulledWidgetsBinding = 3 ;
52
50
constexpr uint32_t kOverlayDrawFontBinding = 4 ;
53
51
54
- uint32_t GetBufferUtilsFlags (size_t dispatchSize, const vk::Format &format)
55
- {
56
- uint32_t flags = dispatchSize % 64 == 0 ? BufferUtils_comp::kIsAligned : 0 ;
57
- const angle::Format &bufferFormat = format.actualBufferFormat ();
58
-
59
- if (bufferFormat.isSint ())
60
- {
61
- flags |= BufferUtils_comp::kIsSint ;
62
- }
63
- else if (bufferFormat.isUint ())
64
- {
65
- flags |= BufferUtils_comp::kIsUint ;
66
- }
67
- else
68
- {
69
- flags |= BufferUtils_comp::kIsFloat ;
70
- }
71
-
72
- return flags;
73
- }
74
-
75
52
uint32_t GetConvertVertexFlags (const UtilsVk::ConvertVertexParameters ¶ms)
76
53
{
77
54
bool srcIsSint = params.srcFormat ->isSint ();
@@ -317,10 +294,6 @@ void UtilsVk::destroy(VkDevice device)
317
294
mDescriptorPools [f].destroy (device);
318
295
}
319
296
320
- for (vk::ShaderProgramHelper &program : mBufferUtilsPrograms )
321
- {
322
- program.destroy (device);
323
- }
324
297
for (vk::ShaderProgramHelper &program : mConvertIndexPrograms )
325
298
{
326
299
program.destroy (device);
@@ -417,21 +390,6 @@ angle::Result UtilsVk::ensureResourcesInitialized(ContextVk *contextVk,
417
390
return angle::Result::Continue;
418
391
}
419
392
420
- angle::Result UtilsVk::ensureBufferClearResourcesInitialized (ContextVk *contextVk)
421
- {
422
- if (mPipelineLayouts [Function::BufferClear].valid ())
423
- {
424
- return angle::Result::Continue;
425
- }
426
-
427
- VkDescriptorPoolSize setSizes[1 ] = {
428
- {VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1 },
429
- };
430
-
431
- return ensureResourcesInitialized (contextVk, Function::BufferClear, setSizes,
432
- ArraySize (setSizes), sizeof (BufferUtilsShaderParams));
433
- }
434
-
435
393
angle::Result UtilsVk::ensureConvertIndexResourcesInitialized (ContextVk *contextVk)
436
394
{
437
395
if (mPipelineLayouts [Function::ConvertIndexBuffer].valid ())
@@ -731,56 +689,6 @@ angle::Result UtilsVk::setupProgram(ContextVk *contextVk,
731
689
return angle::Result::Continue;
732
690
}
733
691
734
- angle::Result UtilsVk::clearBuffer (ContextVk *contextVk,
735
- vk::BufferHelper *dest,
736
- const ClearParameters ¶ms)
737
- {
738
- ANGLE_TRY (ensureBufferClearResourcesInitialized (contextVk));
739
-
740
- vk::CommandBuffer *commandBuffer;
741
- // Tell the context dest that we are writing to dest.
742
- ANGLE_TRY (contextVk->onBufferComputeShaderWrite (dest));
743
- ANGLE_TRY (contextVk->endRenderPassAndGetCommandBuffer (&commandBuffer));
744
-
745
- const vk::Format &destFormat = dest->getViewFormat ();
746
-
747
- uint32_t flags = BufferUtils_comp::kIsClear | GetBufferUtilsFlags (params.size , destFormat);
748
-
749
- BufferUtilsShaderParams shaderParams;
750
- shaderParams.destOffset = static_cast <uint32_t >(params.offset );
751
- shaderParams.size = static_cast <uint32_t >(params.size );
752
- shaderParams.clearValue = params.clearValue ;
753
-
754
- VkDescriptorSet descriptorSet;
755
- vk::RefCountedDescriptorPoolBinding descriptorPoolBinding;
756
- ANGLE_TRY (allocateDescriptorSet (contextVk, Function::BufferClear, &descriptorPoolBinding,
757
- &descriptorSet));
758
-
759
- VkWriteDescriptorSet writeInfo = {};
760
-
761
- writeInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
762
- writeInfo.dstSet = descriptorSet;
763
- writeInfo.dstBinding = kBufferClearOutputBinding ;
764
- writeInfo.descriptorCount = 1 ;
765
- writeInfo.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
766
- writeInfo.pTexelBufferView = dest->getBufferView ().ptr ();
767
-
768
- vkUpdateDescriptorSets (contextVk->getDevice (), 1 , &writeInfo, 0 , nullptr );
769
-
770
- vk::RefCounted<vk::ShaderAndSerial> *shader = nullptr ;
771
- ANGLE_TRY (contextVk->getShaderLibrary ().getBufferUtils_comp (contextVk, flags, &shader));
772
-
773
- ANGLE_TRY (setupProgram (contextVk, Function::BufferClear, shader, nullptr ,
774
- &mBufferUtilsPrograms [flags], nullptr , descriptorSet, &shaderParams,
775
- sizeof (shaderParams), commandBuffer));
776
-
777
- commandBuffer->dispatch (UnsignedCeilDivide (static_cast <uint32_t >(params.size ), 64 ), 1 , 1 );
778
-
779
- descriptorPoolBinding.reset ();
780
-
781
- return angle::Result::Continue;
782
- }
783
-
784
692
angle::Result UtilsVk::convertIndexBuffer (ContextVk *contextVk,
785
693
vk::BufferHelper *dest,
786
694
vk::BufferHelper *src,
0 commit comments