diff --git a/Applications/Sfx/SfxEffect.cpp b/Applications/Sfx/SfxEffect.cpp index 158596c4..f74f8ce3 100644 --- a/Applications/Sfx/SfxEffect.cpp +++ b/Applications/Sfx/SfxEffect.cpp @@ -1315,7 +1315,7 @@ bool Effect::Save(string sfxFilename,string sfxoFilename) for (auto b : m_constantBuffers) { - outstr << "constant_buffer " << b.first << " "<slot,false)<slot, false) << " g" << b.second->group_num << std::endl; usedConstantBufferSlots.insert(b.second->slot); } @@ -1352,7 +1352,7 @@ bool Effect::Save(string sfxFilename,string sfxoFilename) if (is_msaa) outstr << "ms"; - outstr << " " << rw << " " << (writeable?GenerateTextureWriteSlot(dt->slot,false):GenerateTextureSlot(dt->slot,false))<< " " << ar << std::endl; + outstr << " " << rw << " " << (writeable ? GenerateTextureWriteSlot(dt->slot, false) : GenerateTextureSlot(dt->slot, false)) << " g" << t->second->group_num << " " << ar << std::endl; if (dt->slot >= 32) { std::cerr << sfxFilename.c_str() << "(0): error: by default, only 16 texture slots are enabled in Gnmx." << std::endl; @@ -1370,7 +1370,7 @@ bool Effect::Save(string sfxFilename,string sfxoFilename) continue; NamedConstantBuffer *dt = static_cast(t->second); outstr << "namedconstantbuffer " << t->first << " "; - outstr << " " <slot<< std::endl; + outstr << " " << dt->slot << " g" << t->second->group_num << std::endl; } // Add samplers to the effect file for (auto t = declarations.begin(); t != declarations.end(); ++t) @@ -1382,6 +1382,7 @@ bool Effect::Save(string sfxFilename,string sfxoFilename) SamplerState *ss = (SamplerState *)t->second; outstr << "SamplerState " << t->first << " " << GenerateSamplerSlot(ss->register_number,false) + << " g" << t->second->group_num << "," << ToString(ss->Filter) << "," << ToString(ss->AddressU) << "," << ToString(ss->AddressV) diff --git a/CrossPlatform/Effect.cpp b/CrossPlatform/Effect.cpp index 882b94f3..c2ac7b71 100644 --- a/CrossPlatform/Effect.cpp +++ b/CrossPlatform/Effect.cpp @@ -1133,6 +1133,7 @@ bool Effect::Load(crossplatform::RenderPlatform *r, const char *filename_utf8) { const string &name =words[1]; const string ®ister_num =words[4]; + const string &group_num =words[5]; int slot=atoi(register_num.c_str()); crossplatform::ShaderResource *res=new crossplatform::ShaderResource; res->slot =slot; @@ -1144,6 +1145,7 @@ bool Effect::Load(crossplatform::RenderPlatform *r, const char *filename_utf8) { const string &constant_buffer_name = words[1]; const string &constant_buffer_slot = words[2]; + const string &constant_buffer_group = words[3]; int slot = atoi(constant_buffer_slot.c_str()); constantBufferSlots[constant_buffer_name]=slot; } @@ -1153,7 +1155,8 @@ bool Effect::Load(crossplatform::RenderPlatform *r, const char *filename_utf8) const string &texture_dim =words[2]; const string &read_write =words[3]; const string ®ister_num =words[4]; - string is_array =words.size()>5?words[5]:"single"; + const string &group_num =words[5]; + string is_array =words.size()>6?words[6]:"single"; int slot=atoi(register_num.c_str()); int dim=is_equal(texture_dim,"3d")||is_equal(texture_dim,"3dms")?3:2; bool is_cubemap=is_equal(texture_dim,"cubemap")||is_equal(texture_dim,"cubemapms"); @@ -1334,12 +1337,15 @@ bool Effect::Load(crossplatform::RenderPlatform *r, const char *filename_utf8) } else if(is_equal(word, "SamplerState")) { - //SamplerState clampSamplerState 9,MIN_MAG_MIP_LINEAR,CLAMP,CLAMP,CLAMP, + //SamplerState clampSamplerState 9 g0,MIN_MAG_MIP_LINEAR,CLAMP,CLAMP,CLAMP, size_t sp2=line.find(" ",sp+1); + size_t sp3=line.find(" ",sp2+1); + size_t comma=(int)std::min(line.length(),line.find(",",sp3+1)); string sampler_name = line.substr(sp + 1, sp2 - sp - 1); - size_t comma=(int)std::min(line.length(),line.find(",",sp2+1)); - string register_num = line.substr(sp2 + 1, comma - sp2 - 1); + string register_num = line.substr(sp2 + 1, sp3 - sp2 - 1); + string group_num = line.substr(sp3 + 2, comma - sp3 - 2); int reg=atoi(register_num.c_str()); + int grp=atoi(group_num.c_str()); platform::crossplatform::SamplerStateDesc desc; string state=line.substr(comma+1,line.length()-comma-1); vector st=platform::core::split(state,',');