Merge remote-tracking branch 'gzdoom/master' into merge-gzdoom
This commit is contained in:
commit
e75e5a387b
600 changed files with 40006 additions and 59374 deletions
|
|
@ -56,10 +56,10 @@ TArray<int> LevelAABBTree::FindNodePath(unsigned int line, unsigned int node)
|
|||
double LevelAABBTree::RayTest(const DVector3 &ray_start, const DVector3 &ray_end)
|
||||
{
|
||||
// Precalculate some of the variables used by the ray/line intersection test
|
||||
DVector2 raydelta = ray_end - ray_start;
|
||||
DVector2 raydelta = (ray_end - ray_start).XY();
|
||||
double raydist2 = raydelta | raydelta;
|
||||
DVector2 raynormal = DVector2(raydelta.Y, -raydelta.X);
|
||||
double rayd = raynormal | ray_start;
|
||||
double rayd = raynormal | ray_start.XY();
|
||||
if (raydist2 < 1.0)
|
||||
return 1.0f;
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ double LevelAABBTree::RayTest(const DVector3 &ray_start, const DVector3 &ray_end
|
|||
{
|
||||
int node_index = stack[stack_pos - 1];
|
||||
|
||||
if (!OverlapRayAABB(ray_start, ray_end, nodes[node_index]))
|
||||
if (!OverlapRayAABB(ray_start.XY(), ray_end.XY(), nodes[node_index]))
|
||||
{
|
||||
// If the ray doesn't overlap this node's AABB we're done for this subtree
|
||||
stack_pos--;
|
||||
|
|
@ -81,7 +81,7 @@ double LevelAABBTree::RayTest(const DVector3 &ray_start, const DVector3 &ray_end
|
|||
else if (nodes[node_index].line_index != -1) // isLeaf(node_index)
|
||||
{
|
||||
// We reached a leaf node. Do a ray/line intersection test to see if we hit the line.
|
||||
hit_fraction = std::min(IntersectRayLine(ray_start, ray_end, nodes[node_index].line_index, raydelta, rayd, raydist2), hit_fraction);
|
||||
hit_fraction = std::min(IntersectRayLine(ray_start.XY(), ray_end.XY(), nodes[node_index].line_index, raydelta, rayd, raydist2), hit_fraction);
|
||||
stack_pos--;
|
||||
}
|
||||
else if (stack_pos == 32)
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
|||
FString type = NextGlslToken(chars, len, pos);
|
||||
FString identifier = NextGlslToken(chars, len, pos);
|
||||
|
||||
isSamplerUniformName = uniform.Compare("uniform") == 0 && isShaderType(type);
|
||||
isSamplerUniformName = uniform.Compare("uniform") == 0 && isShaderType(type.GetChars());
|
||||
if (isSamplerUniformName)
|
||||
{
|
||||
samplerstobind.Push(std::make_pair(identifier, val));
|
||||
|
|
@ -246,7 +246,7 @@ FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
|||
|
||||
// keyword following the declaration?
|
||||
bool keywordFound = true;
|
||||
long i;
|
||||
ptrdiff_t i;
|
||||
for (i = 0; inoutkeyword[i] != 0; i++)
|
||||
{
|
||||
if (chars[endIndex + i] != inoutkeyword[i])
|
||||
|
|
|
|||
|
|
@ -1016,7 +1016,7 @@ void PPCustomShaderInstance::SetTextures(PPRenderState *renderstate)
|
|||
while (it.NextPair(pair))
|
||||
{
|
||||
FString name = pair->Value;
|
||||
auto gtex = TexMan.GetGameTexture(TexMan.CheckForTexture(name, ETextureType::Any), true);
|
||||
auto gtex = TexMan.GetGameTexture(TexMan.CheckForTexture(name.GetChars(), ETextureType::Any), true);
|
||||
if (gtex && gtex->isValid())
|
||||
{
|
||||
// Why does this completely circumvent the normal way of handling textures?
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ CCMD (shaderenable)
|
|||
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
|
||||
{
|
||||
PostProcessShader &shader = PostProcessShaders[i];
|
||||
if (strcmp(shader.Name, shaderName) == 0)
|
||||
if (shader.Name.Compare(shaderName) == 0)
|
||||
{
|
||||
if (value != -1)
|
||||
shader.Enabled = value;
|
||||
|
|
@ -70,7 +70,7 @@ CCMD (shaderuniform)
|
|||
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
|
||||
{
|
||||
PostProcessShader &shader = PostProcessShaders[i];
|
||||
if (strcmp(shader.Name, shaderName) == 0)
|
||||
if (shader.Name.Compare(shaderName) == 0)
|
||||
{
|
||||
if (argv.argc() > 3)
|
||||
{
|
||||
|
|
@ -116,7 +116,7 @@ CCMD(listuniforms)
|
|||
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
|
||||
{
|
||||
PostProcessShader &shader = PostProcessShaders[i];
|
||||
if (strcmp(shader.Name, shaderName) == 0)
|
||||
if (shader.Name.Compare(shaderName) == 0)
|
||||
{
|
||||
Printf("Shader '%s' uniforms:\n", shaderName);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "basics.h"
|
||||
|
||||
|
||||
struct FModelVertex
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
CUSTOM_CVAR(Int, uiscale, 0, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
if (self < 0)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "hw_shadowmap.h"
|
||||
#include "hw_levelmesh.h"
|
||||
#include "buffers.h"
|
||||
#include "files.h"
|
||||
|
||||
|
||||
struct FPortalSceneState;
|
||||
|
|
@ -84,7 +85,6 @@ EXTERN_CVAR(Int, win_h)
|
|||
EXTERN_CVAR(Bool, win_maximized)
|
||||
|
||||
struct FColormap;
|
||||
class FileWriter;
|
||||
enum FTextureFormat : uint32_t;
|
||||
class FModelRenderer;
|
||||
struct SamplerUniform;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "zvulkan/vulkanbuilders.h"
|
||||
#include "halffloat.h"
|
||||
#include "filesystem.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
#define USE_DRAWINDIRECT
|
||||
|
||||
|
|
@ -656,8 +657,7 @@ FString VkLightmap::LoadPrivateShaderLump(const char* lumpname)
|
|||
{
|
||||
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
|
||||
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
|
||||
FileData data = fileSystem.ReadFile(lump);
|
||||
return data.GetString();
|
||||
return GetStringFromLump(lump);
|
||||
}
|
||||
|
||||
FString VkLightmap::LoadPublicShaderLump(const char* lumpname)
|
||||
|
|
@ -665,8 +665,7 @@ FString VkLightmap::LoadPublicShaderLump(const char* lumpname)
|
|||
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
|
||||
if (lump == -1) lump = fileSystem.CheckNumForFullName(lumpname);
|
||||
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
|
||||
FileData data = fileSystem.ReadFile(lump);
|
||||
return data.GetString();
|
||||
return GetStringFromLump(lump);
|
||||
}
|
||||
|
||||
ShaderIncludeResult VkLightmap::OnInclude(FString headerName, FString includerName, size_t depth, bool system)
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "vulkan/commands/vk_commandbuffer.h"
|
||||
#include <zvulkan/vulkanbuilders.h>
|
||||
#include "filesystem.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
VkPPShader::VkPPShader(VulkanRenderDevice* fb, PPShader *shader) : fb(fb)
|
||||
{
|
||||
|
|
@ -66,9 +67,10 @@ 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());
|
||||
FString code = fileSystem.ReadFile(lump).GetString().GetChars();
|
||||
auto sp = fileSystem.ReadFile(lump);
|
||||
FString code = GetStringFromLump(lump);
|
||||
|
||||
FString patchedCode;
|
||||
patchedCode.AppendFormat("#version %d\n", 450);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "filesystem.h"
|
||||
#include "engineerrors.h"
|
||||
#include "version.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
VkShaderManager::VkShaderManager(VulkanRenderDevice* fb) : fb(fb)
|
||||
{
|
||||
|
|
@ -117,11 +118,11 @@ VkShaderProgram* VkShaderManager::Get(const VkShaderKey& key)
|
|||
else
|
||||
{
|
||||
const auto& desc = usershaders[key.EffectState - FIRST_USER_SHADER];
|
||||
const FString& name = ExtractFileBase(desc.shader);
|
||||
const FString& name = ExtractFileBase(desc.shader.GetChars());
|
||||
FString defines = defaultshaders[desc.shaderType].Defines + desc.defines;
|
||||
|
||||
program.vert = LoadVertShader(name, mainvp, defines);
|
||||
program.frag = LoadFragShader(name, mainfp, desc.shader, defaultshaders[desc.shaderType].mateffect_lump, defaultshaders[desc.shaderType].lightmodel_lump, defines, key);
|
||||
program.vert = LoadVertShader(name, mainvp, defines.GetChars());
|
||||
program.frag = LoadFragShader(name, mainfp, desc.shader.GetChars(), defaultshaders[desc.shaderType].mateffect_lump, defaultshaders[desc.shaderType].lightmodel_lump, defines.GetChars(), key);
|
||||
}
|
||||
}
|
||||
return &program;
|
||||
|
|
@ -307,16 +308,14 @@ FString VkShaderManager::LoadPublicShaderLump(const char *lumpname)
|
|||
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
|
||||
if (lump == -1) lump = fileSystem.CheckNumForFullName(lumpname);
|
||||
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
|
||||
FileData data = fileSystem.ReadFile(lump);
|
||||
return data.GetString();
|
||||
return GetStringFromLump(lump);
|
||||
}
|
||||
|
||||
FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
|
||||
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
|
||||
FileData data = fileSystem.ReadFile(lump);
|
||||
return data.GetString();
|
||||
return GetStringFromLump(lump);
|
||||
}
|
||||
|
||||
VkPPShader* VkShaderManager::GetVkShader(PPShader* shader)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue