-
Notifications
You must be signed in to change notification settings - Fork 8
Resolution adjustments #68
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
base: main-MC1.21.1
Are you sure you want to change the base?
Changes from all commits
3ac7b71
1307d87
86f71d9
a57140a
b4f738d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -436,6 +436,25 @@ class GraphicsCard(val tier: Int, val vramScreens: Option[Double] = None, val vi | |
| result(math.min(gmw, smw), math.min(gmh, smh)) | ||
| }) | ||
|
|
||
| @Callback(direct = true, doc = """function():string or nil -- Return which of GPU or screen is limiting display capabilities, if either""") | ||
| def capabilityLimiter(context: Context, args: Arguments): Array[AnyRef] = | ||
| // FIXME: Assumes that GPU/screen tiers do not differ only by color depth, | ||
| // which is *currently* valid but may not be in the future. It would be | ||
| // better to just use the tier values directly, but I couldn't figure out | ||
| // how to access the physical screen from the TextBuffer... | ||
|
Comment on lines
+441
to
+444
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This implementation is slightly gross in that comparing GPU and screen tiers directly would make it work correctly in all cases without making assumptions about how graphics capabilities scale in the mod. If we can figure out how to make that happen, that'd be a much better implementation. |
||
| screen(s => { | ||
| val gmw = maxResolution._1 | ||
| val smw = s.getMaximumWidth | ||
| result( | ||
| if (gmw > smw) | ||
| "screen" | ||
| else if (gmw < smw) | ||
| "gpu" | ||
| else // Equal, so neither is limiting | ||
| null | ||
| ) | ||
| }) | ||
|
|
||
| @Callback(direct = true, doc = """function():number, number -- Get the current viewport resolution.""") | ||
| def getViewport(context: Context, args: Arguments): Array[AnyRef] = | ||
| screen(s => result(s.getViewportWidth, s.getViewportHeight)) | ||
|
|
||
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.
I'm not married to this name, and honestly half-think it needs a better one. Suggestions welcome.
Uh oh!
There was an error while loading. Please reload this page.
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.
cheesy, but, like,
getTierConstraintSource()?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.
Would adding a
tierfield or similar to each component be a more flexible way of doing this? Or thescreencomponent could have its ownmaxResolution/maxDepthmethods.Uh oh!
There was an error while loading. Please reload this page.
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.
I'm not sure it's useful in any other context to know specifically the tier of a component. In most other cases I am aware of, there are sane ways to do capability querying that don't involve needing to depend on comparing against hardcoded assumptions of said capabilities - it is possible to tell the different NICs and data cards apart from each other just by asking what they are capable of doing. This particular weird wart in the way that GPUs and screens don't do this is irregular among the rest of the components.
This might be preferable. GPU and screen each get new methods called
maxPossibleResolution()andmaxPossibleDepth()(or similar) that always return the maximum each piece of hardware could support, so thatmaxResolution()andmaxDepth()can keep their existing meaning of currently-possible maximum instead of theoretically-possible maximum.