Minor improvement to Vulkan pipeline state and bindings management (#3829)
* Minor improvement to Vulkan pipeline state and bindings management * Clean up buffer textures too * Use glBindTextureUnit
This commit is contained in:
parent
c6d05301aa
commit
a6a67a2b7a
6 changed files with 103 additions and 124 deletions
|
@ -138,11 +138,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
public void SetImage(int binding, ITexture image, GAL.Format imageFormat)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (image is TextureBuffer imageBuffer)
|
||||
{
|
||||
_bufferImageRefs[binding] = imageBuffer;
|
||||
|
@ -152,6 +147,12 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
_imageRefs[binding] = view.GetView(imageFormat).GetIdentityImageView();
|
||||
}
|
||||
else
|
||||
{
|
||||
_imageRefs[binding] = null;
|
||||
_bufferImageRefs[binding] = null;
|
||||
_bufferImageFormats[binding] = default;
|
||||
}
|
||||
|
||||
SignalDirty(DirtyFlags.Image);
|
||||
}
|
||||
|
@ -215,24 +216,23 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
public void SetTextureAndSampler(CommandBufferScoped cbs, ShaderStage stage, int binding, ITexture texture, ISampler sampler)
|
||||
{
|
||||
if (texture == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (texture is TextureBuffer textureBuffer)
|
||||
{
|
||||
_bufferTextureRefs[binding] = textureBuffer;
|
||||
}
|
||||
else
|
||||
else if (texture is TextureView view)
|
||||
{
|
||||
TextureView view = (TextureView)texture;
|
||||
|
||||
view.Storage.InsertBarrier(cbs, AccessFlags.AccessShaderReadBit, stage.ConvertToPipelineStageFlags());
|
||||
|
||||
_textureRefs[binding] = view.GetImageView();
|
||||
_samplerRefs[binding] = ((SamplerHolder)sampler)?.GetSampler();
|
||||
}
|
||||
else
|
||||
{
|
||||
_textureRefs[binding] = null;
|
||||
_samplerRefs[binding] = null;
|
||||
_bufferTextureRefs[binding] = null;
|
||||
}
|
||||
|
||||
SignalDirty(DirtyFlags.Texture);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue