if(level>=0 && !can_bind_tex_level(level))
throw invalid_operation("PipelineState::set_texture");
+ set_texture_resource(binding, tex, level, samp);
+}
+
+void PipelineState::set_storage_texture(unsigned binding, const Texture *tex)
+{
+ set_texture_resource(binding, tex, 0, 0);
+}
+
+void PipelineState::set_texture_resource(unsigned binding, const Texture *tex, int level, const Sampler *samp)
+{
auto i = lower_bound_member(resources, static_cast<int>(binding), &BoundResource::binding);
if(i==resources.end() || i->binding!=static_cast<int>(binding))
i = resources.insert(i, BoundResource(binding));
- ResourceType type = (tex ? TEXTURE : NO_RESOURCE);
+ ResourceType type = (tex ? samp ? SAMPLED_TEXTURE : STORAGE_TEXTURE : NO_RESOURCE);
if(i->type!=type || tex!=i->texture || level!=i->mip_level || samp!=i->sampler)
{
i->type = type;
i->sampler = samp;
i->mip_level = level;
i->changed = true;
- i->used = (tex && samp);
+ i->used = tex;
changes |= RESOURCES;
}
}