Texture State: Difference between revisions

From Burnout Wiki
Content added Content deleted
(Created page.)
 
(Moved content to subpages.)
Tag: Replaced
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
}}
}}


Texture states describe texture attributes such as mipmapping, filtering, and the border color.
{{todo|Write a description.}}


= Structures =
= Variants =
{{subpage|PlayStation 3|text=Information on the Texture State resource type used on PlayStation 3.}}
=== renderengine::TextureState ===
{{subpage|Xbox 360|text=Information on the Texture State resource type used on Xbox 360.}}
==== PlayStation 3 ====
{{subpage|PC|text=Information on the Texture State resource type used on PC.}}
{| class="wikitable"
{{subpage|Remastered|text=Information on the Texture State resource type used in Burnout Paradise Remastered.}}
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x1C || [[#renderengine::SamplerState|SamplerState]] || || Base class ||
|-
| 0x1C || 0x4 || [[Texture]] || texture || Texture || Imported resource
|}

==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x1C || [[#renderengine::SamplerState|SamplerState]] || || Base class ||
|-
| 0x20 || 0x4 || [[Texture]] || texture || Texture || Imported resource
|}

==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x3C || [[#renderengine::SamplerState|SamplerState]] || || Base class ||
|-
| 0x3C || 0x4 || [[Texture]] || texture || Texture || Imported resource
|}

==== PC (Remastered) ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x38 || [[#renderengine::SamplerState|SamplerState]] || || Base class ||
|-
| 0x38 || 0x4 || [[Texture]] || texture || Texture || Imported resource
|}

==== PlayStation 4, Switch ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x40 || [[#renderengine::SamplerState|SamplerState]] || || Base class ||
|-
| 0x20 || 0x4 || [[Texture]] || texture || Texture || Imported resource
|}

=== renderengine::SamplerState ===
==== PlayStation 3 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || uint32_t || m_color || ||
|-
| 0x4 || 0x4 || uint32_t || m_enable || ||
|-
| 0x8 || 0x2 || uint16_t || m_minLod || ||
|-
| 0xA || 0x2 || uint16_t || m_maxLod || ||
|-
| 0xC || 0x1 || uint8_t || m_maxAniso || ||
|-
| 0xD || 0x1 || uint8_t || m_wrapS || ||
|-
| 0xE || 0x1 || uint8_t || m_wrapT || ||
|-
| 0xF || 0x1 || uint8_t || m_wrapR || ||
|-
| 0x10 || 0x1 || uint8_t || m_uRemap || ||
|-
| 0x11 || 0x1 || uint8_t || m_zFunc || ||
|-
| 0x12 || 0x1 || uint8_t || m_gamma || ||
|-
| 0x14 || 0x2 || uint16_t || m_bias || ||
|-
| 0x16 || 0x1 || uint8_t || m_min || ||
|-
| 0x17 || 0x1 || uint8_t || m_mag || ||
|-
| 0x18 || 0x1 || uint8_t || m_convolution || ||
|-
| 0x19 || 0x3 || || || Padding ||
|}

==== Xbox 360 ====
{{todo|Requires research. Likely related to D3DSAMPLERSTATETYPE from the SDK.}}

{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || float || ? || Mipmap LOD Bias ||
|-
| 0x4 || 0x1C || ? || ? || || TODO
|}

==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || [[#D3DTEXTUREADDRESS|D3DTEXTUREADDRESS]] || ? || U Addressing Mode ||
|-
| 0x4 || 0x4 || [[#D3DTEXTUREADDRESS|D3DTEXTUREADDRESS]] || ? || V Addressing Mode ||
|-
| 0x8 || 0x4 || [[#D3DTEXTUREADDRESS|D3DTEXTUREADDRESS]] || ? || W Addressing Mode ||
|-
| 0xC || 0x4 || [[#D3DTEXTUREFILTERTYPE|D3DTEXTUREFILTERTYPE]] || ? || Magnification Filter ||
|-
| 0x10 || 0x4 || [[#D3DTEXTUREFILTERTYPE|D3DTEXTUREFILTERTYPE]] || ? || Minification Filter ||
|-
| 0x14 || 0x4 || [[#D3DTEXTUREFILTERTYPE|D3DTEXTUREFILTERTYPE]] || ? || Mipmap Filter ||
|-
| 0x18 || 0x4 || uint32_t || ? || Max Mipmap Level ||
|-
| 0x1C || 0x4 || uint32_t || ? || Max Anisotropy ||
|-
| 0x20 || 0x4 || float || ? || Mipmap LOD Bias ||
|-
| 0x24 || 0x4 || [[#D3DCOLOR|D3DCOLOR]] || ? || Border Color ||
|-
| 0x28 || 0x4 || ? || ? || || rowspan=5|Game doesn't access these members
|-
| 0x2C || 0x4 || ? || ? ||
|-
| 0x30 || 0x4 || ? || ? ||
|-
| 0x34 || 0x4 || ? || ? ||
|-
| 0x38 || 0x4 || ? || ? ||
|}

==== PC (Remastered) ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || [[#D3D11_TEXTURE_ADDRESS_MODE|D3D11_TEXTURE_ADDRESS_MODE]] || ? || Address mode U ||
|-
| 0x4 || 0x4 || [[#D3D11_TEXTURE_ADDRESS_MODE|D3D11_TEXTURE_ADDRESS_MODE]] || ? || Address mode V ||
|-
| 0x8 || 0x4 || [[#D3D11_TEXTURE_ADDRESS_MODE|D3D11_TEXTURE_ADDRESS_MODE]] || ? || Address mode W ||
|-
| 0xC || 0x4 || [[#D3D11_FILTER_TYPE|D3D11_FILTER_TYPE]] || ? || Magnification filter || if any filter is set to 2, game uses anisotropic filtering
|-
| 0x10 || 0x4 || [[#D3D11_FILTER_TYPE|D3D11_FILTER_TYPE]] || ? || Minification filter ||
|-
| 0x14 || 0x4 || [[#D3D11_FILTER_TYPE|D3D11_FILTER_TYPE]] || ? || Mipmap filter ||
|-
| 0x18 || 0x4 || float || ? || Minimum LOD ||
|-
| 0x1C || 0x4 || float || ? || Maximum LOD ||
|-
| 0x20 || 0x4 || uint32_t || ? || Maximum anisotropy ||
|-
| 0x24 || 0x4 || float || ? || Mipmap LOD bias ||
|-
| 0x28 || 0x4 || [[#D3D11_COMPARISON_FUNC|D3D11_COMPARISON_FUNC]] || ? || Comparsion function || If set to -1, D3D11_COMPARISON_ALWAYS used
|-
| 0x2C || 0x1 || bool || ? || White border color || Set to black if false
|-
| 0x2D || 0x3 || || ? || Padding ||
|-
| 0x30 || 0x4 || uint32_t || ? || Reference count || Initially set to 1<br />Decremented by each call to Release on the interface
|-
| 0x34 || 0x4 || [https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nn-d3d11-id3d11samplerstate ID3D11SamplerState]* || ? || Sampler state interface || Set at runtime
|}

==== PlayStation 4, Switch ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || [[#D3D11_TEXTURE_ADDRESS_MODE|D3D11_TEXTURE_ADDRESS_MODE]] || ? || Address mode U ||
|-
| 0x4 || 0x4 || [[#D3D11_TEXTURE_ADDRESS_MODE|D3D11_TEXTURE_ADDRESS_MODE]] || ? || Address mode V ||
|-
| 0x8 || 0x4 || [[#D3D11_TEXTURE_ADDRESS_MODE|D3D11_TEXTURE_ADDRESS_MODE]] || ? || Address mode W ||
|-
| 0xC || 0x4 || [[#D3D11_FILTER_TYPE|D3D11_FILTER_TYPE]] || ? || Magnification filter || if any filter is set to 2, game uses anisotropic filtering
|-
| 0x10 || 0x4 || [[#D3D11_FILTER_TYPE|D3D11_FILTER_TYPE]] || ? || Minification filter ||
|-
| 0x14 || 0x4 || [[#D3D11_FILTER_TYPE|D3D11_FILTER_TYPE]] || ? || Mipmap filter ||
|-
| 0x18 || 0x4 || float || ? || Minimum LOD ||
|-
| 0x1C || 0x4 || float || ? || Maximum LOD ||
|-
| 0x20 || 0x4 || uint32_t || ? || Maximum anisotropy ||
|-
| 0x24 || 0x4 || float || ? || Mipmap LOD bias ||
|-
| 0x28 || 0x4 || [[#D3D11_COMPARISON_FUNC|D3D11_COMPARISON_FUNC]] || ? || Comparsion function || If set to -1, D3D11_COMPARISON_ALWAYS used
|-
| 0x2C || 0x1 || bool || ? || White border color || Set to black if false
|-
| 0x2D || 0x3 || || ? || Padding ||
|-
| 0x30 || 0x4 || uint32_t || ? || Reference count || Initially set to 1<br />Decremented by each call to Release on the interface
|-
| 0x34 || 0x4 || || ? || Padding ||
|-
| 0x38 || 0x8 || [https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nn-d3d11-id3d11samplerstate ID3D11SamplerState]* || ? || Sampler state interface || Set at runtime
|}

= Typedefs =
=== D3DCOLOR ===
From the [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dcolor Microsoft Learn page].

{| class="wikitable"
! Name !! Type !! Length !! Comments
|-
| D3DCOLOR || DWORD || 0x4 || A four byte value that typically represents the alpha, red, green, and blue components of a color. It can also represent luminance and brightness.
|}

= Enumerations =
=== D3DTEXTUREADDRESS ===
From the [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtextureaddress Microsoft Learn page].

{| class="wikitable"
! Name !! Value !! Comments
|-
| D3DTADDRESS_WRAP || 1 || Tile the texture at every integer junction. For example, for u values between 0 and 3, the texture is repeated three times; no mirroring is performed.
|-
| D3DTADDRESS_MIRROR || 2 || Similar to D3DTADDRESS_WRAP, except that the texture is flipped at every integer junction. For u values between 0 and 1, for example, the texture is addressed normally; between 1 and 2, the texture is flipped (mirrored); between 2 and 3, the texture is normal again; and so on.
|-
| D3DTADDRESS_CLAMP || 3 || Texture coordinates outside the range [0.0, 1.0] are set to the texture color at 0.0 or 1.0, respectively.
|-
| D3DTADDRESS_BORDER || 4 || Texture coordinates outside the range [0.0, 1.0] are set to the border color.
|-
| D3DTADDRESS_MIRRORONCE || 5 || Similar to D3DTADDRESS_MIRROR and D3DTADDRESS_CLAMP. Takes the absolute value of the texture coordinate (thus, mirroring around 0), and then clamps to the maximum value. The most common usage is for volume textures, where support for the full D3DTADDRESS_MIRRORONCE texture-addressing mode is not necessary, but the data is symmetric around the one axis.
|-
| D3DTADDRESS_FORCE_DWORD || 0x7FFFFFFF || Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.
|}

=== D3DTEXTUREFILTERTYPE ===
From the [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtexturefiltertype Microsoft Learn page].

{| class="wikitable"
! Name !! Value !! Comments
|-
| D3DTEXF_NONE || 0 || When used with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MIPFILTER], disables mipmapping.
|-
| D3DTEXF_POINT || 1 || When used with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MAGFILTER] or [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MINFILTER], specifies that point filtering is to be used as the texture magnification or minification filter respectively. When used with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MIPFILTER], enables mipmapping and specifies that the rasterizer chooses the color from the texel of the nearest mip level.
|-
| D3DTEXF_LINEAR || 2 || When used with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MAGFILTER] or [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MINFILTER], specifies that linear filtering is to be used as the texture magnification or minification filter respectively. When used with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MIPFILTER], enables mipmapping and trilinear filtering; it specifies that the rasterizer interpolates between the two nearest mip levels.
|-
| D3DTEXF_ANISOTROPIC || 3 || When used with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MAGFILTER] or [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MINFILTER], specifies that anisotropic texture filtering used as a texture magnification or minification filter respectively. Compensates for distortion caused by the difference in angle between the texture polygon and the plane of the screen. Use with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MIPFILTER] is undefined.
|-
| D3DTEXF_PYRAMIDALQUAD || 6 || A 4-sample tent filter used as a texture magnification or minification filter. Use with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MIPFILTER] is undefined.
|-
| D3DTEXF_GAUSSIANQUAD || 7 || A 4-sample Gaussian filter used as a texture magnification or minification filter. Use with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MIPFILTER] is undefined.
|-
| D3DTEXF_CONVOLUTIONMONO || 8 || Convolution filter for monochrome textures. See [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dformat D3DFMT_A1]. This flag is available in Direct3D 9Ex only. Use with [https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype D3DSAMP_MIPFILTER] is undefined.
|-
| D3DTEXF_FORCE_DWORD || 0x7FFFFFFF || Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.
|}

=== D3D11_TEXTURE_ADDRESS_MODE ===
From the [https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_texture_address_mode Microsoft Learn page].

{| class="wikitable"
! Name !! Value !! Comments
|-
| D3D11_TEXTURE_ADDRESS_WRAP || 1 || Tile the texture at every (u,v) integer junction. For example, for u values between 0 and 3, the texture is repeated three times.
|-
| D3D11_TEXTURE_ADDRESS_MIRROR || 2 || Flip the texture at every (u,v) integer junction. For u values between 0 and 1, for example, the texture is addressed normally; between 1 and 2, the texture is flipped (mirrored); between 2 and 3, the texture is normal again; and so on.
|-
| D3D11_TEXTURE_ADDRESS_CLAMP || 3 || Texture coordinates outside the range [0.0, 1.0] are set to the texture color at 0.0 or 1.0, respectively.
|-
| D3D11_TEXTURE_ADDRESS_BORDER || 4 || Texture coordinates outside the range [0.0, 1.0] are set to the border color specified in [https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ns-d3d11-d3d11_sampler_desc D3D11_SAMPLER_DESC] or HLSL code.
|-
| D3D11_TEXTURE_ADDRESS_MIRROR_ONCE || 5 || Similar to D3D11_TEXTURE_ADDRESS_MIRROR and D3D11_TEXTURE_ADDRESS_CLAMP. Takes the absolute value of the texture coordinate (thus, mirroring around 0), and then clamps to the maximum value.
|}

=== D3D11_FILTER_TYPE ===
From the [https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_filter_type Microsoft Learn page].

{| class="wikitable"
! Name !! Value !! Comments
|-
| D3D11_FILTER_TYPE_POINT || 0 || Point filtering used as a texture magnification or minification filter. The texel with coordinates nearest to the desired pixel value is used. The texture filter to be used between mipmap levels is nearest-point mipmap filtering. The rasterizer uses the color from the texel of the nearest mipmap texture.
|-
| D3D11_FILTER_TYPE_LINEAR || 1 || Bilinear interpolation filtering used as a texture magnification or minification filter. A weighted average of a 2 x 2 area of texels surrounding the desired pixel is used. The texture filter to use between mipmap levels is trilinear mipmap interpolation. The rasterizer linearly interpolates pixel color, using the texels of the two nearest mipmap textures.
|}

=== D3D11_COMPARISON_FUNC ===
From the [https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_comparison_func Microsoft Learn page].

{| class="wikitable"
! Name !! Value !! Comments
|-
| D3D11_COMPARISON_NEVER || 1 || Never pass the comparison.
|-
| D3D11_COMPARISON_LESS || 2 || If the source data is less than the destination data, the comparison passes.
|-
| D3D11_COMPARISON_EQUAL || 3 || If the source data is equal to the destination data, the comparison passes.
|-
| D3D11_COMPARISON_LESS_EQUAL || 4 || If the source data is less than or equal to the destination data, the comparison passes.
|-
| D3D11_COMPARISON_GREATER || 5 || If the source data is greater than the destination data, the comparison passes.
|-
| D3D11_COMPARISON_NOT_EQUAL || 6 || If the source data is not equal to the destination data, the comparison passes.
|-
| D3D11_COMPARISON_GREATER_EQUAL || 7 || If the source data is greater than or equal to the destination data, the comparison passes.
|-
| D3D11_COMPARISON_ALWAYS || 8 || Always pass the comparison.
|}

Latest revision as of 05:11, 21 September 2023

TextureState
aka RwTextureState
No Example
Resource names Unknown
Type ID 0xE
Category Generic
Memory
distribution
Main Memory only
Imports Texture
Imported by Material
Editor
available?
No

Texture states describe texture attributes such as mipmapping, filtering, and the border color.

Variants

PlayStation 3
Information on the Texture State resource type used on PlayStation 3.
Xbox 360
Information on the Texture State resource type used on Xbox 360.
PC
Information on the Texture State resource type used on PC.
Remastered
Information on the Texture State resource type used in Burnout Paradise Remastered.