1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 04:54:15 +01:00

[d3d9] Use uniform texel buffers for conversion

This commit is contained in:
Joshua Ashton 2020-03-02 03:54:38 +00:00
parent 077f48b4ef
commit 1b26fabc6e
4 changed files with 9 additions and 14 deletions

View File

@ -153,7 +153,7 @@ namespace dxvk {
| VK_ACCESS_TRANSFER_WRITE_BIT;
if (m_mapping.ConversionFormatInfo.FormatType != D3D9ConversionFormat_None) {
info.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
info.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT;
info.stages |= VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}

View File

@ -131,8 +131,8 @@ namespace dxvk {
Rc<DxvkShader> D3D9FormatHelper::InitShader(SpirvCodeBuffer code) {
const std::array<DxvkResourceSlot, 2> resourceSlots = { {
{ BindingIds::Image, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_IMAGE_VIEW_TYPE_2D },
{ BindingIds::Buffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_IMAGE_VIEW_TYPE_1D },
{ BindingIds::Image, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_IMAGE_VIEW_TYPE_2D },
{ BindingIds::Buffer, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, VK_IMAGE_VIEW_TYPE_1D },
} };
return m_device->createShader(

View File

@ -1,5 +1,4 @@
#version 450
#extension GL_EXT_shader_16bit_storage : enable
layout(
local_size_x = 8,
@ -9,10 +8,7 @@ layout(
layout(binding = 0)
writeonly uniform image2D dst;
layout(binding = 1)
readonly buffer _buffer_t {
uint16_t data[];
} src;
layout(binding = 1) uniform usamplerBuffer src;
layout(push_constant)
uniform u_info_t {
@ -40,7 +36,7 @@ void main() {
uint offset = thread_id.x
+ thread_id.y * u_info.extent.x;
uint value = uint(src.data[offset]);
uint value = texelFetch(src, int(offset)).r;
// Sign-extend magic!
int u5 = bitfieldExtract(int (value), 0, 5);

View File

@ -10,10 +10,7 @@ layout(
layout(binding = 0)
writeonly uniform image2D dst;
layout(binding = 1)
readonly buffer yuy2_buffer_t {
uint data[];
} src;
layout(binding = 1) uniform usamplerBuffer src;
layout(push_constant)
uniform u_info_t {
@ -39,7 +36,9 @@ void main() {
uint offset = thread_id.x
+ thread_id.y * u_info.extent.x;
vec4 data = unpackUnorm4x8(src.data[offset]);
uint value = texelFetch(src, int(offset)).r;
vec4 data = unpackUnorm4x8(value);
// Flip around stuff for UYVY
if (s_is_uyvy)