1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 04:24:11 +01:00

[dxvk] Add separate clear shaders for array views

Creating one shader per image view type may help in case we
get an already compatible image view from the D3D11 application.
This commit is contained in:
Philip Rebohle 2018-04-11 17:16:18 +02:00
parent 676b0cb476
commit ac8447b32e
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
9 changed files with 72 additions and 44 deletions

View File

@ -3,8 +3,12 @@ dxvk_shaders = files([
'shaders/dxvk_clear_buffer_f.comp',
'shaders/dxvk_clear_image1d_u.comp',
'shaders/dxvk_clear_image1d_f.comp',
'shaders/dxvk_clear_image1darr_u.comp',
'shaders/dxvk_clear_image1darr_f.comp',
'shaders/dxvk_clear_image2d_u.comp',
'shaders/dxvk_clear_image2d_f.comp',
'shaders/dxvk_clear_image2darr_u.comp',
'shaders/dxvk_clear_image2darr_f.comp',
'shaders/dxvk_clear_image3d_u.comp',
'shaders/dxvk_clear_image3d_f.comp',

View File

@ -12,12 +12,15 @@ layout(push_constant)
uniform u_info_t {
vec4 clear_value;
ivec4 dst_offset;
ivec4 dst_size;
ivec4 dst_extent;
} u_info;
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID.x);
if (thread_id.x < u_info.dst_size.x)
imageStore(dst, thread_id.x + u_info.dst_offset.x, u_info.clear_value);
if (thread_id.x < u_info.dst_extent.x) {
imageStore(dst,
u_info.dst_offset.x + thread_id.x,
u_info.clear_value);
}
}

View File

@ -12,12 +12,15 @@ layout(push_constant)
uniform u_info_t {
uvec4 clear_value;
ivec4 dst_offset;
ivec4 dst_size;
ivec4 dst_extent;
} u_info;
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID.x);
if (thread_id.x < u_info.dst_size.x)
imageStore(dst, thread_id.x + u_info.dst_offset.x, u_info.clear_value);
if (thread_id.x < u_info.dst_extent.x) {
imageStore(dst,
u_info.dst_offset.x + thread_id.x,
u_info.clear_value);
}
}

View File

@ -6,18 +6,21 @@ layout(
local_size_z = 1) in;
layout(binding = 0)
writeonly uniform image1DArray dst;
writeonly uniform image1D dst;
layout(push_constant)
uniform u_info_t {
vec4 clear_value;
ivec4 dst_offset;
ivec4 dst_size;
ivec4 dst_extent;
} u_info;
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID.x);
ivec3 thread_id = ivec3(gl_GlobalInvocationID);
if (all(lessThan(thread_id.xy, u_info.dst_size.xy)))
imageStore(dst, thread_id.xy + u_info.dst_offset.xy, u_info.clear_value);
if (thread_id.x < u_info.dst_extent.x) {
imageStore(dst,
u_info.dst_offset.x + thread_id.x,
u_info.clear_value);
}
}

View File

@ -6,18 +6,21 @@ layout(
local_size_z = 1) in;
layout(binding = 0)
writeonly uniform uimage1DArray dst;
writeonly uniform uimage1D dst;
layout(push_constant)
uniform u_info_t {
uvec4 clear_value;
ivec4 dst_offset;
ivec4 dst_size;
ivec4 dst_extent;
} u_info;
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID.x);
ivec3 thread_id = ivec3(gl_GlobalInvocationID);
if (all(lessThan(thread_id.xy, u_info.dst_size.xy)))
imageStore(dst, thread_id.xy + u_info.dst_offset.xy, u_info.clear_value);
if (thread_id.x < u_info.dst_extent.x) {
imageStore(dst,
u_info.dst_offset.x + thread_id.x,
u_info.clear_value);
}
}

View File

@ -1,23 +1,26 @@
#version 450
layout(
local_size_x = 64,
local_size_y = 1,
local_size_x = 8,
local_size_y = 8,
local_size_z = 1) in;
layout(binding = 0)
writeonly uniform image2DArray dst;
writeonly uniform image2D dst;
layout(push_constant)
uniform u_info_t {
vec4 clear_value;
ivec4 dst_offset;
ivec4 dst_size;
ivec4 dst_extent;
} u_info;
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID.x);
ivec3 thread_id = ivec3(gl_GlobalInvocationID);
if (all(lessThan(thread_id.xyz, u_info.dst_size.xyz)))
imageStore(dst, thread_id.xyz + u_info.dst_offset.xyz, u_info.clear_value);
if (all(lessThan(thread_id.xy, u_info.dst_extent.xy))) {
imageStore(dst,
u_info.dst_offset.xy + thread_id.xy,
u_info.clear_value);
}
}

View File

@ -1,23 +1,26 @@
#version 450
layout(
local_size_x = 64,
local_size_y = 1,
local_size_x = 8,
local_size_y = 8,
local_size_z = 1) in;
layout(binding = 0)
writeonly uniform uimage2DArray dst;
writeonly uniform uimage2D dst;
layout(push_constant)
uniform u_info_t {
uvec4 clear_value;
ivec4 dst_offset;
ivec4 dst_size;
ivec4 dst_extent;
} u_info;
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID.x);
ivec3 thread_id = ivec3(gl_GlobalInvocationID);
if (all(lessThan(thread_id.xyz, u_info.dst_size.xyz)))
imageStore(dst, thread_id.xyz + u_info.dst_offset.xyz, u_info.clear_value);
if (all(lessThan(thread_id.xy, u_info.dst_extent.xy))) {
imageStore(dst,
u_info.dst_offset.xy + thread_id.xy,
u_info.clear_value);
}
}

View File

@ -1,9 +1,9 @@
#version 450
layout(
local_size_x = 64,
local_size_y = 1,
local_size_z = 1) in;
local_size_x = 4,
local_size_y = 4,
local_size_z = 4) in;
layout(binding = 0)
writeonly uniform image3D dst;
@ -12,12 +12,15 @@ layout(push_constant)
uniform u_info_t {
vec4 clear_value;
ivec4 dst_offset;
ivec4 dst_size;
ivec4 dst_extent;
} u_info;
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID.x);
ivec3 thread_id = ivec3(gl_GlobalInvocationID);
if (all(lessThan(thread_id.xyz, u_info.dst_size.xyz)))
imageStore(dst, thread_id.xyz + u_info.dst_offset.xyz, u_info.clear_value);
if (all(lessThan(thread_id.xyz, u_info.dst_extent.xyz))) {
imageStore(dst,
u_info.dst_offset.xyz + thread_id.xyz,
u_info.clear_value);
}
}

View File

@ -1,9 +1,9 @@
#version 450
layout(
local_size_x = 64,
local_size_y = 1,
local_size_z = 1) in;
local_size_x = 4,
local_size_y = 4,
local_size_z = 4) in;
layout(binding = 0)
writeonly uniform uimage3D dst;
@ -12,12 +12,15 @@ layout(push_constant)
uniform u_info_t {
uvec4 clear_value;
ivec4 dst_offset;
ivec4 dst_size;
ivec4 dst_extent;
} u_info;
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID.x);
ivec3 thread_id = ivec3(gl_GlobalInvocationID);
if (all(lessThan(thread_id.xyz, u_info.dst_size.xyz)))
imageStore(dst, thread_id.xyz + u_info.dst_offset.xyz, u_info.clear_value);
if (all(lessThan(thread_id.xyz, u_info.dst_extent.xyz))) {
imageStore(dst,
u_info.dst_offset.xyz + thread_id.xyz,
u_info.clear_value);
}
}