Skip to content

Commit bba8744

Browse files
committed
xrRender/ShaderResourceTraits.h: removed excessive string duplication
1 parent be54d04 commit bba8744

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Layers/xrRender/ShaderResourceTraits.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,18 +394,12 @@ inline T* CResourceManager::CreateShader(const char* name, const char* filename
394394
}
395395
R_ASSERT3(file, "Shader file doesnt exist:", cname);
396396

397-
// Duplicate and zero-terminate
398-
const auto size = file->length();
399-
char* const data = (LPSTR)_alloca(size + 1);
400-
CopyMemory(data, file->pointer(), size);
401-
data[size] = 0;
402-
403397
// Select target
404398
LPCSTR c_target = ShaderTypeTraits<T>::GetCompilationTarget();
405399
LPCSTR c_entry = "main";
406400

407401
if (searchForEntryAndTarget)
408-
ShaderTypeTraits<T>::GetCompilationTarget(c_target, c_entry, data);
402+
ShaderTypeTraits<T>::GetCompilationTarget(c_target, c_entry, static_cast<pcstr>(file->pointer()));
409403

410404
#ifdef USE_OGL
411405
DWORD flags = NULL;

0 commit comments

Comments
 (0)