add GetChars() accessors to many FString uses where const char* is wanted.
By no means complete, it's just a start to get rid of that automatic type conversion operator.
This commit is contained in:
parent
a3eb1ec1fd
commit
1717ff47b2
28 changed files with 92 additions and 97 deletions
|
|
@ -119,7 +119,7 @@ static FString CalcProgramBinaryChecksum(const FString &vertex, const FString &f
|
|||
static FString CreateProgramCacheName(bool create)
|
||||
{
|
||||
FString path = M_GetCachePath(create);
|
||||
if (create) CreatePath(path);
|
||||
if (create) CreatePath(path.GetChars());
|
||||
path << "/shadercache.zdsc";
|
||||
return path;
|
||||
}
|
||||
|
|
@ -135,7 +135,7 @@ static void LoadShaders()
|
|||
{
|
||||
FString path = CreateProgramCacheName(false);
|
||||
FileReader fr;
|
||||
if (!fr.OpenFile(path))
|
||||
if (!fr.OpenFile(path.GetChars()))
|
||||
I_Error("Could not open shader file");
|
||||
|
||||
char magic[4];
|
||||
|
|
@ -176,7 +176,7 @@ static void LoadShaders()
|
|||
static void SaveShaders()
|
||||
{
|
||||
FString path = CreateProgramCacheName(true);
|
||||
std::unique_ptr<FileWriter> fw(FileWriter::Open(path));
|
||||
std::unique_ptr<FileWriter> fw(FileWriter::Open(path.GetChars()));
|
||||
if (fw)
|
||||
{
|
||||
uint32_t count = (uint32_t)ShaderCache.size();
|
||||
|
|
@ -234,7 +234,7 @@ bool FShader::Configure(const char* name, const char* vert_prog_lump, const char
|
|||
void FShader::LoadVariant()
|
||||
{
|
||||
//mDefinesBase
|
||||
Load(mName.GetChars(), mVertProg, mFragProg, mFragProg2, mLightProg, mDefinesBase);
|
||||
Load(mName.GetChars(), mVertProg.GetChars(), mFragProg.GetChars(), mFragProg2.GetChars(), mLightProg.GetChars(), mDefinesBase.GetChars());
|
||||
}
|
||||
|
||||
bool FShader::Load(const char * name, const char * vert_prog_lump_, const char * frag_prog_lump_, const char * proc_prog_lump_, const char * light_fragprog_, const char * defines)
|
||||
|
|
@ -381,11 +381,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
i_data += "#define NPOT_EMULATION\nuniform vec2 uNpotEmulation;\n";
|
||||
#endif
|
||||
|
||||
int vp_lump = fileSystem.CheckNumForFullName(vert_prog_lump, 0);
|
||||
int vp_lump = fileSystem.CheckNumForFullName(vert_prog_lump.GetChars(), 0);
|
||||
if (vp_lump == -1) I_Error("Unable to load '%s'", vert_prog_lump.GetChars());
|
||||
auto vp_data = fileSystem.ReadFile(vp_lump);
|
||||
|
||||
int fp_lump = fileSystem.CheckNumForFullName(frag_prog_lump, 0);
|
||||
int fp_lump = fileSystem.CheckNumForFullName(frag_prog_lump.GetChars(), 0);
|
||||
if (fp_lump == -1) I_Error("Unable to load '%s'", frag_prog_lump.GetChars());
|
||||
auto fp_data = fileSystem.ReadFile(fp_lump);
|
||||
|
||||
|
|
@ -418,9 +418,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
{
|
||||
fp_comb << "#line 1\n";
|
||||
|
||||
if (*proc_prog_lump != '#')
|
||||
if (proc_prog_lump[0] != '#')
|
||||
{
|
||||
int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump);
|
||||
int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump.GetChars());
|
||||
if (pp_lump == -1) I_Error("Unable to load '%s'", proc_prog_lump.GetChars());
|
||||
auto ppf = fileSystem.ReadFile(pp_lump);
|
||||
FString pp_data = GetStringFromLump(pp_lump);
|
||||
|
|
@ -485,7 +485,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
|
||||
if (light_fragprog.Len())
|
||||
{
|
||||
int pp_lump = fileSystem.CheckNumForFullName(light_fragprog, 0);
|
||||
int pp_lump = fileSystem.CheckNumForFullName(light_fragprog.GetChars(), 0);
|
||||
if (pp_lump == -1) I_Error("Unable to load '%s'", light_fragprog.GetChars());
|
||||
fp_comb << GetStringFromLump(pp_lump) << "\n";
|
||||
}
|
||||
|
|
@ -722,8 +722,7 @@ bool FShader::Bind(ShaderFlavourData& flavour)
|
|||
|
||||
//Printf("Shader: %s, %08x %s", mFragProg2.GetChars(), tag, variantConfig.GetChars());
|
||||
|
||||
Load(mName.GetChars(), mVertProg, mFragProg, mFragProg2, mLightProg, mDefinesBase + variantConfig);
|
||||
|
||||
Load(mName.GetChars(), mVertProg.GetChars(), mFragProg.GetChars(), mFragProg2.GetChars(), mLightProg.GetChars(), (mDefinesBase + variantConfig).GetChars());
|
||||
variants.insert(std::make_pair(tag, cur));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ void FShaderProgram::Link(const char *name)
|
|||
glUseProgram(mProgram);
|
||||
for (auto &uni : samplerstobind)
|
||||
{
|
||||
auto index = glGetUniformLocation(mProgram, uni.first);
|
||||
auto index = glGetUniformLocation(mProgram, uni.first.GetChars());
|
||||
if (index >= 0)
|
||||
{
|
||||
glUniform1i(index, uni.second);
|
||||
|
|
@ -266,8 +266,8 @@ void FPresentShaderBase::Init(const char * vtx_shader_name, const char * program
|
|||
FString prolog = Uniforms.CreateDeclaration("Uniforms", PresentUniforms::Desc());
|
||||
|
||||
mShader.reset(new FShaderProgram());
|
||||
mShader->Compile(FShaderProgram::Vertex, "shaders_gles/pp/screenquad.vp", prolog, 330);
|
||||
mShader->Compile(FShaderProgram::Fragment, vtx_shader_name, prolog, 330);
|
||||
mShader->Compile(FShaderProgram::Vertex, "shaders_gles/pp/screenquad.vp", prolog.GetChars(), 330);
|
||||
mShader->Compile(FShaderProgram::Fragment, vtx_shader_name, prolog.GetChars(), 330);
|
||||
mShader->Link(program_name);
|
||||
mShader->Bind();
|
||||
Uniforms.Init();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
VkRenderPassManager::VkRenderPassManager(VulkanRenderDevice* fb) : fb(fb)
|
||||
{
|
||||
FString path = M_GetCachePath(true);
|
||||
CreatePath(path);
|
||||
CreatePath(path.GetChars());
|
||||
CacheFilename = path + "/pipelinecache.zdpc";
|
||||
|
||||
PipelineCacheBuilder builder;
|
||||
|
|
@ -49,7 +49,7 @@ VkRenderPassManager::VkRenderPassManager(VulkanRenderDevice* fb) : fb(fb)
|
|||
try
|
||||
{
|
||||
FileReader fr;
|
||||
if (fr.OpenFile(CacheFilename))
|
||||
if (fr.OpenFile(CacheFilename.GetChars()))
|
||||
{
|
||||
std::vector<uint8_t> data;
|
||||
data.resize(fr.GetLength());
|
||||
|
|
@ -71,7 +71,7 @@ VkRenderPassManager::~VkRenderPassManager()
|
|||
try
|
||||
{
|
||||
auto data = PipelineCache->GetCacheData();
|
||||
std::unique_ptr<FileWriter> fw(FileWriter::Open(CacheFilename));
|
||||
std::unique_ptr<FileWriter> fw(FileWriter::Open(CacheFilename.GetChars()));
|
||||
if (fw)
|
||||
fw->Write(data.data(), data.size());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void VkPPShader::Reset()
|
|||
|
||||
FString VkPPShader::LoadShaderCode(const FString &lumpName, const FString &defines, int version)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(lumpName);
|
||||
int lump = fileSystem.CheckNumForFullName(lumpName.GetChars());
|
||||
if (lump == -1) I_FatalError("Unable to load '%s'", lumpName.GetChars());
|
||||
auto sp = fileSystem.ReadFile(lump);
|
||||
FString code = GetStringFromLump(lump);
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@ bool VkShaderManager::CompileNextShader()
|
|||
{
|
||||
// user shaders
|
||||
|
||||
const FString& name = ExtractFileBase(usershaders[i].shader);
|
||||
const FString& name = ExtractFileBase(usershaders[i].shader.GetChars());
|
||||
FString defines = defaultshaders[usershaders[i].shaderType].Defines + usershaders[i].defines;
|
||||
|
||||
VkShaderProgram prog;
|
||||
prog.vert = LoadVertShader(name, mainvp, defines);
|
||||
prog.frag = LoadFragShader(name, mainfp, usershaders[i].shader, defaultshaders[usershaders[i].shaderType].lightfunc, defines, true, compilePass == GBUFFER_PASS);
|
||||
prog.vert = LoadVertShader(name, mainvp, defines.GetChars());
|
||||
prog.frag = LoadFragShader(name, mainfp, usershaders[i].shader.GetChars(), defaultshaders[usershaders[i].shaderType].lightfunc, defines.GetChars(), true, compilePass == GBUFFER_PASS);
|
||||
mMaterialShaders[compilePass].push_back(std::move(prog));
|
||||
|
||||
compileIndex++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue