Remove SetSampler and BindTexture calls
This commit is contained in:
parent
9d82220b37
commit
56fde4c02d
6 changed files with 16 additions and 54 deletions
|
@ -12,8 +12,6 @@ namespace Ryujinx.Graphics.Gal
|
||||||
|
|
||||||
void UnbindZeta();
|
void UnbindZeta();
|
||||||
|
|
||||||
void BindTexture(long Key, int Index);
|
|
||||||
|
|
||||||
void Set(long Key);
|
void Set(long Key);
|
||||||
|
|
||||||
void Set(byte[] Data, int Width, int Height);
|
void Set(byte[] Data, int Width, int Height);
|
||||||
|
|
|
@ -11,8 +11,6 @@ namespace Ryujinx.Graphics.Gal
|
||||||
|
|
||||||
bool TryGetCachedTexture(long Key, long DataSize, out GalImage Image);
|
bool TryGetCachedTexture(long Key, long DataSize, out GalImage Image);
|
||||||
|
|
||||||
void Bind(long Key, int Index);
|
void Bind(long Key, int Index, GalTextureSampler Sampler);
|
||||||
|
|
||||||
void SetSampler(long Key, GalTextureSampler Sampler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -148,16 +148,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BindTexture(long Key, int Index)
|
|
||||||
{
|
|
||||||
if (Texture.TryGetImage(Key, out ImageHandler Tex))
|
|
||||||
{
|
|
||||||
GL.ActiveTexture(TextureUnit.Texture0 + Index);
|
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, Tex.Handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Set(long Key)
|
public void Set(long Key)
|
||||||
{
|
{
|
||||||
if (Texture.TryGetImage(Key, out ImageHandler Tex))
|
if (Texture.TryGetImage(Key, out ImageHandler Tex))
|
||||||
|
|
|
@ -185,19 +185,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Bind(long Key, int Index)
|
public void Bind(long Key, int Index, GalTextureSampler Sampler)
|
||||||
{
|
|
||||||
if (TextureCache.TryGetValue(Key, out ImageHandler CachedImage))
|
|
||||||
{
|
|
||||||
TextureTarget Target = OGLEnumConverter.GetImageTarget(CachedImage.Image.Target);
|
|
||||||
|
|
||||||
GL.ActiveTexture(TextureUnit.Texture0 + Index);
|
|
||||||
|
|
||||||
GL.BindTexture(Target, CachedImage.Handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetSampler(long Key, GalTextureSampler Sampler)
|
|
||||||
{
|
{
|
||||||
if (!TextureCache.TryGetValue(Key, out ImageHandler CachedImage))
|
if (!TextureCache.TryGetValue(Key, out ImageHandler CachedImage))
|
||||||
{
|
{
|
||||||
|
@ -206,6 +194,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
|
|
||||||
TextureTarget Target = OGLEnumConverter.GetImageTarget(CachedImage.Image.Target);
|
TextureTarget Target = OGLEnumConverter.GetImageTarget(CachedImage.Image.Target);
|
||||||
|
|
||||||
|
GL.ActiveTexture(TextureUnit.Texture0 + Index);
|
||||||
|
|
||||||
|
GL.BindTexture(Target, CachedImage.Handle);
|
||||||
|
|
||||||
int WrapS = (int)OGLEnumConverter.GetTextureWrapMode(Sampler.AddressU);
|
int WrapS = (int)OGLEnumConverter.GetTextureWrapMode(Sampler.AddressU);
|
||||||
int WrapT = (int)OGLEnumConverter.GetTextureWrapMode(Sampler.AddressV);
|
int WrapT = (int)OGLEnumConverter.GetTextureWrapMode(Sampler.AddressV);
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,6 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
OperB = GetOperGpr20(OpCode);
|
OperB = GetOperGpr20(OpCode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Unsure about this layout
|
|
||||||
case ShaderTextureType._2dArray:
|
case ShaderTextureType._2dArray:
|
||||||
OperA = GetOperGpr8 (OpCode) + 1;
|
OperA = GetOperGpr8 (OpCode) + 1;
|
||||||
OperB = GetOperGpr20(OpCode);
|
OperB = GetOperGpr20(OpCode);
|
||||||
|
|
|
@ -509,47 +509,32 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
|
|
||||||
if (Key == -1)
|
if (Key == -1)
|
||||||
{
|
{
|
||||||
//FIXME: Should'nt ignore invalid addresses.
|
//FIXME: Shouldn't ignore invalid addresses.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsFrameBufferPosition(Key))
|
//If a texture is a rendertarget texture,
|
||||||
{
|
//we shouldn't read anything from memory and just bind it
|
||||||
//This texture is a frame buffer texture,
|
|
||||||
//we shouldn't read anything from memory and bind
|
if (!IsFrameBufferPosition(Key))
|
||||||
//the frame buffer texture instead, since we're not
|
|
||||||
//really writing anything to memory.
|
|
||||||
Gpu.Renderer.FrameBuffer.BindTexture(Key, TexIndex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
GalImage NewImage = TextureFactory.MakeTexture(Vmm, TicPosition);
|
GalImage NewImage = TextureFactory.MakeTexture(Vmm, TicPosition);
|
||||||
|
|
||||||
long Size = (uint)TextureHelper.GetTextureSize(NewImage);
|
long Size = (uint)TextureHelper.GetTextureSize(NewImage);
|
||||||
|
|
||||||
bool HasCachedTexture = false;
|
bool Exists = Gpu.Renderer.Texture.TryGetCachedTexture(Key, Size, out GalImage Image);
|
||||||
|
|
||||||
if (Gpu.Renderer.Texture.TryGetCachedTexture(Key, Size, out GalImage Image))
|
if (!Exists ||
|
||||||
{
|
!NewImage.Equals(Image) ||
|
||||||
if (NewImage.Equals(Image) && !QueryKeyUpload(Vmm, Key, Size, NvGpuBufferType.Texture))
|
QueryKeyUpload(Vmm, Key, Size, NvGpuBufferType.Texture))
|
||||||
{
|
|
||||||
Gpu.Renderer.Texture.Bind(Key, TexIndex);
|
|
||||||
|
|
||||||
HasCachedTexture = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!HasCachedTexture)
|
|
||||||
{
|
{
|
||||||
byte[] Data = TextureFactory.GetTextureData(Vmm, TicPosition);
|
byte[] Data = TextureFactory.GetTextureData(Vmm, TicPosition);
|
||||||
|
|
||||||
Gpu.Renderer.Texture.Create(Key, Data, NewImage);
|
Gpu.Renderer.Texture.Create(Key, Data, NewImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gpu.Renderer.Texture.Bind(Key, TexIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Gpu.Renderer.Texture.SetSampler(Key, Sampler);
|
Gpu.Renderer.Texture.Bind(Key, TexIndex, Sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UploadConstBuffers(NvGpuVmm Vmm, GalPipelineState State, long[] Keys)
|
private void UploadConstBuffers(NvGpuVmm Vmm, GalPipelineState State, long[] Keys)
|
||||||
|
|
Loading…
Reference in a new issue