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

wip: new descriptor set backend API #7737

Closed
wants to merge 81 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
f11a047
new descriptor set api
pixelflinger Jun 7, 2024
29ecfd5
generate the proper per-view descriptor-set layout in the shader
pixelflinger Jun 7, 2024
38a3c52
vk: build new descriptor set framework
pixelflinger May 24, 2024
ac7c679
Merge branch 'main' into ma/descriptor-sets
bejado Jun 18, 2024
9fb692b
Merge branch 'main' into ma/descriptor-sets
pixelflinger Jun 18, 2024
9a1ee1f
fix bad merge
pixelflinger Jun 18, 2024
e40a4c6
Merge branch 'main' into ma/descriptor-sets
pixelflinger Jun 21, 2024
2e76314
MetalArgumentBuffer support buffers
bejado May 29, 2024
e75882e
Update MetalArgumentBuffer to support buffers
bejado May 31, 2024
1612cdb
WIP: Implement Metal descriptor sets
bejado Jun 3, 2024
26bb99c
Pass descriptor set info to spirvToMsl more concicely
bejado Jun 24, 2024
80f151c
Merge branch 'main' into ma/descriptor-sets
pixelflinger Jun 24, 2024
a0dc710
fix backend tests
pixelflinger Jun 25, 2024
b4162eb
fix windows build
pixelflinger Jun 25, 2024
7e0181b
Merge remote-tracking branch 'origin/main' into ma/descriptor-sets
bejado Jun 26, 2024
07f07e0
Remove log spew
bejado Jun 27, 2024
c12bcbb
Bind the actual resource at updateDescriptorSet time
bejado Jun 25, 2024
929ad27
Pass the correct stage flags
bejado Jun 25, 2024
38b3074
Fix validation error, bind descriptor sets at bind time
bejado Jun 28, 2024
c19785b
Merge branch 'main' into ma/descriptor-sets
bejado Jun 28, 2024
315c8d7
vk: repair transmission + MSAA
pixelflinger Jun 28, 2024
d2cb53e
add minimal support for Texture Views in the backends
pixelflinger Jun 28, 2024
daa2790
Merge branch 'main' into ma/descriptor-sets
pixelflinger Jun 28, 2024
d299b1f
Merge branch 'main' into ma/descriptor-sets
pixelflinger Jun 28, 2024
fef40a8
Merge branch 'main' into ma/descriptor-sets
pixelflinger Jul 19, 2024
d8580d9
New external image API (#7981)
bejado Jul 23, 2024
41e1e7e
Merge branch 'main' into ma/descriptor-sets
pixelflinger Jul 24, 2024
cba819b
Merge branch 'main' into ma/descriptor-sets
pixelflinger Jul 26, 2024
189e36d
Merge branch 'main' into ma/descriptor-sets
poweifeng Jul 31, 2024
bb1f58e
Fix broken merge for vk (#8007)
poweifeng Jul 31, 2024
f04a250
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 2, 2024
8797f45
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 8, 2024
bd0ca7a
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 9, 2024
111be6e
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 9, 2024
9401d6b
fix warning about missing case
pixelflinger Aug 12, 2024
a1f146e
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 12, 2024
3b12e54
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 12, 2024
8fe7c1f
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 15, 2024
d073fb5
Implement external images / descriptor sets for Metal
bejado Aug 16, 2024
32ac101
Move morphing buffer offset out of pipeline check (#8047)
poweifeng Aug 16, 2024
d9bf68e
vk: fix missing read-after-write barrier (#8046)
poweifeng Aug 16, 2024
c0819b7
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 16, 2024
a37d031
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 19, 2024
5c08f34
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 19, 2024
f098d08
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 20, 2024
b6d6f8f
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 20, 2024
c780804
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 21, 2024
cab5fc5
GLDescriptorSet: less restrictive size assert (#8070)
poweifeng Aug 21, 2024
21d93ce
Fix missing duplication of descriptor set in material instance (#8068)
poweifeng Aug 21, 2024
02bdddf
fix a too aggressive assert
pixelflinger Aug 21, 2024
bbb4521
Fix, assertion when an external image is used but not yet set (#8073)
bejado Aug 21, 2024
c6c20df
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 24, 2024
c3ea1e4
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 28, 2024
d161ef2
Update createTextureView API to include swizzling, implement on Metal…
bejado Aug 28, 2024
6de6a21
implement createTextureViewSwizzled() in the GL backend
pixelflinger Aug 28, 2024
73b0be7
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 30, 2024
e95f0ed
vk: implement createTextureViewSwizzled()
poweifeng Aug 29, 2024
fad5d57
vk: properly compose swizzle
poweifeng Aug 30, 2024
6790a12
fix webgl build
pixelflinger Aug 30, 2024
3a2333d
Merge branch 'main' into ma/descriptor-sets
pixelflinger Aug 30, 2024
cf0cb66
Merge branch 'main' into ma/descriptor-sets
pixelflinger Sep 3, 2024
6a64cdb
fix build due to a bad merge
pixelflinger Sep 3, 2024
15d77ed
Metal: respect the shader stage for each descriptor
bejado Sep 5, 2024
3aeee16
Merge branch 'main' into ma/descriptor-sets
pixelflinger Sep 7, 2024
91ce3a9
Smaller empty buffer
bejado Sep 6, 2024
f6d9db1
Better DEBUG_LOG
bejado Sep 7, 2024
c538bde
Get rid of unused MetalSamplerGroup and related code
bejado Sep 9, 2024
efb94da
Remove deprecated driver APIS
bejado Sep 9, 2024
c0b1daf
MetalDescriptorSet move implementation into MetalHandles.mm
bejado Sep 9, 2024
8e30b1b
Rename toString
bejado Sep 9, 2024
99b3587
Update comment
bejado Sep 9, 2024
f4cd9f7
GLSLPostProcessor clean up, remove magic numbers
bejado Sep 9, 2024
e3cb670
Remove some more magic numbers
bejado Sep 10, 2024
8f979da
Merge branch 'main' into ma/descriptor-sets
pixelflinger Sep 10, 2024
22e62b9
disable compute test to fix build
pixelflinger Sep 10, 2024
1596a5e
vk: Fix descriptor set bitmask padding
poweifeng Sep 10, 2024
37d1baf
Metal debug logging improvements
bejado Sep 10, 2024
6397fa3
Fix a crash for color grading (#8118)
z3moon Sep 12, 2024
f37d8b2
vk: refactor descriptor bitmask to use bitset
poweifeng Sep 11, 2024
c01d2c0
vk: reduce map look-up in descriptor set hot loop
poweifeng Sep 11, 2024
69d5ac2
Check for invalid texture inside MaterialInstance
bejado Sep 10, 2024
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
22 changes: 15 additions & 7 deletions filament/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ set(SRCS
src/MaterialInstance.cpp
src/MaterialParser.cpp
src/MorphTargetBuffer.cpp
src/PerViewUniforms.cpp
src/PerShadowMapUniforms.cpp
src/PostProcessManager.cpp
src/RenderPass.cpp
src/RenderPrimitive.cpp
Expand Down Expand Up @@ -126,6 +124,12 @@ set(SRCS
src/details/Texture.cpp
src/details/VertexBuffer.cpp
src/details/View.cpp
src/ds/ColorPassDescriptorSet.cpp
src/ds/DescriptorSet.cpp
src/ds/DescriptorSetLayout.cpp
src/ds/PostProcessDescriptorSet.cpp
src/ds/ShadowMapDescriptorSet.cpp
src/ds/SsrPassDescriptorSet.cpp
src/fg/Blackboard.cpp
src/fg/DependencyGraph.cpp
src/fg/FrameGraph.cpp
Expand Down Expand Up @@ -153,19 +157,16 @@ set(PRIVATE_HDRS
src/HwVertexBufferInfoFactory.h
src/Intersections.h
src/MaterialParser.h
src/PerViewUniforms.h
src/PerShadowMapUniforms.h
src/PIDController.h
src/PostProcessManager.h
src/RendererUtils.h
src/RenderPass.h
src/RenderPrimitive.h
src/RendererUtils.h
src/ResourceAllocator.h
src/ResourceList.h
src/ShadowMap.h
src/ShadowMapManager.h
src/SharedHandle.h
src/TypedUniformBuffer.h
src/UniformBuffer.h
src/components/CameraManager.h
src/components/LightManager.h
Expand Down Expand Up @@ -193,6 +194,14 @@ set(PRIVATE_HDRS
src/details/Texture.h
src/details/VertexBuffer.h
src/details/View.h
src/downcast.h
src/ds/ColorPassDescriptorSet.h
src/ds/DescriptorSetLayout.h
src/ds/PostProcessDescriptorSet.h
src/ds/ShadowMapDescriptorSet.h
src/ds/SsrPassDescriptorSet.h
src/ds/TypedBuffer.h
src/ds/TypedUniformBuffer.h
src/fg/Blackboard.h
src/fg/FrameGraph.h
src/fg/FrameGraphId.h
Expand All @@ -210,7 +219,6 @@ set(PRIVATE_HDRS
src/materials/fsr/ffx_a.h
src/materials/fsr/ffx_fsr1.h
src/materials/fsr/ffx_fsr1_mobile.fs
src/downcast.h
)

set(MATERIAL_SRCS
Expand Down
38 changes: 30 additions & 8 deletions filament/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(PUBLIC_HDRS
include/backend/AcquiredImage.h
include/backend/BufferDescriptor.h
include/backend/CallbackHandler.h
include/backend/DescriptorSetOffsetArray.h
include/backend/DriverApiForward.h
include/backend/DriverEnums.h
include/backend/Handle.h
Expand Down Expand Up @@ -69,9 +70,13 @@ set(PRIVATE_HDRS
if (FILAMENT_SUPPORTS_OPENGL AND NOT FILAMENT_USE_EXTERNAL_GLES3)
list(APPEND SRCS
include/backend/platforms/OpenGLPlatform.h
src/opengl/BindingMap.h
src/opengl/gl_headers.cpp
src/opengl/gl_headers.h
src/opengl/GLBufferObject.h
src/opengl/GLDescriptorSet.cpp
src/opengl/GLDescriptorSet.h
src/opengl/GLDescriptorSetLayout.h
src/opengl/GLTexture.h
src/opengl/GLUtils.cpp
src/opengl/GLUtils.h
Expand Down Expand Up @@ -495,21 +500,38 @@ endif()

# ==================================================================================================
# Compute tests
#
#if (NOT IOS AND NOT WEBGL)
#
#add_executable(compute_test
# test/ComputeTest.cpp
# test/Arguments.cpp
# test/test_ComputeBasic.cpp
# )
#
#target_link_libraries(compute_test PRIVATE
# backend
# getopt
# gtest
# )
#
#set_target_properties(compute_test PROPERTIES FOLDER Tests)
#
#endif()

if (NOT IOS AND NOT WEBGL)
# ==================================================================================================
# Metal utils tests

add_executable(compute_test
test/ComputeTest.cpp
test/Arguments.cpp
test/test_ComputeBasic.cpp
)
if (APPLE AND NOT IOS)

add_executable(metal_utils_test test/MetalTest.mm)

target_link_libraries(compute_test PRIVATE
target_link_libraries(metal_utils_test PRIVATE
backend
getopt
gtest
)

set_target_properties(compute_test PROPERTIES FOLDER Tests)
set_target_properties(metal_utils_test PROPERTIES FOLDER Tests)

endif()
101 changes: 101 additions & 0 deletions filament/backend/include/backend/DescriptorSetOffsetArray.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright (C) 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef TNT_FILAMENT_BACKEND_COMMANDSTREAMVECTOR_H
#define TNT_FILAMENT_BACKEND_COMMANDSTREAMVECTOR_H

#include <backend/DriverApiForward.h>

#include <initializer_list>
#include <memory>

#include <stddef.h>
#include <stdint.h>


namespace filament::backend {

void* allocateFromCommandStream(DriverApi& driver, size_t size, size_t alignment) noexcept;

class DescriptorSetOffsetArray {
public:
using value_type = uint32_t;
using reference = value_type&;
using const_reference = value_type const&;
using size_type = uint32_t;
using difference_type = int32_t;
using pointer = value_type*;
using const_pointer = value_type const*;
using iterator = pointer;
using const_iterator = const_pointer;

DescriptorSetOffsetArray() noexcept = default;

~DescriptorSetOffsetArray() noexcept = default;

DescriptorSetOffsetArray(size_type size, DriverApi& driver) noexcept {
mOffsets = (value_type *)allocateFromCommandStream(driver,
size * sizeof(value_type), alignof(value_type));
std::uninitialized_fill_n(mOffsets, size, 0);
}

DescriptorSetOffsetArray(std::initializer_list<uint32_t> list, DriverApi& driver) noexcept {
mOffsets = (value_type *)allocateFromCommandStream(driver,
list.size() * sizeof(value_type), alignof(value_type));
std::uninitialized_copy(list.begin(), list.end(), mOffsets);
}

DescriptorSetOffsetArray(DescriptorSetOffsetArray const&) = delete;
DescriptorSetOffsetArray& operator=(DescriptorSetOffsetArray const&) = delete;

DescriptorSetOffsetArray(DescriptorSetOffsetArray&& rhs) noexcept
: mOffsets(rhs.mOffsets) {
rhs.mOffsets = nullptr;
}

DescriptorSetOffsetArray& operator=(DescriptorSetOffsetArray&& rhs) noexcept {
if (this != &rhs) {
mOffsets = rhs.mOffsets;
rhs.mOffsets = nullptr;
}
return *this;
}

bool empty() const noexcept { return mOffsets == nullptr; }

value_type* data() noexcept { return mOffsets; }
const value_type* data() const noexcept { return mOffsets; }


reference operator[](size_type n) noexcept {
return *(data() + n);
}

const_reference operator[](size_type n) const noexcept {
return *(data() + n);
}

void clear() noexcept {
mOffsets = nullptr;
}

private:
value_type *mOffsets = nullptr;
};

} // namespace filament::backend

#endif //TNT_FILAMENT_BACKEND_COMMANDSTREAMVECTOR_H
Loading
Loading