mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[SPIR-V] Fix 1D texture fetches. Fixes #1124
This commit is contained in:
parent
2b66a1b68f
commit
86f387ed42
|
|
@ -1795,6 +1795,12 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
tex_[dim_idx], std::vector<Id>({texture_index}));
|
tex_[dim_idx], std::vector<Id>({texture_index}));
|
||||||
auto texture = b.createLoad(texture_ptr);
|
auto texture = b.createLoad(texture_ptr);
|
||||||
|
|
||||||
|
if (instr.dimension == TextureDimension::k1D) {
|
||||||
|
// Upgrade 1D src coordinate into 2D
|
||||||
|
src = b.createCompositeConstruct(vec2_float_type_,
|
||||||
|
{src, b.makeFloatConstant(0.f)});
|
||||||
|
}
|
||||||
|
|
||||||
spv::Builder::TextureParameters params = {0};
|
spv::Builder::TextureParameters params = {0};
|
||||||
params.coords = src;
|
params.coords = src;
|
||||||
params.sampler = texture;
|
params.sampler = texture;
|
||||||
|
|
@ -1917,6 +1923,12 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
tex_[dim_idx], std::vector<Id>({texture_index}));
|
tex_[dim_idx], std::vector<Id>({texture_index}));
|
||||||
auto texture = b.createLoad(texture_ptr);
|
auto texture = b.createLoad(texture_ptr);
|
||||||
|
|
||||||
|
if (instr.dimension == TextureDimension::k1D) {
|
||||||
|
// Upgrade 1D src coordinate into 2D
|
||||||
|
src = b.createCompositeConstruct(vec2_float_type_,
|
||||||
|
{src, b.makeFloatConstant(0.f)});
|
||||||
|
}
|
||||||
|
|
||||||
spv::Builder::TextureParameters params = {};
|
spv::Builder::TextureParameters params = {};
|
||||||
params.sampler = texture;
|
params.sampler = texture;
|
||||||
params.coords = src;
|
params.coords = src;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace gpu {
|
||||||
// supported size).
|
// supported size).
|
||||||
struct SpirvPushConstants {
|
struct SpirvPushConstants {
|
||||||
// Accessible to vertex shader only:
|
// Accessible to vertex shader only:
|
||||||
float window_scale[4]; // scale x/y, viewport width/height (pixels)
|
float window_scale[4]; // scale x/y, offset x/y (pixels)
|
||||||
float vtx_fmt[4];
|
float vtx_fmt[4];
|
||||||
|
|
||||||
// Accessible to geometry shader only:
|
// Accessible to geometry shader only:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue