mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 10:54:16 +01:00
[d3d9] Implement A2W10V10U10 format via conversion
This commit is contained in:
parent
60ec7e8208
commit
eaa599bf9a
@ -162,7 +162,15 @@ namespace dxvk {
|
|||||||
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
|
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
|
||||||
VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_ONE }};
|
VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_ONE }};
|
||||||
|
|
||||||
case D3D9Format::A2W10V10U10: return {}; // Unsupported
|
case D3D9Format::A2W10V10U10: return {
|
||||||
|
VK_FORMAT_A2B10G10R10_UNORM_PACK32,
|
||||||
|
VK_FORMAT_UNDEFINED,
|
||||||
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
|
||||||
|
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A },
|
||||||
|
{ D3D9ConversionFormat_A2W10V10U10, { 1u, 1u },
|
||||||
|
// Convert -> float (this is a mixed snorm and unorm type)
|
||||||
|
VK_FORMAT_R16G16B16A16_SFLOAT } };
|
||||||
|
|
||||||
case D3D9Format::UYVY: return {
|
case D3D9Format::UYVY: return {
|
||||||
VK_FORMAT_B8G8R8A8_UNORM,
|
VK_FORMAT_B8G8R8A8_UNORM,
|
||||||
|
@ -133,6 +133,7 @@ namespace dxvk {
|
|||||||
D3D9ConversionFormat_UYVY,
|
D3D9ConversionFormat_UYVY,
|
||||||
D3D9ConversionFormat_L6V5U5,
|
D3D9ConversionFormat_L6V5U5,
|
||||||
D3D9ConversionFormat_X8L8V8U8,
|
D3D9ConversionFormat_X8L8V8U8,
|
||||||
|
D3D9ConversionFormat_A2W10V10U10,
|
||||||
D3D9ConversionFormat_Count
|
D3D9ConversionFormat_Count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <d3d9_convert_yuy2_uyvy.h>
|
#include <d3d9_convert_yuy2_uyvy.h>
|
||||||
#include <d3d9_convert_l6v5u5.h>
|
#include <d3d9_convert_l6v5u5.h>
|
||||||
#include <d3d9_convert_x8l8v8u8.h>
|
#include <d3d9_convert_x8l8v8u8.h>
|
||||||
|
#include <d3d9_convert_a2w10v10u10.h>
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
@ -42,6 +43,10 @@ namespace dxvk {
|
|||||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, 0);
|
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case D3D9ConversionFormat_A2W10V10U10:
|
||||||
|
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Logger::warn("Unimplemented format conversion");
|
Logger::warn("Unimplemented format conversion");
|
||||||
}
|
}
|
||||||
@ -102,6 +107,7 @@ namespace dxvk {
|
|||||||
m_shaders[D3D9ConversionFormat_UYVY] = m_shaders[D3D9ConversionFormat_YUY2];
|
m_shaders[D3D9ConversionFormat_UYVY] = m_shaders[D3D9ConversionFormat_YUY2];
|
||||||
m_shaders[D3D9ConversionFormat_L6V5U5] = InitShader(d3d9_convert_l6v5u5);
|
m_shaders[D3D9ConversionFormat_L6V5U5] = InitShader(d3d9_convert_l6v5u5);
|
||||||
m_shaders[D3D9ConversionFormat_X8L8V8U8] = InitShader(d3d9_convert_x8l8v8u8);
|
m_shaders[D3D9ConversionFormat_X8L8V8U8] = InitShader(d3d9_convert_x8l8v8u8);
|
||||||
|
m_shaders[D3D9ConversionFormat_A2W10V10U10] = InitShader(d3d9_convert_a2w10v10u10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ d3d9_shaders = files([
|
|||||||
'shaders/d3d9_presenter_vert.vert',
|
'shaders/d3d9_presenter_vert.vert',
|
||||||
'shaders/d3d9_convert_yuy2_uyvy.comp',
|
'shaders/d3d9_convert_yuy2_uyvy.comp',
|
||||||
'shaders/d3d9_convert_l6v5u5.comp',
|
'shaders/d3d9_convert_l6v5u5.comp',
|
||||||
'shaders/d3d9_convert_x8l8v8u8.comp'
|
'shaders/d3d9_convert_x8l8v8u8.comp',
|
||||||
|
'shaders/d3d9_convert_a2w10v10u10.comp'
|
||||||
])
|
])
|
||||||
|
|
||||||
d3d9_src = [
|
d3d9_src = [
|
||||||
|
44
src/d3d9/shaders/d3d9_convert_a2w10v10u10.comp
Normal file
44
src/d3d9/shaders/d3d9_convert_a2w10v10u10.comp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#version 450
|
||||||
|
#extension GL_GOOGLE_include_directive : enable
|
||||||
|
|
||||||
|
#include "d3d9_convert_common.h"
|
||||||
|
|
||||||
|
layout(
|
||||||
|
local_size_x = 8,
|
||||||
|
local_size_y = 8,
|
||||||
|
local_size_z = 1) in;
|
||||||
|
|
||||||
|
layout(binding = 0)
|
||||||
|
writeonly uniform image2D dst;
|
||||||
|
|
||||||
|
layout(binding = 1) uniform usamplerBuffer src;
|
||||||
|
|
||||||
|
layout(push_constant)
|
||||||
|
uniform u_info_t {
|
||||||
|
uvec2 extent;
|
||||||
|
} u_info;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
ivec3 thread_id = ivec3(gl_GlobalInvocationID);
|
||||||
|
|
||||||
|
if (all(lessThan(thread_id.xy, u_info.extent))) {
|
||||||
|
uint offset = thread_id.x
|
||||||
|
+ thread_id.y * u_info.extent.x;
|
||||||
|
|
||||||
|
uint value = texelFetch(src, int(offset)).r;
|
||||||
|
|
||||||
|
// Sign-extend magic!
|
||||||
|
int u10 = bitfieldExtract(int (value), 0, 10);
|
||||||
|
int v10 = bitfieldExtract(int (value), 10, 10);
|
||||||
|
int w10 = bitfieldExtract(int (value), 20, 10);
|
||||||
|
uint a2 = bitfieldExtract(uint(value), 30, 2);
|
||||||
|
|
||||||
|
vec4 color = vec4(
|
||||||
|
snormalize(u10, 10),
|
||||||
|
snormalize(v10, 10),
|
||||||
|
snormalize(w10, 10),
|
||||||
|
unormalize(a2, 2));
|
||||||
|
|
||||||
|
imageStore(dst, thread_id.xy, color);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user