forked from jroweboy/citra
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jhno591
committed
Nov 14, 2016
1 parent
e499418
commit 4b9e701
Showing
17 changed files
with
1,627 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2016 Citra Emulator Project | ||
// Licensed under GPLv2 or any later version | ||
// Refer to the license.txt file included. | ||
|
||
#include <vector> | ||
#include "common/vector_math.h" | ||
#include "core/memory.h" | ||
#include "core/settings.h" | ||
#include "video_core/debug_utils/debug_utils.h" | ||
#include "video_core/filtering/texture_filterer.h" | ||
#include "video_core/filtering/xbrz/xbrz.h" | ||
|
||
bool Filtering::isScalingEnabled() { | ||
int scaling = Filtering::getScaling(); | ||
return Filtering::getScalingType() != Filtering::FilteringTypes::NONE && scaling >= 2 && | ||
scaling <= 6; | ||
} | ||
|
||
int Filtering::getScaling() { | ||
int scaling = Settings::values.tex_filter_scaling; | ||
|
||
if (scaling < 1 || scaling > 6) { | ||
return 1; | ||
} else { | ||
return scaling; | ||
} | ||
} | ||
|
||
Filtering::FilteringTypes Filtering::getScalingType() { | ||
return (Filtering::FilteringTypes)Settings::values.tex_filter; | ||
} | ||
|
||
void Filtering::filterTexture(Pica::DebugUtils::TextureInfo tex_info, unsigned int* fromBuffer, | ||
unsigned int* toBuffer) { | ||
// Discover filtering type | ||
Filtering::FilteringTypes type = getScalingType(); | ||
|
||
switch (type) { | ||
case Filtering::FilteringTypes::XBRZ: | ||
if (tex_info.format == Pica::Regs::TextureFormat::RGB8) { | ||
xbrz::scale(Filtering::getScaling(), fromBuffer, toBuffer, tex_info.width, | ||
tex_info.height, xbrz::ColorFormat::RGB); | ||
} else { | ||
xbrz::scale(Filtering::getScaling(), fromBuffer, toBuffer, tex_info.width, | ||
tex_info.height, xbrz::ColorFormat::ARGB); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
int Filtering::getScaledTextureSize(Pica::Regs::TextureFormat format, int width, int height) { | ||
if (Filtering::isScalingEnabled() && (int)format < 14) { // Check that this is in range | ||
int scaling = Filtering::getScaling(); | ||
return (width * scaling) * (height * scaling); | ||
} else { | ||
return width * height; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2016 Citra Emulator Project | ||
// Licensed under GPLv2 or any later version | ||
// Refer to the license.txt file included. | ||
|
||
#pragma once | ||
|
||
#include "video_core/debug_utils/debug_utils.h" | ||
#include "video_core/renderer_opengl/gl_rasterizer_cache.h" | ||
|
||
namespace Filtering { | ||
|
||
enum class FilteringTypes { | ||
NONE = 0, | ||
XBRZ = 1, | ||
}; | ||
|
||
// Checks if scaling is enabled | ||
bool isScalingEnabled(); | ||
|
||
// Returns the currently configured scaling size | ||
int getScaling(); | ||
|
||
// Returns the currently configured scaling type | ||
Filtering::FilteringTypes getScalingType(); | ||
|
||
// Filters a texture using the specified texture | ||
void filterTexture(Pica::DebugUtils::TextureInfo tex_info, unsigned int* fromBuffer, | ||
unsigned int* toBuffer); | ||
|
||
// Returns the scaled texture size (width * height) of this texture | ||
int getScaledTextureSize(Pica::Regs::TextureFormat format, int width, int height); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// **************************************************************************** | ||
// * This file is part of the HqMAME project. It is distributed under * | ||
// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * | ||
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * | ||
// * * | ||
// * Additionally and as a special exception, the author gives permission * | ||
// * to link the code of this program with the MAME library (or with modified * | ||
// * versions of MAME that use the same license as MAME), and distribute * | ||
// * linked combinations including the two. You must obey the GNU General * | ||
// * Public License in all respects for all of the code used other than MAME. * | ||
// * If you modify this file, you may extend this exception to your version * | ||
// * of the file, but you are not obligated to do so. If you do not wish to * | ||
// * do so, delete this exception statement from your version. * | ||
// **************************************************************************** | ||
|
||
#ifndef XBRZ_CONFIG_HEADER_284578425345 | ||
#define XBRZ_CONFIG_HEADER_284578425345 | ||
|
||
// do NOT include any headers here! used by xBRZ_dll!!! | ||
|
||
namespace xbrz { | ||
struct ScalerCfg { | ||
double luminanceWeight = 1; | ||
double equalColorTolerance = 30; | ||
double dominantDirectionThreshold = 3.6; | ||
double steepDirectionThreshold = 2.2; | ||
double newTestAttribute = 0; // unused; test new parameters | ||
}; | ||
} | ||
|
||
#endif |
Oops, something went wrong.