mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
gs-mipmapper: Fix support for very small mipmaps
This fixes the final mip map of a texture being empty, in cases where either width or height is reduced to just a single pixel.
This commit is contained in:
parent
38b6ec7c65
commit
9a8a44045b
1 changed files with 11 additions and 4 deletions
|
@ -184,8 +184,8 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
|
|||
size_t mip_levels = 1;
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
ID3D11Texture2D* target_t2;
|
||||
ID3D11Texture2D* source_t2;
|
||||
ID3D11Texture2D* target_t2 = nullptr;
|
||||
ID3D11Texture2D* source_t2 = nullptr;
|
||||
if (device_type == GS_DEVICE_DIRECT3D_11) {
|
||||
// We definitely have a Direct3D11 resource.
|
||||
D3D11_TEXTURE2D_DESC target_t2desc;
|
||||
|
@ -209,8 +209,15 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
|
|||
for (size_t mip = 1; mip < mip_levels; mip++) {
|
||||
texture_width /= 2;
|
||||
texture_height /= 2;
|
||||
texel_width *= 2;
|
||||
texel_height *= 2;
|
||||
if (texture_width == 0) {
|
||||
texture_width = 1;
|
||||
}
|
||||
if (texture_height == 0) {
|
||||
texture_height = 1;
|
||||
}
|
||||
|
||||
texel_width = 1.0 / texture_width;
|
||||
texel_height = 1.0 / texture_height;
|
||||
|
||||
// Draw mipmap layer
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue