Skip to content

Commit

Permalink
[Release] added dsv support (#189)
Browse files Browse the repository at this point in the history
* added dsv support

* enabled restyled

* Restyled added dsv support (#190)

* Restyled by astyle

* Restyled by clang-format

* Restyled by cmake-format

* Restyled by whitespace

---------

Co-authored-by: Restyled.io <commits@restyled.io>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
3 people authored Oct 22, 2024
1 parent 467c65e commit 13626db
Show file tree
Hide file tree
Showing 39 changed files with 36,139 additions and 37 deletions.
72 changes: 36 additions & 36 deletions .github/workflows/restyled.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#name: Restyled
#
#on:
# pull_request:
#
#concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true
#
#jobs:
# restyled:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# ref: ${{ github.event.pull_request.head.ref }}
#
# - uses: restyled-io/actions/setup@v4
# - id: restyler
# uses: restyled-io/actions/run@v4
# with:
# fail-on-differences: true
#
# - if: |
# !cancelled() &&
# steps.restyler.outputs.success == 'true' &&
# github.event.pull_request.head.repo.full_name == github.repository
# uses: peter-evans/create-pull-request@v6
# with:
# base: ${{ steps.restyler.outputs.restyled-base }}
# branch: ${{ steps.restyler.outputs.restyled-head }}
# title: ${{ steps.restyler.outputs.restyled-title }}
# body: ${{ steps.restyler.outputs.restyled-body }}
# labels: "restyled"
# reviewers: ${{ github.event.pull_request.user.login }}
# delete-branch: true
name: Restyled

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
restyled:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: restyled-io/actions/setup@v4
- id: restyler
uses: restyled-io/actions/run@v4
with:
fail-on-differences: true

- if: |
!cancelled() &&
steps.restyler.outputs.success == 'true' &&
github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-pull-request@v6
with:
base: ${{ steps.restyler.outputs.restyled-base }}
branch: ${{ steps.restyler.outputs.restyled-head }}
title: ${{ steps.restyler.outputs.restyled-title }}
body: ${{ steps.restyler.outputs.restyled-body }}
labels: "restyled"
reviewers: ${{ github.event.pull_request.user.login }}
delete-branch: true
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

cmake_minimum_required(VERSION 3.22)

set(WISDOM_VERSION "0.3.6")
set(WISDOM_VERSION "0.3.7")
project("Wisdom" VERSION ${WISDOM_VERSION})

set(CMAKE_DEBUG_POSTFIX d)
Expand Down
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Version History

- 0.3.7

- Added specific function for creating depth stencil views

- 0.3.6

- Fixed inconsistency with Descriptor tables (bytes vs descriptors)
Expand Down
26 changes: 26 additions & 0 deletions bindings/wisdom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@ extern "C" WisResult DX12DeviceCreateRenderTarget(DX12Device self, DX12Texture t
return WisResult{ StatusOutOfMemory, "Failed to allocate memory for wis::DX12RenderTarget." };
return reinterpret_cast<WisResult&>(res);
}
extern "C" WisResult DX12DeviceCreateDepthStencilTarget(DX12Device self, DX12Texture texture, WisRenderTargetDesc desc, DX12RenderTarget* target)
{
auto* xself = reinterpret_cast<wis::DX12Device*>(self);
auto&& [res, value] = xself->CreateDepthStencilTarget(*reinterpret_cast<wis::DX12Texture*>(texture), reinterpret_cast<wis::RenderTargetDesc&>(desc));

if (res.status != wis::Status::Ok)
return reinterpret_cast<WisResult&>(res);

*target = reinterpret_cast<DX12RenderTarget>(new (std::nothrow) wis::DX12RenderTarget(std::move(value)));
if (!*target)
return WisResult{ StatusOutOfMemory, "Failed to allocate memory for wis::DX12RenderTarget." };
return reinterpret_cast<WisResult&>(res);
}
extern "C" WisResult DX12DeviceCreateSampler(DX12Device self, const WisSamplerDesc* desc, DX12Sampler* sampler)
{
auto* xself = reinterpret_cast<wis::DX12Device*>(self);
Expand Down Expand Up @@ -900,6 +913,19 @@ extern "C" WisResult VKDeviceCreateRenderTarget(VKDevice self, VKTexture texture
return WisResult{ StatusOutOfMemory, "Failed to allocate memory for wis::VKRenderTarget." };
return reinterpret_cast<WisResult&>(res);
}
extern "C" WisResult VKDeviceCreateDepthStencilTarget(VKDevice self, VKTexture texture, WisRenderTargetDesc desc, VKRenderTarget* target)
{
auto* xself = reinterpret_cast<wis::VKDevice*>(self);
auto&& [res, value] = xself->CreateDepthStencilTarget(*reinterpret_cast<wis::VKTexture*>(texture), reinterpret_cast<wis::RenderTargetDesc&>(desc));

if (res.status != wis::Status::Ok)
return reinterpret_cast<WisResult&>(res);

*target = reinterpret_cast<VKRenderTarget>(new (std::nothrow) wis::VKRenderTarget(std::move(value)));
if (!*target)
return WisResult{ StatusOutOfMemory, "Failed to allocate memory for wis::VKRenderTarget." };
return reinterpret_cast<WisResult&>(res);
}
extern "C" WisResult VKDeviceCreateSampler(VKDevice self, const WisSamplerDesc* desc, VKSampler* sampler)
{
auto* xself = reinterpret_cast<wis::VKDevice*>(self);
Expand Down
62 changes: 62 additions & 0 deletions bindings/wisdom.h
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,20 @@ WISDOM_API WisResult VKDeviceCreateAllocator(VKDevice self, VKResourceAllocator*
* */
WISDOM_API WisResult VKDeviceCreateRenderTarget(VKDevice self, VKTexture texture, WisRenderTargetDesc desc, VKRenderTarget* target);

/**
* @brief Creates a depth stencil target object.
* Works only with depth formats.
* Used with render passes.
* @param self valid handle to the Device
* @param texture The texture to create the render target with.
* @param desc The description of the render target to create.
* Does not work with 3D textures.
* @param target VKRenderTarget on success (StatusOk).
* @return Result with StatusOk on success.
* Error in WisResult::error otherwise.
* */
WISDOM_API WisResult VKDeviceCreateDepthStencilTarget(VKDevice self, VKTexture texture, WisRenderTargetDesc desc, VKRenderTarget* target);

/**
* @brief Creates a sampler object.
* @param self valid handle to the Device
Expand Down Expand Up @@ -3234,6 +3248,20 @@ WISDOM_API WisResult DX12DeviceCreateAllocator(DX12Device self, DX12ResourceAllo
* */
WISDOM_API WisResult DX12DeviceCreateRenderTarget(DX12Device self, DX12Texture texture, WisRenderTargetDesc desc, DX12RenderTarget* target);

/**
* @brief Creates a depth stencil target object.
* Works only with depth formats.
* Used with render passes.
* @param self valid handle to the Device
* @param texture The texture to create the render target with.
* @param desc The description of the render target to create.
* Does not work with 3D textures.
* @param target DX12RenderTarget on success (StatusOk).
* @return Result with StatusOk on success.
* Error in WisResult::error otherwise.
* */
WISDOM_API WisResult DX12DeviceCreateDepthStencilTarget(DX12Device self, DX12Texture texture, WisRenderTargetDesc desc, DX12RenderTarget* target);

/**
* @brief Creates a sampler object.
* @param self valid handle to the Device
Expand Down Expand Up @@ -4206,6 +4234,23 @@ inline WisResult WisDeviceCreateRenderTarget(WisDevice self, WisTexture texture,
return DX12DeviceCreateRenderTarget(self, texture, desc, target);
}

/**
* @brief Creates a depth stencil target object.
* Works only with depth formats.
* Used with render passes.
* @param self valid handle to the Device
* @param texture The texture to create the render target with.
* @param desc The description of the render target to create.
* Does not work with 3D textures.
* @param target WisRenderTarget on success (StatusOk).
* @return Result with StatusOk on success.
* Error in WisResult::error otherwise.
* */
inline WisResult WisDeviceCreateDepthStencilTarget(WisDevice self, WisTexture texture, WisRenderTargetDesc desc, WisRenderTarget* target)
{
return DX12DeviceCreateDepthStencilTarget(self, texture, desc, target);
}

/**
* @brief Creates a sampler object.
* @param self valid handle to the Device
Expand Down Expand Up @@ -5384,6 +5429,23 @@ inline WisResult WisDeviceCreateRenderTarget(WisDevice self, WisTexture texture,
return VKDeviceCreateRenderTarget(self, texture, desc, target);
}

/**
* @brief Creates a depth stencil target object.
* Works only with depth formats.
* Used with render passes.
* @param self valid handle to the Device
* @param texture The texture to create the render target with.
* @param desc The description of the render target to create.
* Does not work with 3D textures.
* @param target WisRenderTarget on success (StatusOk).
* @return Result with StatusOk on success.
* Error in WisResult::error otherwise.
* */
inline WisResult WisDeviceCreateDepthStencilTarget(WisDevice self, WisTexture texture, WisRenderTargetDesc desc, WisRenderTarget* target)
{
return VKDeviceCreateDepthStencilTarget(self, texture, desc, target);
}

/**
* @brief Creates a sampler object.
* @param self valid handle to the Device
Expand Down
1 change: 1 addition & 0 deletions examples/custom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ if(WISDOM_WINDOWS AND NOT WISDOM_WINDOWS_STORE)

if(WISDOM_VULKAN)
add_subdirectory(cross_device)
add_subdirectory(multimon)
endif()
endif()
65 changes: 65 additions & 0 deletions examples/custom/multimon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
project(multimon-demo)

find_package(glm QUIET)

add_executable(
${PROJECT_NAME}
entry_main.cpp
app.h
app.cpp
lut_loader.h
lut_loader.cpp
window.h
window.cpp
keyboard.h
keyboard.cpp
mouse.h
mouse.cpp
work_node.h
work_node.cpp
transfer_node.h
transfer_node.cpp
menu.h
util.h
util.cpp)

wis_install_deps(${PROJECT_NAME})

target_link_libraries(
${PROJECT_NAME} PRIVATE wis::debug-headers wis::platform-headers
wis::extended-allocation-headers glm::glm Wil)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 23)
target_include_directories(${PROJECT_NAME} PRIVATE ${fpng_SOURCE_DIR}/src)
target_compile_definitions(${PROJECT_NAME} PRIVATE WISDOM_FORCE_VULKAN)

wis_compile_shader(TARGET ${PROJECT_NAME} SHADER
${CMAKE_CURRENT_SOURCE_DIR}/lut.vs.hlsl)
wis_compile_shader(TARGET ${PROJECT_NAME} SHADER
${CMAKE_CURRENT_SOURCE_DIR}/lut.ps.hlsl)

wis_compile_shader(TARGET ${PROJECT_NAME} SHADER
${CMAKE_CURRENT_SOURCE_DIR}/present.vs.hlsl)
wis_compile_shader(TARGET ${PROJECT_NAME} SHADER
${CMAKE_CURRENT_SOURCE_DIR}/present.ps.hlsl)
wis_compile_shader(
TARGET
${PROJECT_NAME}
SHADER
${CMAKE_CURRENT_SOURCE_DIR}/lut.ps.hlsl
DEFINITIONS
"TETRA"
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/lut_tetra.ps)

add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/lut.cube
$<TARGET_FILE_DIR:${PROJECT_NAME}>/lut.cube)
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/image.png
$<TARGET_FILE_DIR:${PROJECT_NAME}>/image.png)
Loading

0 comments on commit 13626db

Please sign in to comment.