Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c-generator: add the module tag back into attr and bindslot defines. #161

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
CHANGELOG
=========

#### **10-Dec-2024**

Another minor regression fix: in the C code generator, attribute and bindslot
defines now include the `@module` tag again, this can be used to avoid name
conflicts across shader files.

See issue https://github.com/floooh/sokol-tools/issues/160 and PR https://github.com/floooh/sokol-tools/pull/161
for details!

#### **09-Nov-2024**

Important regression fix: shaders which used textures/samplers both on the vertex-
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# project: sokol-tools
#
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
project(sokol-tools)
Expand Down
10 changes: 5 additions & 5 deletions src/shdc/generators/sokolc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -679,23 +679,23 @@ std::string SokolCGenerator::struct_name(const std::string& name) {
}

std::string SokolCGenerator::vertex_attr_name(const std::string& prog_name, const StageAttr& attr) {
return fmt::format("ATTR_{}_{}", prog_name, attr.name);
return fmt::format("ATTR_{}{}_{}", mod_prefix, prog_name, attr.name);
}

std::string SokolCGenerator::image_bind_slot_name(const Image& img) {
return fmt::format("IMG_{}", img.name);
return fmt::format("IMG_{}{}", mod_prefix, img.name);
}

std::string SokolCGenerator::sampler_bind_slot_name(const Sampler& smp) {
return fmt::format("SMP_{}", smp.name);
return fmt::format("SMP_{}{}", mod_prefix, smp.name);
}

std::string SokolCGenerator::uniform_block_bind_slot_name(const UniformBlock& ub) {
return fmt::format("UB_{}", ub.name);
return fmt::format("UB_{}{}", mod_prefix, ub.name);
}

std::string SokolCGenerator::storage_buffer_bind_slot_name(const StorageBuffer& sbuf) {
return fmt::format("SBUF_{}", sbuf.name);
return fmt::format("SBUF_{}{}", mod_prefix, sbuf.name);
}

std::string SokolCGenerator::vertex_attr_definition(const std::string& prog_name, const StageAttr& attr) {
Expand Down
Loading