Texture filtering (mostly).
This commit is contained in:
parent
f93ffdb36f
commit
175e21bea1
|
@ -1022,6 +1022,9 @@ int D3D11GraphicsDriver::PrepareTextureFetchers() {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Stash a copy of the fetch register.
|
||||
fetcher.fetch = fetch;
|
||||
|
||||
fetcher.info = GetTextureInfo(fetch);
|
||||
if (fetcher.info.format == DXGI_FORMAT_UNKNOWN) {
|
||||
XELOGW("D3D11: unknown texture format %d", fetch.format);
|
||||
|
@ -1345,7 +1348,46 @@ int D3D11GraphicsDriver::PrepareTextureSampler(
|
|||
|
||||
D3D11_SAMPLER_DESC sampler_desc;
|
||||
xe_zero_struct(&sampler_desc, sizeof(sampler_desc));
|
||||
sampler_desc.Filter;
|
||||
uint32_t min_filter = desc.tex_fetch.min_filter == 3 ?
|
||||
fetcher.fetch.min_filter : desc.tex_fetch.min_filter;
|
||||
uint32_t mag_filter = desc.tex_fetch.mag_filter == 3 ?
|
||||
fetcher.fetch.mag_filter : desc.tex_fetch.mag_filter;
|
||||
uint32_t mip_filter = desc.tex_fetch.mip_filter == 3 ?
|
||||
fetcher.fetch.mip_filter : desc.tex_fetch.mip_filter;
|
||||
// MIN, MAG, MIP
|
||||
static const D3D11_FILTER filter_matrix[2][2][3] = {
|
||||
{
|
||||
// min = POINT
|
||||
{
|
||||
// mag = POINT
|
||||
D3D11_FILTER_MIN_MAG_MIP_POINT,
|
||||
D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR,
|
||||
D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR, // basemap?
|
||||
},
|
||||
{
|
||||
// mag = LINEAR
|
||||
D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT,
|
||||
D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR,
|
||||
D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR, // basemap?
|
||||
},
|
||||
},
|
||||
{
|
||||
// min = LINEAR
|
||||
{
|
||||
// mag = POINT
|
||||
D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT,
|
||||
D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR,
|
||||
D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR, // basemap?
|
||||
},
|
||||
{
|
||||
// mag = LINEAR
|
||||
D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT,
|
||||
D3D11_FILTER_MIN_MAG_MIP_LINEAR,
|
||||
D3D11_FILTER_MIN_MAG_MIP_LINEAR, // basemap?
|
||||
},
|
||||
},
|
||||
};
|
||||
sampler_desc.Filter = filter_matrix[min_filter][mag_filter][mip_filter];
|
||||
sampler_desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
sampler_desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
sampler_desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
|
|
|
@ -124,6 +124,7 @@ private:
|
|||
|
||||
struct {
|
||||
bool enabled;
|
||||
xenos::xe_gpu_texture_fetch_t fetch;
|
||||
TextureInfo info;
|
||||
ID3D11ShaderResourceView* view;
|
||||
} texture_fetchers[32];
|
||||
|
|
|
@ -146,7 +146,17 @@ XEPACKEDUNION(xe_gpu_texture_fetch_t, {
|
|||
uint32_t depth : 10;
|
||||
} size_3d;
|
||||
};
|
||||
uint32_t unk3; // dword_3
|
||||
uint32_t unk3_0 : 1; // dword_3
|
||||
uint32_t swiz_x : 3;
|
||||
uint32_t swiz_y : 3;
|
||||
uint32_t swiz_z : 3;
|
||||
uint32_t swiz_w : 3;
|
||||
uint32_t unk3_1 : 6;
|
||||
uint32_t mag_filter : 2;
|
||||
uint32_t min_filter : 2;
|
||||
uint32_t mip_filter : 2;
|
||||
uint32_t unk3_2 : 6;
|
||||
uint32_t border : 1;
|
||||
uint32_t unk4; // dword_4
|
||||
uint32_t unk5 : 9; // dword_5
|
||||
uint32_t dimension : 2;
|
||||
|
|
Loading…
Reference in New Issue