Skip to content

Commit

Permalink
fix(capture/windows): fix capture when using the basic render driver (#…
Browse files Browse the repository at this point in the history
…3531)

* fix(capture/windows): fix capture when using the basic render driver

* chore(tests): remove now unnecessary TESTS_SOFTWARE_ENCODER_UNAVAILABLE option
  • Loading branch information
cgutman authored Jan 12, 2025
1 parent 1b94e93 commit c369e8e
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -954,8 +954,7 @@ jobs:
-DSUNSHINE_ASSETS_DIR=assets \
-DSUNSHINE_PUBLISHER_NAME='${{ github.repository_owner }}' \
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support' \
-DTESTS_SOFTWARE_ENCODER_UNAVAILABLE='skip'
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'
ninja -C build
- name: Package Windows
Expand Down
4 changes: 0 additions & 4 deletions cmake/prep/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ option(BUILD_TESTS "Build tests" ON)
option(NPM_OFFLINE "Use offline npm packages. You must ensure packages are in your npm cache." OFF)
option(TESTS_ENABLE_PYTHON_TESTS "Enable Python tests" ON)

# DirectX11 is not available in GitHub runners, so even software encoding fails
set(TESTS_SOFTWARE_ENCODER_UNAVAILABLE "fail"
CACHE STRING "How to handle unavailable software encoders in tests. 'fail/skip'")

option(BUILD_WERROR "Enable -Werror flag." OFF)

# if this option is set, the build will exit after configuring special package configuration files
Expand Down
2 changes: 1 addition & 1 deletion src/platform/windows/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace platf::dxgi {

// Add D3D11_CREATE_DEVICE_DEBUG here to enable the D3D11 debug runtime.
// You should have a debugger like WinDbg attached to receive debug messages.
auto constexpr D3D11_CREATE_DEVICE_FLAGS = D3D11_CREATE_DEVICE_VIDEO_SUPPORT;
auto constexpr D3D11_CREATE_DEVICE_FLAGS = 0;

template <class T>
void
Expand Down
2 changes: 1 addition & 1 deletion src/platform/windows/display_vram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ namespace platf::dxgi {
adapter_p,
D3D_DRIVER_TYPE_UNKNOWN,
nullptr,
D3D11_CREATE_DEVICE_FLAGS,
D3D11_CREATE_DEVICE_FLAGS | D3D11_CREATE_DEVICE_VIDEO_SUPPORT,
featureLevels, sizeof(featureLevels) / sizeof(D3D_FEATURE_LEVEL),
D3D11_SDK_VERSION,
&device,
Expand Down
6 changes: 0 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ endif ()

set(TEST_DEFINITIONS) # list will be appended as needed

# make sure TESTS_SOFTWARE_ENCODER_UNAVAILABLE is set to "fail" or "skip"
if (NOT (TESTS_SOFTWARE_ENCODER_UNAVAILABLE STREQUAL "fail" OR TESTS_SOFTWARE_ENCODER_UNAVAILABLE STREQUAL "skip"))
set(TESTS_SOFTWARE_ENCODER_UNAVAILABLE "fail")
endif ()
list(APPEND TEST_DEFINITIONS TESTS_SOFTWARE_ENCODER_UNAVAILABLE="${TESTS_SOFTWARE_ENCODER_UNAVAILABLE}") # fail/skip

# this indicates we're building tests in case sunshine needs to adjust some code or add private tests
list(APPEND TEST_DEFINITIONS SUNSHINE_TESTS)

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct EncoderTest: PlatformTestSuite, testing::WithParamInterface<video::encode
auto &encoder = *GetParam();
if (!video::validate_encoder(encoder, false)) {
// Encoder failed validation,
// if it's software - fail (unless overriden with compile definition), otherwise skip
if (encoder.name == "software" && std::string(TESTS_SOFTWARE_ENCODER_UNAVAILABLE) == "fail") {
// if it's software - fail, otherwise skip
if (encoder.name == "software") {
FAIL() << "Software encoder not available";
}
else {
Expand Down

0 comments on commit c369e8e

Please sign in to comment.