mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +01:00
[d3d9] Implement converter for W11V11U10
This commit is contained in:
parent
40a4908a2a
commit
4fb7acc64e
@ -168,6 +168,16 @@ namespace dxvk {
|
||||
// Convert -> float (this is a mixed snorm and unorm type)
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT } };
|
||||
|
||||
case D3D9Format::W11V11U10: return {
|
||||
VK_FORMAT_B10G11R11_UFLOAT_PACK32,
|
||||
VK_FORMAT_UNDEFINED,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
|
||||
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_ONE },
|
||||
{ D3D9ConversionFormat_W11V11U10, 1u,
|
||||
// can't use B10G11R11 bc this is a snorm type
|
||||
VK_FORMAT_R16G16B16A16_SNORM } };
|
||||
|
||||
case D3D9Format::UYVY: return {
|
||||
VK_FORMAT_B8G8R8A8_UNORM,
|
||||
VK_FORMAT_UNDEFINED,
|
||||
|
@ -40,6 +40,7 @@ namespace dxvk {
|
||||
X8L8V8U8 = 62,
|
||||
Q8W8V8U8 = 63,
|
||||
V16U16 = 64,
|
||||
W11V11U10 = 65,
|
||||
A2W10V10U10 = 67,
|
||||
UYVY = MAKEFOURCC('U', 'Y', 'V', 'Y'),
|
||||
R8G8_B8G8 = MAKEFOURCC('R', 'G', 'B', 'G'),
|
||||
@ -134,6 +135,7 @@ namespace dxvk {
|
||||
D3D9ConversionFormat_L6V5U5,
|
||||
D3D9ConversionFormat_X8L8V8U8,
|
||||
D3D9ConversionFormat_A2W10V10U10,
|
||||
D3D9ConversionFormat_W11V11U10,
|
||||
D3D9ConversionFormat_NV12,
|
||||
D3D9ConversionFormat_YV12,
|
||||
D3D9ConversionFormat_Count
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <d3d9_convert_l6v5u5.h>
|
||||
#include <d3d9_convert_x8l8v8u8.h>
|
||||
#include <d3d9_convert_a2w10v10u10.h>
|
||||
#include <d3d9_convert_w11v11u10.h>
|
||||
#include <d3d9_convert_nv12.h>
|
||||
#include <d3d9_convert_yv12.h>
|
||||
|
||||
@ -57,6 +58,10 @@ namespace dxvk {
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcSlice, VK_FORMAT_R32_UINT, 0, { 1u, 1u });
|
||||
break;
|
||||
|
||||
case D3D9ConversionFormat_W11V11U10:
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcSlice, VK_FORMAT_R32_UINT, 0, { 1u, 1u });
|
||||
break;
|
||||
|
||||
default:
|
||||
Logger::warn("Unimplemented format conversion");
|
||||
}
|
||||
@ -113,6 +118,7 @@ namespace dxvk {
|
||||
m_shaders[D3D9ConversionFormat_L6V5U5] = InitShader(d3d9_convert_l6v5u5);
|
||||
m_shaders[D3D9ConversionFormat_X8L8V8U8] = InitShader(d3d9_convert_x8l8v8u8);
|
||||
m_shaders[D3D9ConversionFormat_A2W10V10U10] = InitShader(d3d9_convert_a2w10v10u10);
|
||||
m_shaders[D3D9ConversionFormat_W11V11U10] = InitShader(d3d9_convert_w11v11u10);
|
||||
m_shaders[D3D9ConversionFormat_NV12] = InitShader(d3d9_convert_nv12);
|
||||
m_shaders[D3D9ConversionFormat_YV12] = InitShader(d3d9_convert_yv12);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ d3d9_shaders = files([
|
||||
'shaders/d3d9_convert_l6v5u5.comp',
|
||||
'shaders/d3d9_convert_x8l8v8u8.comp',
|
||||
'shaders/d3d9_convert_a2w10v10u10.comp',
|
||||
'shaders/d3d9_convert_w11v11u10.comp',
|
||||
'shaders/d3d9_convert_nv12.comp',
|
||||
'shaders/d3d9_convert_yv12.comp'
|
||||
])
|
||||
|
43
src/d3d9/shaders/d3d9_convert_w11v11u10.comp
Normal file
43
src/d3d9/shaders/d3d9_convert_w11v11u10.comp
Normal file
@ -0,0 +1,43 @@
|
||||
#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 v11 = bitfieldExtract(int (value), 10, 11);
|
||||
int w11 = bitfieldExtract(int (value), 21, 11);
|
||||
|
||||
vec4 color = vec4(
|
||||
snormalize(u10, 10),
|
||||
snormalize(v11, 10),
|
||||
snormalize(w11, 10),
|
||||
1.0);
|
||||
|
||||
imageStore(dst, thread_id.xy, color);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user