mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-08 09:09:46 +00:00
more rsx texture (filters)
implemented deswizzling of textures (only one format for now, a fix for multiple context sample)
This commit is contained in:
parent
48115b153e
commit
6846d15dc8
5 changed files with 154 additions and 77 deletions
|
@ -1107,3 +1107,32 @@ void GLGSRender::Flip()
|
||||||
checkForGlError("glScissor");
|
checkForGlError("glScissor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t LinearToSwizzleAddress(
|
||||||
|
uint32_t x, uint32_t y, uint32_t z,
|
||||||
|
uint32_t log2_width, uint32_t log2_height, uint32_t log2_depth)
|
||||||
|
{
|
||||||
|
uint32_t offset = 0;
|
||||||
|
uint32_t shift_count = 0;
|
||||||
|
while(log2_width | log2_height | log2_depth){
|
||||||
|
if(log2_width){
|
||||||
|
offset |= (x & 0x01) << shift_count;
|
||||||
|
x >>= 1;
|
||||||
|
++shift_count;
|
||||||
|
--log2_width;
|
||||||
|
}
|
||||||
|
if(log2_height){
|
||||||
|
offset |= (y & 0x01) << shift_count;
|
||||||
|
y >>= 1;
|
||||||
|
++shift_count;
|
||||||
|
--log2_height;
|
||||||
|
}
|
||||||
|
if(log2_depth){
|
||||||
|
offset |= (z & 0x01) << shift_count;
|
||||||
|
z >>= 1;
|
||||||
|
++shift_count;
|
||||||
|
--log2_depth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return offset;
|
||||||
|
}
|
|
@ -14,6 +14,9 @@
|
||||||
|
|
||||||
extern GLenum g_last_gl_error;
|
extern GLenum g_last_gl_error;
|
||||||
void printGlError(GLenum err, const char* situation);
|
void printGlError(GLenum err, const char* situation);
|
||||||
|
uint32_t LinearToSwizzleAddress(
|
||||||
|
uint32_t x, uint32_t y, uint32_t z,
|
||||||
|
uint32_t log2_width, uint32_t log2_height, uint32_t log2_depth);
|
||||||
|
|
||||||
#if RSX_DEBUG
|
#if RSX_DEBUG
|
||||||
#define checkForGlError(sit) if((g_last_gl_error = glGetError()) != GL_NO_ERROR) printGlError(g_last_gl_error, sit)
|
#define checkForGlError(sit) if((g_last_gl_error = glGetError()) != GL_NO_ERROR) printGlError(g_last_gl_error, sit)
|
||||||
|
@ -81,6 +84,7 @@ public:
|
||||||
|
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, tex.m_pitch);
|
glPixelStorei(GL_PACK_ALIGNMENT, tex.m_pitch);
|
||||||
char* pixels = (char*)Memory.GetMemFromAddr(GetAddress(tex.GetOffset(), tex.GetLocation()));
|
char* pixels = (char*)Memory.GetMemFromAddr(GetAddress(tex.GetOffset(), tex.GetLocation()));
|
||||||
|
char* unswizzledPixels;
|
||||||
|
|
||||||
switch(format)
|
switch(format)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +101,28 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x85:
|
case 0x85:
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.GetWidth(), tex.GetHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, pixels);
|
if(is_swizzled)
|
||||||
|
{
|
||||||
|
uint32_t *src, *dst;
|
||||||
|
uint32_t log2width, log2height;
|
||||||
|
|
||||||
|
unswizzledPixels = (char*)malloc(tex.GetWidth() * tex.GetHeight() * 4);
|
||||||
|
src = (uint32_t*)pixels;
|
||||||
|
dst = (uint32_t*)unswizzledPixels;
|
||||||
|
|
||||||
|
log2width = log(tex.GetWidth())/log(2);
|
||||||
|
log2height = log(tex.GetHeight())/log(2);
|
||||||
|
|
||||||
|
for(int i=0; i<tex.GetHeight(); i++)
|
||||||
|
{
|
||||||
|
for(int j=0; j<tex.GetWidth(); j++)
|
||||||
|
{
|
||||||
|
dst[(i*tex.GetHeight()) + j] = src[LinearToSwizzleAddress(j, i, 0, log2width, log2height, 0)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.GetWidth(), tex.GetHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, is_swizzled ? unswizzledPixels : pixels);
|
||||||
checkForGlError("GLTexture::Init() -> glTexImage2D");
|
checkForGlError("GLTexture::Init() -> glTexImage2D");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -150,7 +175,7 @@ public:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: ConLog.Error("Init tex error: Bad tex format (0x%x | 0x%x | 0x%x)", format, tex.GetFormat() & 0x20, tex.GetFormat() & 0x40); break;
|
default: ConLog.Error("Init tex error: Bad tex format (0x%x | %s | 0x%x)", format, is_swizzled ? "swizzled" : "linear", tex.GetFormat() & 0x40); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, tex.Getmipmap() - 1);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, tex.Getmipmap() - 1);
|
||||||
|
@ -198,7 +223,7 @@ public:
|
||||||
|
|
||||||
checkForGlError("GLTexture::Init() -> parameters1");
|
checkForGlError("GLTexture::Init() -> parameters1");
|
||||||
|
|
||||||
glTexEnvi(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, tex.m_bias);
|
glTexEnvi(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, tex.GetBias());
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, (tex.GetMinLOD() >> 8));
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, (tex.GetMinLOD() >> 8));
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, (tex.GetMaxLOD() >> 8));
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, (tex.GetMaxLOD() >> 8));
|
||||||
|
|
||||||
|
@ -216,12 +241,17 @@ public:
|
||||||
GL_NEAREST,
|
GL_NEAREST,
|
||||||
};
|
};
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_tex_filter[tex.m_min_filter]);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_tex_filter[tex.GetMinFilter()]);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_tex_filter[tex.m_mag_filter]);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_tex_filter[tex.GetMagFilter()]);
|
||||||
|
|
||||||
checkForGlError("GLTexture::Init() -> filters");
|
checkForGlError("GLTexture::Init() -> filters");
|
||||||
|
|
||||||
//Unbind();
|
//Unbind();
|
||||||
|
|
||||||
|
if(is_swizzled && format == 0x85)
|
||||||
|
{
|
||||||
|
free(unswizzledPixels);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Save(RSXTexture& tex, const wxString& name)
|
void Save(RSXTexture& tex, const wxString& name)
|
||||||
|
|
|
@ -2,17 +2,11 @@
|
||||||
#include "RSXThread.h"
|
#include "RSXThread.h"
|
||||||
|
|
||||||
RSXTexture::RSXTexture()
|
RSXTexture::RSXTexture()
|
||||||
: m_bias(0)
|
|
||||||
, m_min_filter(1)
|
|
||||||
, m_mag_filter(2)
|
|
||||||
{
|
{
|
||||||
m_index = 0;
|
m_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RSXTexture::RSXTexture(u8 index)
|
RSXTexture::RSXTexture(u8 index)
|
||||||
: m_bias(0)
|
|
||||||
, m_min_filter(1)
|
|
||||||
, m_mag_filter(2)
|
|
||||||
{
|
{
|
||||||
m_index = index;
|
m_index = index;
|
||||||
}
|
}
|
||||||
|
@ -20,137 +14,185 @@ RSXTexture::RSXTexture(u8 index)
|
||||||
void RSXTexture::Init()
|
void RSXTexture::Init()
|
||||||
{
|
{
|
||||||
// Offset
|
// Offset
|
||||||
methodRegisters[NV4097_SET_TEXTURE_OFFSET + (m_index*4)] = 0;
|
methodRegisters[NV4097_SET_TEXTURE_OFFSET + (m_index*32)] = 0;
|
||||||
|
|
||||||
// Format
|
// Format
|
||||||
methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*4)] = 0;
|
methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] = 0;
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)] =
|
methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] =
|
||||||
((/*wraps*/1) | ((/*anisoBias*/0) << 4) | ((/*wrapt*/1) << 8) | ((/*unsignedRemap*/0) << 12) |
|
((/*wraps*/1) | ((/*anisoBias*/0) << 4) | ((/*wrapt*/1) << 8) | ((/*unsignedRemap*/0) << 12) |
|
||||||
((/*wrapr*/2) << 16) | ((/*gamma*/0) << 20) |((/*signedRemap*/0) << 24) | ((/*zfunc*/0) << 28));
|
((/*wrapr*/2) << 16) | ((/*gamma*/0) << 20) |((/*signedRemap*/0) << 24) | ((/*zfunc*/0) << 28));
|
||||||
|
|
||||||
// Control0
|
// Control0
|
||||||
methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*4)] =
|
methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] =
|
||||||
(((/*alphakill*/0) << 2) | (/*maxaniso*/0) << 4) | ((/*maxlod*/0xc00) << 7) | ((/*minlod*/0) << 19) | ((/*enable*/0) << 31);
|
(((/*alphakill*/0) << 2) | (/*maxaniso*/0) << 4) | ((/*maxlod*/0xc00) << 7) | ((/*minlod*/0) << 19) | ((/*enable*/0) << 31);
|
||||||
|
|
||||||
|
// Control1
|
||||||
|
methodRegisters[NV4097_SET_TEXTURE_CONTROL1 + (m_index*32)] = 0xE4;
|
||||||
|
|
||||||
|
// Filter
|
||||||
|
methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] =
|
||||||
|
((/*bias*/0) | ((/*conv*/1) << 13) | ((/*min*/5) << 16) | ((/*mag*/2) << 24)
|
||||||
|
| ((/*as*/0) << 28) | ((/*rs*/0) << 29) | ((/*gs*/0) << 30) | ((/*bs*/0) << 31) );
|
||||||
|
|
||||||
// Image Rect
|
// Image Rect
|
||||||
methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*4)] = (/*height*/1) | ((/*width*/1) << 16);
|
methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*32)] = (/*height*/1) | ((/*width*/1) << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 RSXTexture::GetOffset() const
|
u32 RSXTexture::GetOffset() const
|
||||||
{
|
{
|
||||||
return methodRegisters[NV4097_SET_TEXTURE_OFFSET + (m_index*4)];
|
return methodRegisters[NV4097_SET_TEXTURE_OFFSET + (m_index*32)];
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetLocation() const
|
u8 RSXTexture::GetLocation() const
|
||||||
{
|
{
|
||||||
return (methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*4)] & 0x3) - 1;
|
return (methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] & 0x3) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RSXTexture::isCubemap() const
|
bool RSXTexture::isCubemap() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*4)] >> 2) & 0x1);
|
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 2) & 0x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetBorderType() const
|
u8 RSXTexture::GetBorderType() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*4)] >> 3) & 0x1);
|
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 3) & 0x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetDimension() const
|
u8 RSXTexture::GetDimension() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*4)] >> 4) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 4) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetFormat() const
|
u8 RSXTexture::GetFormat() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*4)] >> 8) & 0xff);
|
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 8) & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 RSXTexture::Getmipmap() const
|
u16 RSXTexture::Getmipmap() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*4)] >> 16) & 0xffff);
|
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 16) & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetWrapS() const
|
u8 RSXTexture::GetWrapS() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)]) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)]) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetWrapT() const
|
u8 RSXTexture::GetWrapT() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)] >> 8) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 8) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetWrapR() const
|
u8 RSXTexture::GetWrapR() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)] >> 16) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 16) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetUnsignedRemap() const
|
u8 RSXTexture::GetUnsignedRemap() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)] >> 12) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 12) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetZfunc() const
|
u8 RSXTexture::GetZfunc() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)] >> 28) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 28) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetGamma() const
|
u8 RSXTexture::GetGamma() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)] >> 20) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 20) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetAnisoBias() const
|
u8 RSXTexture::GetAnisoBias() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)] >> 4) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 4) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetSignedRemap() const
|
u8 RSXTexture::GetSignedRemap() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*4)] >> 24) & 0xf);
|
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 24) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RSXTexture::IsEnabled() const
|
bool RSXTexture::IsEnabled() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*4)] >> 31) & 0x1);
|
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 31) & 0x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 RSXTexture::GetMinLOD() const
|
u16 RSXTexture::GetMinLOD() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*4)] >> 19) & 0xfff);
|
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 19) & 0xfff);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 RSXTexture::GetMaxLOD() const
|
u16 RSXTexture::GetMaxLOD() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*4)] >> 7) & 0xfff);
|
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 7) & 0xfff);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 RSXTexture::GetMaxAniso() const
|
u8 RSXTexture::GetMaxAniso() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*4)] >> 4) & 0x7);
|
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 4) & 0x7);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RSXTexture::IsAlphaKillEnabled() const
|
bool RSXTexture::IsAlphaKillEnabled() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*4)] >> 2) & 0x1);
|
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 2) & 0x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 RSXTexture::GetRemap() const
|
u32 RSXTexture::GetRemap() const
|
||||||
{
|
{
|
||||||
return (methodRegisters[NV4097_SET_TEXTURE_CONTROL1 + (m_index*4)]);
|
return (methodRegisters[NV4097_SET_TEXTURE_CONTROL1 + (m_index*32)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 RSXTexture::GetBias() const
|
||||||
|
{
|
||||||
|
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)]) & 0x1fff);
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 RSXTexture::GetMinFilter() const
|
||||||
|
{
|
||||||
|
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 16) & 0x7);
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 RSXTexture::GetMagFilter() const
|
||||||
|
{
|
||||||
|
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 24) & 0x7);
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 RSXTexture::GetConvolutionFilter() const
|
||||||
|
{
|
||||||
|
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 13) & 0xf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RSXTexture::isASigned() const
|
||||||
|
{
|
||||||
|
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 28) & 0x1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RSXTexture::isRSigned() const
|
||||||
|
{
|
||||||
|
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 29) & 0x1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RSXTexture::isGSigned() const
|
||||||
|
{
|
||||||
|
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 30) & 0x1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RSXTexture::isBSigned() const
|
||||||
|
{
|
||||||
|
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 31) & 0x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 RSXTexture::GetWidth() const
|
u16 RSXTexture::GetWidth() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*4)] >> 16) & 0xffff);
|
return ((methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*32)] >> 16) & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 RSXTexture::GetHeight() const
|
u16 RSXTexture::GetHeight() const
|
||||||
{
|
{
|
||||||
return ((methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*4)]) & 0xffff);
|
return ((methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*32)]) & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSXTexture::SetControl3(u16 depth, u32 pitch)
|
void RSXTexture::SetControl3(u16 depth, u32 pitch)
|
||||||
|
@ -158,15 +200,3 @@ void RSXTexture::SetControl3(u16 depth, u32 pitch)
|
||||||
m_depth = depth;
|
m_depth = depth;
|
||||||
m_pitch = pitch;
|
m_pitch = pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSXTexture::SetFilter(u16 bias, u8 min, u8 mag, u8 conv, u8 a_signed, u8 r_signed, u8 g_signed, u8 b_signed)
|
|
||||||
{
|
|
||||||
m_bias = bias;
|
|
||||||
m_min_filter = min;
|
|
||||||
m_mag_filter = mag;
|
|
||||||
m_conv = conv;
|
|
||||||
m_a_signed = a_signed;
|
|
||||||
m_r_signed = r_signed;
|
|
||||||
m_g_signed = g_signed;
|
|
||||||
m_b_signed = b_signed;
|
|
||||||
}
|
|
|
@ -288,18 +288,6 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||||
|
|
||||||
case_16(NV4097_SET_TEXTURE_FILTER, 0x20):
|
case_16(NV4097_SET_TEXTURE_FILTER, 0x20):
|
||||||
{
|
{
|
||||||
RSXTexture& tex = m_textures[index];
|
|
||||||
u32 a0 = ARGS(0);
|
|
||||||
u16 bias = a0 & 0x1fff;
|
|
||||||
u8 conv = (a0 >> 13) & 0xf;
|
|
||||||
u8 min = (a0 >> 16) & 0x7;
|
|
||||||
u8 mag = (a0 >> 24) & 0x7;
|
|
||||||
u8 a_signed = (a0 >> 28) & 0x1;
|
|
||||||
u8 r_signed = (a0 >> 29) & 0x1;
|
|
||||||
u8 g_signed = (a0 >> 30) & 0x1;
|
|
||||||
u8 b_signed = (a0 >> 31) & 0x1;
|
|
||||||
|
|
||||||
tex.SetFilter(bias, min, mag, conv, a_signed, r_signed, g_signed, b_signed);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,6 @@ public:
|
||||||
u32 m_pitch;
|
u32 m_pitch;
|
||||||
u16 m_depth;
|
u16 m_depth;
|
||||||
|
|
||||||
u16 m_bias;
|
|
||||||
u8 m_min_filter;
|
|
||||||
u8 m_mag_filter;
|
|
||||||
u8 m_conv;
|
|
||||||
u8 m_a_signed;
|
|
||||||
u8 m_r_signed;
|
|
||||||
u8 m_g_signed;
|
|
||||||
u8 m_b_signed;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RSXTexture();
|
RSXTexture();
|
||||||
RSXTexture(u8 index);
|
RSXTexture(u8 index);
|
||||||
|
@ -67,12 +58,21 @@ public:
|
||||||
// Control1
|
// Control1
|
||||||
u32 GetRemap() const;
|
u32 GetRemap() const;
|
||||||
|
|
||||||
|
// Filter
|
||||||
|
u16 GetBias() const;
|
||||||
|
u8 GetMinFilter() const;
|
||||||
|
u8 GetMagFilter() const;
|
||||||
|
u8 GetConvolutionFilter() const;
|
||||||
|
bool isASigned() const;
|
||||||
|
bool isRSigned() const;
|
||||||
|
bool isGSigned() const;
|
||||||
|
bool isBSigned() const;
|
||||||
|
|
||||||
// Image Rect
|
// Image Rect
|
||||||
u16 GetWidth() const;
|
u16 GetWidth() const;
|
||||||
u16 GetHeight() const;
|
u16 GetHeight() const;
|
||||||
|
|
||||||
void SetControl3(u16 depth, u32 pitch);
|
void SetControl3(u16 depth, u32 pitch);
|
||||||
void SetFilter(u16 bias, u8 min, u8 mag, u8 conv, u8 a_signed, u8 r_signed, u8 g_signed, u8 b_signed);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RSXVertexData
|
struct RSXVertexData
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue