r300g: add high quality anisotropic filtering for R5xx (disabled by default)
Oh look, an undocumented feature. It's a nice tool for benchmarking texturing.
This commit is contained in:
@@ -37,6 +37,7 @@ static struct debug_option debug_options[] = {
|
||||
{ "draw", DBG_DRAW, "Draw and emit" },
|
||||
{ "tex", DBG_TEX, "Textures" },
|
||||
{ "fall", DBG_FALL, "Fallbacks" },
|
||||
{ "anisohq", DBG_ANISOHQ, "High quality anisotropic filtering (for benchmarking purposes only!)" },
|
||||
|
||||
{ "all", ~0, "Convenience option that enables all debug flags" },
|
||||
|
||||
|
||||
@@ -1500,6 +1500,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
# define R300_ANISO_THRESHOLD_MASK (7<<17)
|
||||
|
||||
# define R500_MACRO_SWITCH (1<<22)
|
||||
# define R500_TX_MAX_ANISO(x) ((x) << 23)
|
||||
# define R500_TX_MAX_ANISO_MASK (63 << 23)
|
||||
# define R500_TX_ANISO_HIGH_QUALITY (1 << 30)
|
||||
|
||||
# define R500_BORDER_FIX (1<<31)
|
||||
|
||||
#define R300_TX_FORMAT0_0 0x4480
|
||||
|
||||
@@ -77,6 +77,7 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys);
|
||||
#define DBG_DRAW 0x0000010
|
||||
#define DBG_TEX 0x0000020
|
||||
#define DBG_FALL 0x0000040
|
||||
#define DBG_ANISOHQ 0x0000080
|
||||
/*@}*/
|
||||
|
||||
static INLINE boolean SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags)
|
||||
|
||||
@@ -849,6 +849,7 @@ static void*
|
||||
{
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
|
||||
boolean is_r500 = r300_screen(pipe->screen)->caps->is_r500;
|
||||
int lod_bias;
|
||||
union util_color uc;
|
||||
|
||||
@@ -875,6 +876,14 @@ static void*
|
||||
|
||||
sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT;
|
||||
|
||||
/* This is very high quality anisotropic filtering for R5xx.
|
||||
* It's good for benchmarking the performance of texturing but
|
||||
* in practice we don't want to slow down the driver because it's
|
||||
* a pretty good performance killer. Feel free to play with it. */
|
||||
if (DBG_ON(r300, DBG_ANISOHQ) && is_r500) {
|
||||
sampler->filter1 |= r500_anisotropy(state->max_anisotropy);
|
||||
}
|
||||
|
||||
util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
|
||||
sampler->border_color = uc.ui;
|
||||
|
||||
|
||||
@@ -327,6 +327,18 @@ static INLINE uint32_t r300_anisotropy(unsigned max_aniso)
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE uint32_t r500_anisotropy(unsigned max_aniso)
|
||||
{
|
||||
if (!max_aniso) {
|
||||
return 0;
|
||||
}
|
||||
max_aniso -= 1;
|
||||
|
||||
// Map the range [0, 15] to [0, 63].
|
||||
return R500_TX_MAX_ANISO(MIN2((unsigned)(max_aniso*4.2001), 63)) |
|
||||
R500_TX_ANISO_HIGH_QUALITY;;
|
||||
}
|
||||
|
||||
/* Non-CSO state. (For now.) */
|
||||
|
||||
static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
|
||||
|
||||
Reference in New Issue
Block a user