-
-
Notifications
You must be signed in to change notification settings - Fork 345
nv2a: Handle anisotropic filter setting #2450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mborgerson
merged 3 commits into
xemu-project:master
from
abaire:fix_2444_respect_anisotropic_filter_level
Sep 25, 2025
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -1101,6 +1101,9 @@ static void create_texture(PGRAPHState *pg, int texture_idx) | |
pgraph_reg_r(pg, NV_PGRAPH_BORDERCOLOR0 + texture_idx * 4); | ||
bool is_indexed = (state.color_format == | ||
NV097_SET_TEXTURE_FORMAT_COLOR_SZ_I8_A8R8G8B8); | ||
uint32_t max_anisotropy = | ||
1 << (GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_TEXCTL0_0 + texture_idx*4), | ||
NV_PGRAPH_TEXCTL0_0_MAX_ANISOTROPY)); | ||
|
||
TextureKey key; | ||
memset(&key, 0, sizeof(key)); | ||
|
@@ -1120,6 +1123,7 @@ static void create_texture(PGRAPHState *pg, int texture_idx) | |
key.filter = filter; | ||
key.address = address; | ||
key.border_color = border_color_pack32; | ||
key.max_anisotropy = max_anisotropy; | ||
|
||
bool possibly_dirty = false; | ||
bool possibly_dirty_checked = false; | ||
|
@@ -1343,6 +1347,8 @@ static void create_texture(PGRAPHState *pg, int texture_idx) | |
} else if (lod_bias < -r->device_props.limits.maxSamplerLodBias) { | ||
lod_bias = -r->device_props.limits.maxSamplerLodBias; | ||
} | ||
uint32_t sampler_max_anisotropy = | ||
MIN(r->device_props.limits.maxSamplerAnisotropy, max_anisotropy); | ||
|
||
VkSamplerCreateInfo sampler_create_info = { | ||
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, | ||
|
@@ -1354,9 +1360,9 @@ static void create_texture(PGRAPHState *pg, int texture_idx) | |
GET_MASK(address, NV_PGRAPH_TEXADDRESS0_ADDRV)), | ||
.addressModeW = (state.dimensionality > 2) ? lookup_texture_address_mode( | ||
GET_MASK(address, NV_PGRAPH_TEXADDRESS0_ADDRP)) : 0, | ||
.anisotropyEnable = VK_FALSE, | ||
// .anisotropyEnable = VK_TRUE, | ||
// .maxAnisotropy = properties.limits.maxSamplerAnisotropy, | ||
.anisotropyEnable = r->enabled_physical_device_features.wideLines && | ||
|
||
sampler_max_anisotropy > 1, | ||
.maxAnisotropy = sampler_max_anisotropy, | ||
.borderColor = vk_border_color, | ||
.compareEnable = VK_FALSE, | ||
.compareOp = VK_COMPARE_OP_ALWAYS, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically
GL_TEXTURE_MAX_ANISOTROPY
is not GL 4.0 core--it comes from theARB_texture_filter_anisotropic
extension.The original extension was
EXT_texture_filter_anisotropic
and used theGL_TEXTURE_MAX_ANISOTROY_EXT
token, which have identical numeric values.Though it is ubiquitous, it would be good practice to confirm
GL_EXT_texture_filter_anisotropic
extension is present (Seepgraph_gl_init
) before using it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done; added a struct to track extension use similar to VK enabled features.