mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Support arbitrary source texture coordinates in blitter
This commit is contained in:
parent
859ac59e6c
commit
6234a1a6b0
@ -1688,7 +1688,9 @@ namespace dxvk {
|
|||||||
passInfo.renderArea = scissor;
|
passInfo.renderArea = scissor;
|
||||||
|
|
||||||
// Set up push constants
|
// Set up push constants
|
||||||
DxvkMetaBlitPushConstants pushConstants;
|
DxvkMetaBlitPushConstants pushConstants = { };
|
||||||
|
pushConstants.srcCoord0 = { 0.0f, 0.0f, 0.0f };
|
||||||
|
pushConstants.srcCoord1 = { 1.0f, 1.0f, 1.0f };
|
||||||
pushConstants.layerCount = passExtent.depth;
|
pushConstants.layerCount = passExtent.depth;
|
||||||
|
|
||||||
m_cmd->cmdBeginRenderPass(&passInfo, VK_SUBPASS_CONTENTS_INLINE);
|
m_cmd->cmdBeginRenderPass(&passInfo, VK_SUBPASS_CONTENTS_INLINE);
|
||||||
|
@ -9,12 +9,22 @@
|
|||||||
#include "dxvk_image.h"
|
#include "dxvk_image.h"
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Texture coordinates
|
||||||
|
*/
|
||||||
|
struct DxvkMetaBlitOffset {
|
||||||
|
float x, y, z;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Push constant data
|
* \brief Push constant data
|
||||||
*/
|
*/
|
||||||
struct DxvkMetaBlitPushConstants {
|
struct DxvkMetaBlitPushConstants {
|
||||||
uint32_t layerCount;
|
DxvkMetaBlitOffset srcCoord0;
|
||||||
|
uint32_t pad1;
|
||||||
|
DxvkMetaBlitOffset srcCoord1;
|
||||||
|
uint32_t layerCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,6 +6,14 @@ uniform sampler1DArray s_texture;
|
|||||||
layout(location = 0) in vec2 i_pos;
|
layout(location = 0) in vec2 i_pos;
|
||||||
layout(location = 0) out vec4 o_color;
|
layout(location = 0) out vec4 o_color;
|
||||||
|
|
||||||
|
layout(push_constant)
|
||||||
|
uniform push_block {
|
||||||
|
vec3 p_src_coord0;
|
||||||
|
vec3 p_src_coord1;
|
||||||
|
uint p_layer_count;
|
||||||
|
};
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
o_color = texture(s_texture, vec2(i_pos.x, gl_Layer));
|
float coord = mix(p_src_coord0.x, p_src_coord1.x, i_pos.x);
|
||||||
|
o_color = texture(s_texture, vec2(coord, gl_Layer));
|
||||||
}
|
}
|
@ -6,6 +6,14 @@ uniform sampler2DArray s_texture;
|
|||||||
layout(location = 0) in vec2 i_pos;
|
layout(location = 0) in vec2 i_pos;
|
||||||
layout(location = 0) out vec4 o_color;
|
layout(location = 0) out vec4 o_color;
|
||||||
|
|
||||||
|
layout(push_constant)
|
||||||
|
uniform push_block {
|
||||||
|
vec3 p_src_coord0;
|
||||||
|
vec3 p_src_coord1;
|
||||||
|
uint p_layer_count;
|
||||||
|
};
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
o_color = texture(s_texture, vec3(i_pos, gl_Layer));
|
vec2 coord = mix(p_src_coord0.xy, p_src_coord1.xy, i_pos);
|
||||||
|
o_color = texture(s_texture, vec3(coord, gl_Layer));
|
||||||
}
|
}
|
@ -8,10 +8,13 @@ layout(location = 0) out vec4 o_color;
|
|||||||
|
|
||||||
layout(push_constant)
|
layout(push_constant)
|
||||||
uniform push_block {
|
uniform push_block {
|
||||||
|
vec3 p_src_coord0;
|
||||||
|
vec3 p_src_coord1;
|
||||||
uint p_layer_count;
|
uint p_layer_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
o_color = texture(s_texture, vec3(i_pos,
|
vec3 coord = mix(p_src_coord0, p_src_coord1,
|
||||||
(float(gl_Layer) + 0.5f) / float(p_layer_count)));
|
vec3(i_pos, (float(gl_Layer) + 0.5f) / float(p_layer_count)));
|
||||||
|
o_color = texture(s_texture, coord);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user