mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[d3d11] Use combined image sampler descriptors for the presenter
This commit is contained in:
parent
257c19ed0a
commit
632b254714
@ -286,11 +286,11 @@ namespace dxvk {
|
||||
m_context->setInputAssemblyState(m_iaState);
|
||||
m_context->setInputLayout(0, nullptr, 0, nullptr);
|
||||
|
||||
m_context->bindResourceSampler(BindingIds::Sampler, fitSize ? m_samplerFitting : m_samplerScaling);
|
||||
m_context->bindResourceSampler(BindingIds::GammaSmp, m_gammaSampler);
|
||||
m_context->bindResourceSampler(BindingIds::Image, fitSize ? m_samplerFitting : m_samplerScaling);
|
||||
m_context->bindResourceSampler(BindingIds::Gamma, m_gammaSampler);
|
||||
|
||||
m_context->bindResourceView(BindingIds::Texture, m_swapImageView, nullptr);
|
||||
m_context->bindResourceView(BindingIds::GammaTex, m_gammaTextureView, nullptr);
|
||||
m_context->bindResourceView(BindingIds::Image, m_swapImageView, nullptr);
|
||||
m_context->bindResourceView(BindingIds::Gamma, m_gammaTextureView, nullptr);
|
||||
|
||||
m_context->draw(4, 1, 0, 0);
|
||||
|
||||
@ -664,11 +664,9 @@ namespace dxvk {
|
||||
const SpirvCodeBuffer vsCode(dxgi_presenter_vert);
|
||||
const SpirvCodeBuffer fsCode(dxgi_presenter_frag);
|
||||
|
||||
const std::array<DxvkResourceSlot, 4> fsResourceSlots = {{
|
||||
{ BindingIds::Sampler, VK_DESCRIPTOR_TYPE_SAMPLER, VK_IMAGE_VIEW_TYPE_MAX_ENUM },
|
||||
{ BindingIds::Texture, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_IMAGE_VIEW_TYPE_2D },
|
||||
{ BindingIds::GammaSmp, VK_DESCRIPTOR_TYPE_SAMPLER, VK_IMAGE_VIEW_TYPE_MAX_ENUM },
|
||||
{ BindingIds::GammaTex, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_IMAGE_VIEW_TYPE_1D },
|
||||
const std::array<DxvkResourceSlot, 2> fsResourceSlots = {{
|
||||
{ BindingIds::Image, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_IMAGE_VIEW_TYPE_2D },
|
||||
{ BindingIds::Gamma, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_IMAGE_VIEW_TYPE_1D },
|
||||
}};
|
||||
|
||||
m_vertShader = m_device->createShader(
|
||||
|
@ -72,10 +72,8 @@ namespace dxvk {
|
||||
private:
|
||||
|
||||
enum BindingIds : uint32_t {
|
||||
Sampler = 0,
|
||||
Texture = 1,
|
||||
GammaSmp = 2,
|
||||
GammaTex = 3,
|
||||
Image = 0,
|
||||
Gamma = 1,
|
||||
};
|
||||
|
||||
Com<D3D11DXGIDevice> m_dxgiDevice;
|
||||
|
@ -2,23 +2,20 @@
|
||||
|
||||
layout(constant_id = 3) const bool s_gamma_bound = false;
|
||||
|
||||
layout(binding = 0) uniform sampler s_sampler;
|
||||
layout(binding = 1) uniform texture2D t_texture;
|
||||
|
||||
layout(binding = 2) uniform sampler s_gamma;
|
||||
layout(binding = 3) uniform texture1D t_gamma;
|
||||
layout(binding = 0) uniform sampler2D s_image;
|
||||
layout(binding = 1) uniform sampler1D s_gamma;
|
||||
|
||||
layout(location = 0) in vec2 i_texcoord;
|
||||
layout(location = 0) out vec4 o_color;
|
||||
|
||||
void main() {
|
||||
o_color = texture(sampler2D(t_texture, s_sampler), i_texcoord);
|
||||
o_color = texture(s_image, i_texcoord);
|
||||
|
||||
if (s_gamma_bound) {
|
||||
o_color = vec4(
|
||||
texture(sampler1D(t_gamma, s_gamma), o_color.r).r,
|
||||
texture(sampler1D(t_gamma, s_gamma), o_color.g).g,
|
||||
texture(sampler1D(t_gamma, s_gamma), o_color.b).b,
|
||||
texture(s_gamma, o_color.r).r,
|
||||
texture(s_gamma, o_color.g).g,
|
||||
texture(s_gamma, o_color.b).b,
|
||||
o_color.a);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user