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] [Dawn] Add support for doBuffer with sparse descriptor sets and bindings #598

Closed
wants to merge 6 commits into from
Closed
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
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ option(AMBER_SKIP_SHADERC
"Skip building Shaderc into the library" ${AMBER_SKIP_SHADERC})
option(AMBER_SKIP_SAMPLES
"Skip building sample application" ${AMBER_SKIP_SAMPLES})
option(AMBER_SKIP_LODEPNG
"Skip building lodepng into the library" ${AMBER_SKIP_LODEPNG})
option(AMBER_USE_DXC "Enable DXC integration" ${AMBER_USE_DXC})
option(AMBER_USE_LOCAL_VULKAN "Build with vulkan in third_party" OFF)
option(AMBER_USE_CLSPV "Build with Clspv support" OFF)
Expand Down Expand Up @@ -80,6 +82,12 @@ else()
set(AMBER_ENABLE_SAMPLES TRUE)
endif()

if (${AMBER_SKIP_LODEPNG})
set(AMBER_ENABLE_LODEPNG FALSE)
else()
set(AMBER_ENABLE_LODEPNG TRUE)
endif()

if (${AMBER_ENABLE_SWIFTSHADER})
# Swiftshader requires the loader to be built.
set(AMBER_USE_LOCAL_VULKAN TRUE)
Expand All @@ -106,6 +114,7 @@ message(STATUS "Amber enable SPIRV-Tools: ${AMBER_ENABLE_SPIRV_TOOLS}")
message(STATUS "Amber enable Shaderc: ${AMBER_ENABLE_SHADERC}")
message(STATUS "Amber enable tests: ${AMBER_ENABLE_TESTS}")
message(STATUS "Amber enable samples: ${AMBER_ENABLE_SAMPLES}")
message(STATUS "Amber enable lodepng: ${AMBER_ENABLE_LODEPNG}")
message(STATUS "Amber enable SwiftShader: ${AMBER_ENABLE_SWIFTSHADER}")
message(STATUS "Amber enable DXC: ${AMBER_ENABLE_DXC}")
message(STATUS "Amber enable Clspv: ${AMBER_ENABLE_CLSPV}")
Expand All @@ -130,6 +139,7 @@ add_definitions(-DAMBER_ENABLE_SPIRV_TOOLS=$<BOOL:${AMBER_ENABLE_SPIRV_TOOLS}>)
add_definitions(-DAMBER_ENABLE_SHADERC=$<BOOL:${AMBER_ENABLE_SHADERC}>)
add_definitions(-DAMBER_ENABLE_DXC=$<BOOL:${AMBER_ENABLE_DXC}>)
add_definitions(-DAMBER_ENABLE_CLSPV=$<BOOL:${AMBER_ENABLE_CLSPV}>)
add_definitions(-DAMBER_ENABLE_LODEPNG=$<BOOL:${AMBER_ENABLE_LODEPNG}>)

set(CMAKE_DEBUG_POSTFIX "")

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ out/Debug/amber tests/cases/clear.vkscript
The sample app returns a value of 0 on success or non-zero on error. Any issues
encountered should be displayed on the console.

By default, `out/Debug/amber` supports saving the output image into '.png'
file. You can disable this by passing `-DAMBER_SKIP_LODEPNG=true` to cmake.

## Contributing

Please see the [CONTRIBUTING](CONTRIBUTING.md) and
Expand Down
9 changes: 7 additions & 2 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ set(AMBER_SOURCES
config_helper.cc
log.cc
ppm.cc
png.cc
timestamp.cc
${CMAKE_BINARY_DIR}/src/build-versions.h.fake
)

set(AMBER_EXTRA_LIBS "lodepng")
set(AMBER_EXTRA_LIBS "")

if (${AMBER_ENABLE_LODEPNG})
set(AMBER_SOURCES ${AMBER_SOURCES} png.cc)
list(APPEND AMBER_EXTRA_LIBS "lodepng")
endif()

if (${Vulkan_FOUND})
set(AMBER_SOURCES ${AMBER_SOURCES} config_helper_vulkan.cc)
Expand All @@ -45,6 +49,7 @@ endif()

add_executable(amber ${AMBER_SOURCES})
target_include_directories(amber PRIVATE "${CMAKE_BINARY_DIR}")

set_target_properties(amber PROPERTIES OUTPUT_NAME "amber")
target_link_libraries(amber libamber ${AMBER_EXTRA_LIBS})
amber_default_compile_options(amber)
Expand Down
9 changes: 8 additions & 1 deletion samples/amber.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@

#include "amber/recipe.h"
#include "samples/config_helper.h"
#include "samples/png.h"
#include "samples/ppm.h"
#include "samples/timestamp.h"
#include "src/build-versions.h"
#include "src/make_unique.h"

#if AMBER_ENABLE_LODEPNG
#include "samples/png.h"
#endif // AMBER_ENABLE_LODEPNG

namespace {

const char* kGeneratedColorBuffer = "framebuffer";
Expand Down Expand Up @@ -431,8 +434,12 @@ int main(int argc, const char** argv) {
for (const amber::BufferInfo& buffer_info : amber_options.extractions) {
if (buffer_info.buffer_name == options.fb_name) {
if (usePNG) {
#if AMBER_ENABLE_LODEPNG
result = png::ConvertToPNG(buffer_info.width, buffer_info.height,
buffer_info.values, &out_buf);
#else // AMBER_ENABLE_LODEPNG
result = amber::Result("PNG support not enabled");
#endif // AMBER_ENABLE_LODEPNG
} else {
ppm::ConvertToPPM(buffer_info.width, buffer_info.height,
buffer_info.values, &out_buf);
Expand Down
Loading