Skip to content
Merged
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
5 changes: 5 additions & 0 deletions src/platform/windows/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ class display_base_t : public display_t {
} D3DKMT_SCHEDULINGPRIORITYCLASS;

typedef NTSTATUS WINAPI (*PD3DKMTSetProcessSchedulingPriorityClass)(HANDLE, D3DKMT_SCHEDULINGPRIORITYCLASS);

protected:
int get_pixel_pitch() {
return (format == DXGI_FORMAT_R16G16B16A16_FLOAT) ? 8 : 4;
}
};

class display_ram_t : public display_base_t {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/windows/display_ram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ capture_e display_ram_t::snapshot(::platf::img_t *img_base, std::chrono::millise
std::shared_ptr<platf::img_t> display_ram_t::alloc_img() {
auto img = std::make_shared<img_t>();

img->pixel_pitch = 4;
img->pixel_pitch = get_pixel_pitch();
img->row_pitch = img_info.RowPitch;
img->width = width;
img->height = height;
Expand Down
9 changes: 5 additions & 4 deletions src/platform/windows/display_vram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ int display_vram_t::init(int framerate, const std::string &display_name) {
std::shared_ptr<platf::img_t> display_vram_t::alloc_img() {
auto img = std::make_shared<img_d3d_t>();

img->pixel_pitch = 4;
img->pixel_pitch = get_pixel_pitch();
img->row_pitch = img->pixel_pitch * width;
img->width = width;
img->height = height;
Expand Down Expand Up @@ -802,13 +802,14 @@ int display_vram_t::dummy_img(platf::img_t *img_base) {
return 0;
}

img->row_pitch = width * 4;
auto dummy_data = std::make_unique<int[]>(width * height);
img->pixel_pitch = get_pixel_pitch();
img->row_pitch = img->pixel_pitch * width;
auto dummy_data = std::make_unique<uint8_t[]>(img->row_pitch * height);
D3D11_SUBRESOURCE_DATA data {
dummy_data.get(),
(UINT)img->row_pitch
};
std::fill_n(dummy_data.get(), width * height, 0);
std::fill_n(dummy_data.get(), img->row_pitch * height, 0);

D3D11_TEXTURE2D_DESC t {};
t.Width = width;
Expand Down