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 BindTexture(long Key, int Index);
|
||||
|
||||
void Set(long Key);
|
||||
|
||||
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);
|
||||
|
||||
void Bind(long Key, int Index);
|
||||
|
||||
void SetSampler(long Key, GalTextureSampler Sampler);
|
||||
void Bind(long Key, int Index, 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)
|
||||
{
|
||||
if (Texture.TryGetImage(Key, out ImageHandler Tex))
|
||||
|
|
|
@ -185,19 +185,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
return false;
|
||||
}
|
||||
|
||||
public void Bind(long Key, int Index)
|
||||
{
|
||||
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)
|
||||
public void Bind(long Key, int Index, GalTextureSampler Sampler)
|
||||
{
|
||||
if (!TextureCache.TryGetValue(Key, out ImageHandler CachedImage))
|
||||
{
|
||||
|
@ -206,6 +194,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
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 WrapT = (int)OGLEnumConverter.GetTextureWrapMode(Sampler.AddressV);
|
||||
|
||||
|
|
|
@ -260,7 +260,6 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
OperB = GetOperGpr20(OpCode);
|
||||
break;
|
||||
|
||||
//Unsure about this layout
|
||||
case ShaderTextureType._2dArray:
|
||||
OperA = GetOperGpr8 (OpCode) + 1;
|
||||
OperB = GetOperGpr20(OpCode);
|
||||
|
|
|
@ -509,47 +509,32 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
|
||||
if (Key == -1)
|
||||
{
|
||||
//FIXME: Should'nt ignore invalid addresses.
|
||||
//FIXME: Shouldn't ignore invalid addresses.
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsFrameBufferPosition(Key))
|
||||
{
|
||||
//This texture is a frame buffer texture,
|
||||
//we shouldn't read anything from memory and bind
|
||||
//the frame buffer texture instead, since we're not
|
||||
//really writing anything to memory.
|
||||
Gpu.Renderer.FrameBuffer.BindTexture(Key, TexIndex);
|
||||
}
|
||||
else
|
||||
//If a texture is a rendertarget texture,
|
||||
//we shouldn't read anything from memory and just bind it
|
||||
|
||||
if (!IsFrameBufferPosition(Key))
|
||||
{
|
||||
GalImage NewImage = TextureFactory.MakeTexture(Vmm, TicPosition);
|
||||
|
||||
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 (NewImage.Equals(Image) && !QueryKeyUpload(Vmm, Key, Size, NvGpuBufferType.Texture))
|
||||
{
|
||||
Gpu.Renderer.Texture.Bind(Key, TexIndex);
|
||||
|
||||
HasCachedTexture = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!HasCachedTexture)
|
||||
if (!Exists ||
|
||||
!NewImage.Equals(Image) ||
|
||||
QueryKeyUpload(Vmm, Key, Size, NvGpuBufferType.Texture))
|
||||
{
|
||||
byte[] Data = TextureFactory.GetTextureData(Vmm, TicPosition);
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue