RFR: 8092272: [D3D 3D] Need a robust 3D states management for texture

Nir Lisker nlisker at openjdk.org
Fri Nov 10 15:27:12 UTC 2023


On Thu, 9 Nov 2023 03:16:51 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> Moves the filter setting of the samplers from the device parameters configuration to the use-site, allowing for dynamic changes in the sampler. This PR does internal plumbing work only to bring it close to the ES2 pipeline. A followup PR will create the public API.
>> 
>> Summary of the changes:
>> * Created a new (internal for now) `TextureData` object that is intended to contain all the data of texture (map) of `PhongMaterial`, such as filters, addressing, wrapping mode, mipmaps etc. **This PR deals only with filters** as a starting point, more settings can be added later.
>> * Creates an update mechanism from the Java side material to the native D3D layer. The public API `PhoneMaterial` is *not* changed yet. The peer `NGPhongMaterial` is configured to receive update from the public `PhongMaterial` when the public API is created via new `ObjectProperty<TextureData>` properties.
>> * Small refactoring in the D3D layer with a new map types enum to control the texture settings more easily.
>> 
>> The JBS issue lists some regressions in a comment, but I couldn't reproduce them. It looks like the sampler settings needed to be added anywhere, and that was the easiest to do at the time. Now they were just moved.
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/scene/paint/TextureData.java line 12:
> 
>> 10:  */
>> 11: // Here we can support mipmaps, wrapping modes (which exists internally and can be pulled out), addressing modes etc.
>> 12: public class TextureData {
> 
> 1. This type could be a record.
> 2. There's no actual texture data (i.e. pixels) here, maybe a better name would be `SamplerParameters` or something like that.

1. Not when it will be promoted to public API. Adding record components breaks backwards compatibility, so making this a record will not allow adding more configuration later on. What might be possible is making it an interface and using a record as an implementation.
2. I think that this class can go beyond sampler configurations. For example, wrapping is a render state, not a sampler state. Maybe something more general like "TextureParameters" can work.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1281#discussion_r1389539073


More information about the openjfx-dev mailing list