Skip to content

Commit 69eb34c

Browse files
committed
fix shaders
1 parent 6c8657d commit 69eb34c

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

python/taichi/shaders/SetImage_vk.frag

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ layout(location = 0) out vec4 out_color;
99
layout(binding = 1) uniform UBO {
1010
float x_factor;
1111
float y_factor;
12+
int transposed;
1213
}
1314
ubo;
1415

1516
void main() {
16-
vec2 coord = frag_texcoord.yx * vec2(ubo.y_factor,ubo.x_factor);
17+
vec2 coord = vec2(ubo.y_factor,ubo.x_factor);
18+
if (ubo.transposed != 0) {
19+
coord *= frag_texcoord.yx;
20+
} else {
21+
coord *= frag_texcoord.xy;
22+
}
1723
out_color = texture(texSampler, coord);
18-
// out_color = vec4(frag_texcoord.xy,0,1);
1924
}
376 Bytes
Binary file not shown.

taichi/codegen/spirv/spirv_codegen.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2372,14 +2372,14 @@ void KernelCodegen::run(TaichiKernelAttributes &kernel_attribs,
23722372
std::vector<uint32_t> &spirv = success ? optimized_spv : task_res.spirv_code;
23732373

23742374
std::string spirv_asm;
2375-
spirv_tools_->Disassemble(optimized_spv, &spirv_asm);
2375+
spirv_tools_->Disassemble(spirv, &spirv_asm);
23762376
auto kernel_name = tp.ti_kernel_name;
23772377
TI_WARN("SPIR-V Assembly dump for {} :\n{}\n\n", kernel_name, spirv_asm);
23782378

23792379
std::ofstream fout(kernel_name + ".spv",
23802380
std::ios::binary | std::ios::out);
2381-
fout.write(reinterpret_cast<const char *>(optimized_spv.data()),
2382-
optimized_spv.size() * sizeof(uint32_t));
2381+
fout.write(reinterpret_cast<const char *>(spirv.data()),
2382+
spirv.size() * sizeof(uint32_t));
23832383
fout.close();
23842384
}
23852385
#endif
8 Bytes
Loading

0 commit comments

Comments
 (0)