spirv: More correct texel buffer usage
This commit is contained in:
parent
ac2fa103fa
commit
fab390b860
|
@ -187,6 +187,7 @@ void DefineEntryPoint(const IR::Program& program, EmitContext& ctx, Id main) {
|
||||||
ctx.AddCapability(spv::Capability::Int64);
|
ctx.AddCapability(spv::Capability::Int64);
|
||||||
if (info.has_storage_images || info.has_image_buffers) {
|
if (info.has_storage_images || info.has_image_buffers) {
|
||||||
ctx.AddCapability(spv::Capability::StorageImageExtendedFormats);
|
ctx.AddCapability(spv::Capability::StorageImageExtendedFormats);
|
||||||
|
ctx.AddCapability(spv::Capability::StorageImageReadWithoutFormat);
|
||||||
ctx.AddCapability(spv::Capability::StorageImageWriteWithoutFormat);
|
ctx.AddCapability(spv::Capability::StorageImageWriteWithoutFormat);
|
||||||
}
|
}
|
||||||
if (info.has_texel_buffers) {
|
if (info.has_texel_buffers) {
|
||||||
|
|
|
@ -266,7 +266,8 @@ Id EmitLoadBufferFormatF32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id addr
|
||||||
const auto& buffer = ctx.texture_buffers[handle];
|
const auto& buffer = ctx.texture_buffers[handle];
|
||||||
const Id tex_buffer = ctx.OpLoad(buffer.image_type, buffer.id);
|
const Id tex_buffer = ctx.OpLoad(buffer.image_type, buffer.id);
|
||||||
const Id coord = ctx.OpIAdd(ctx.U32[1], address, buffer.coord_offset);
|
const Id coord = ctx.OpIAdd(ctx.U32[1], address, buffer.coord_offset);
|
||||||
Id texel = ctx.OpImageFetch(buffer.result_type, tex_buffer, coord);
|
Id texel = buffer.is_storage ? ctx.OpImageRead(buffer.result_type, tex_buffer, coord)
|
||||||
|
: ctx.OpImageFetch(buffer.result_type, tex_buffer, coord);
|
||||||
if (buffer.is_integer) {
|
if (buffer.is_integer) {
|
||||||
texel = ctx.OpBitcast(ctx.F32[4], texel);
|
texel = ctx.OpBitcast(ctx.F32[4], texel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,6 +406,7 @@ void EmitContext::DefineTextureBuffers() {
|
||||||
.image_type = image_type,
|
.image_type = image_type,
|
||||||
.result_type = sampled_type[4],
|
.result_type = sampled_type[4],
|
||||||
.is_integer = is_integer,
|
.is_integer = is_integer,
|
||||||
|
.is_storage = desc.is_written,
|
||||||
});
|
});
|
||||||
interfaces.push_back(id);
|
interfaces.push_back(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,7 @@ public:
|
||||||
Id image_type;
|
Id image_type;
|
||||||
Id result_type;
|
Id result_type;
|
||||||
bool is_integer;
|
bool is_integer;
|
||||||
|
bool is_storage;
|
||||||
};
|
};
|
||||||
|
|
||||||
u32& binding;
|
u32& binding;
|
||||||
|
|
Loading…
Reference in New Issue