forked from 0ad/0ad
Adds renderer backend interface and dummy backend.
Comments By: phosit, Stan Tested By: Langbart, phosit Differential Revision: https://code.wildfiregames.com/D4636 This was SVN commit r26858.
This commit is contained in:
parent
c5f71d6b87
commit
62e589ab76
@ -116,6 +116,7 @@ cursorbackend = "sdl"
|
||||
; Backends for all graphics rendering:
|
||||
; glarb - GL with legacy assembler-like shaders, might used only for buggy drivers.
|
||||
; gl - GL with GLSL shaders, should be used by default.
|
||||
; dummy - backend that does nothing, allows to check performance without backend drivers.
|
||||
rendererbackend = "gl"
|
||||
|
||||
; Enables additional debug information in renderer backend.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@ -209,10 +209,10 @@ function RunDetection(settings)
|
||||
var gfx_mem = settings.gfx_mem;
|
||||
|
||||
// Values from glGetString
|
||||
var GL_VENDOR = settings.GL_VENDOR;
|
||||
var GL_RENDERER = settings.GL_RENDERER;
|
||||
var GL_VERSION = settings.GL_VERSION;
|
||||
var GL_EXTENSIONS = settings.GL_EXTENSIONS.split(" ");
|
||||
var GL_VENDOR = settings.renderer_backend.GL_VENDOR;
|
||||
var GL_RENDERER = settings.renderer_backend.GL_RENDERER;
|
||||
var GL_VERSION = settings.renderer_backend.GL_VERSION;
|
||||
var GL_EXTENSIONS = settings.renderer_backend.GL_EXTENSIONS.split(" ");
|
||||
|
||||
// Enable GLSL on OpenGL 3+, which should be able to properly
|
||||
// manage GLSL shaders, needed for effects like windy trees
|
||||
@ -340,6 +340,10 @@ function RunDetection(settings)
|
||||
|
||||
global.RunHardwareDetection = function(settings)
|
||||
{
|
||||
// Currently we don't have limitations for other backends than GL and GL ARB.
|
||||
if (settings.renderer_backend.name != 'gl' && settings.renderer_backend.name != 'glarb')
|
||||
return;
|
||||
|
||||
//print(JSON.stringify(settings, null, 1)+"\n");
|
||||
|
||||
var output = RunDetection(settings);
|
||||
|
@ -15,9 +15,9 @@ print("<th>Output");
|
||||
print("<th>Warnings");
|
||||
|
||||
hwdetectTestData.sort(function(a, b) {
|
||||
if (a.GL_RENDERER < b.GL_RENDERER)
|
||||
if (a.renderer_backend.GL_RENDERER < b.renderer_backend.GL_RENDERER)
|
||||
return -1;
|
||||
if (b.GL_RENDERER < a.GL_RENDERER)
|
||||
if (b.renderer_backend.GL_RENDERER < a.renderer_backend.GL_RENDERER)
|
||||
return +1;
|
||||
return 0;
|
||||
});
|
||||
@ -35,7 +35,7 @@ for (var settings of hwdetectTestData)
|
||||
|
||||
print("<tr>");
|
||||
print("<td>" + os);
|
||||
print("<td>" + settings.GL_RENDERER);
|
||||
print("<td>" + settings.renderer_backend.GL_RENDERER);
|
||||
print("<td>" + disabled.join(" "));
|
||||
print("<td>" + output.warnings.concat(output.dialog_warnings).join("\n"));
|
||||
}
|
||||
|
@ -786,7 +786,9 @@ function setup_all_libs ()
|
||||
"graphics/scripting",
|
||||
"renderer",
|
||||
"renderer/backend",
|
||||
"renderer/backend/dummy",
|
||||
"renderer/backend/gl",
|
||||
"renderer/backend/vulkan",
|
||||
"renderer/scripting",
|
||||
"third_party/mikktspace",
|
||||
"third_party/ogre3d_preprocessor"
|
||||
|
@ -47,7 +47,7 @@ struct SBindingSlots
|
||||
};
|
||||
|
||||
inline void DrawTextureImpl(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CTexturePtr& texture, const PlaneArray2D& vertices, PlaneArray2D uvs,
|
||||
const CColor& multiply, const CColor& add, const float grayscaleFactor,
|
||||
const SBindingSlots& bindingSlots)
|
||||
@ -85,7 +85,7 @@ inline void DrawTextureImpl(
|
||||
class CCanvas2D::Impl
|
||||
{
|
||||
public:
|
||||
Impl(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Impl(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
: DeviceCommandContext(deviceCommandContext)
|
||||
{
|
||||
}
|
||||
@ -124,7 +124,7 @@ public:
|
||||
Tech.reset();
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CDeviceCommandContext* DeviceCommandContext;
|
||||
Renderer::Backend::IDeviceCommandContext* DeviceCommandContext = nullptr;
|
||||
CShaderTechniquePtr Tech;
|
||||
|
||||
// We assume that the shader can't be destroyed while it's bound. So these
|
||||
@ -133,7 +133,7 @@ public:
|
||||
};
|
||||
|
||||
CCanvas2D::CCanvas2D(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
: m(std::make_unique<Impl>(deviceCommandContext))
|
||||
{
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "graphics/Texture.h"
|
||||
#include "maths/Vector2D.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@ -35,7 +35,7 @@ struct CColor;
|
||||
class CCanvas2D
|
||||
{
|
||||
public:
|
||||
CCanvas2D(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
CCanvas2D(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
~CCanvas2D();
|
||||
|
||||
CCanvas2D(const CCanvas2D&) = delete;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
#include "renderer/TimeManager.h"
|
||||
@ -106,7 +106,7 @@ void CLOSTexture::MakeDirty()
|
||||
m_Dirty = true;
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CTexture* CLOSTexture::GetTextureSmooth()
|
||||
Renderer::Backend::ITexture* CLOSTexture::GetTextureSmooth()
|
||||
{
|
||||
if (CRenderer::IsInitialised() && !g_RenderingOptions.GetSmoothLOS())
|
||||
return GetTexture();
|
||||
@ -114,7 +114,7 @@ Renderer::Backend::GL::CTexture* CLOSTexture::GetTextureSmooth()
|
||||
return m_SmoothTextures[m_WhichTexture].get();
|
||||
}
|
||||
|
||||
void CLOSTexture::InterpolateLOS(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void CLOSTexture::InterpolateLOS(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
const bool skipSmoothLOS = CRenderer::IsInitialised() && !g_RenderingOptions.GetSmoothLOS();
|
||||
if (!skipSmoothLOS && !m_ShaderInitialized)
|
||||
@ -209,7 +209,7 @@ void CLOSTexture::InterpolateLOS(Renderer::Backend::GL::CDeviceCommandContext* d
|
||||
}
|
||||
|
||||
|
||||
Renderer::Backend::GL::CTexture* CLOSTexture::GetTexture()
|
||||
Renderer::Backend::ITexture* CLOSTexture::GetTexture()
|
||||
{
|
||||
ENSURE(!m_Dirty);
|
||||
return m_Texture.get();
|
||||
@ -227,7 +227,7 @@ const CMatrix3D& CLOSTexture::GetMinimapTextureMatrix()
|
||||
return m_MinimapTextureMatrix;
|
||||
}
|
||||
|
||||
void CLOSTexture::ConstructTexture(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void CLOSTexture::ConstructTexture(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
CmpPtr<ICmpRangeManager> cmpRangeManager(m_Simulation, SYSTEM_ENTITY);
|
||||
if (!cmpRangeManager)
|
||||
@ -237,7 +237,7 @@ void CLOSTexture::ConstructTexture(Renderer::Backend::GL::CDeviceCommandContext*
|
||||
|
||||
const size_t textureSize = round_up_to_pow2(round_up((size_t)m_MapSize + g_BlurSize - 1, g_SubTextureAlignment));
|
||||
|
||||
Renderer::Backend::GL::CDevice* backendDevice = deviceCommandContext->GetDevice();
|
||||
Renderer::Backend::IDevice* backendDevice = deviceCommandContext->GetDevice();
|
||||
|
||||
const Renderer::Backend::Sampler::Desc defaultSamplerDesc =
|
||||
Renderer::Backend::Sampler::MakeDefaultSampler(
|
||||
@ -311,7 +311,7 @@ void CLOSTexture::ConstructTexture(Renderer::Backend::GL::CDeviceCommandContext*
|
||||
}
|
||||
}
|
||||
|
||||
void CLOSTexture::RecomputeTexture(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void CLOSTexture::RecomputeTexture(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
// If the map was resized, delete and regenerate the texture
|
||||
if (m_Texture)
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
#include "graphics/ShaderTechniquePtr.h"
|
||||
#include "maths/Matrix3D.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Framebuffer.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/IFramebuffer.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -53,10 +53,10 @@ public:
|
||||
* Also potentially switches the current active texture unit, and enables texturing on it.
|
||||
* The texture is in 8-bit ALPHA format.
|
||||
*/
|
||||
Renderer::Backend::GL::CTexture* GetTexture();
|
||||
Renderer::Backend::GL::CTexture* GetTextureSmooth();
|
||||
Renderer::Backend::ITexture* GetTexture();
|
||||
Renderer::Backend::ITexture* GetTextureSmooth();
|
||||
|
||||
void InterpolateLOS(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void InterpolateLOS(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Returns a matrix to map (x,y,z) world coordinates onto (u,v) LOS texture
|
||||
@ -75,8 +75,8 @@ public:
|
||||
private:
|
||||
void DeleteTexture();
|
||||
bool CreateShader();
|
||||
void ConstructTexture(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void RecomputeTexture(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void ConstructTexture(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
void RecomputeTexture(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
size_t GetBitmapSize(size_t w, size_t h, size_t* pitch);
|
||||
void GenerateBitmap(const CLosQuerier& los, u8* losData, size_t w, size_t h, size_t pitch);
|
||||
@ -87,7 +87,7 @@ private:
|
||||
|
||||
bool m_ShaderInitialized = false;
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture>
|
||||
std::unique_ptr<Renderer::Backend::ITexture>
|
||||
m_Texture, m_SmoothTextures[2];
|
||||
|
||||
uint32_t m_WhichTexture = 0;
|
||||
@ -95,7 +95,7 @@ private:
|
||||
// We update textures once a frame, so we change a Framebuffer once a frame.
|
||||
// That allows us to use two ping-pong FBOs instead of checking completeness
|
||||
// of Framebuffer each frame.
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer>
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer>
|
||||
m_SmoothFramebuffers[2];
|
||||
CShaderTechniquePtr m_SmoothTech;
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "ps/Game.h"
|
||||
#include "ps/World.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
@ -71,7 +71,7 @@ unsigned int ScaleColor(unsigned int color, float x)
|
||||
}
|
||||
|
||||
void DrawTexture(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
const float quadUVs[] =
|
||||
{
|
||||
@ -146,7 +146,7 @@ inline void AddEntity(const MinimapUnitVertex& v,
|
||||
|
||||
CMiniMapTexture::CMiniMapTexture(CSimulation2& simulation)
|
||||
: m_Simulation(simulation), m_IndexArray(false),
|
||||
m_VertexArray(Renderer::Backend::GL::CBuffer::Type::VERTEX, true)
|
||||
m_VertexArray(Renderer::Backend::IBuffer::Type::VERTEX, true)
|
||||
{
|
||||
// Register Relax NG validator.
|
||||
CXeromyces::AddValidator(g_VFS, "pathfinder", "simulation/data/pathfinder.rng");
|
||||
@ -210,7 +210,7 @@ void CMiniMapTexture::Update(const float UNUSED(deltaRealTime))
|
||||
}
|
||||
}
|
||||
|
||||
void CMiniMapTexture::Render(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void CMiniMapTexture::Render(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
const CTerrain* terrain = g_Game->GetWorld()->GetTerrain();
|
||||
if (!terrain)
|
||||
@ -226,7 +226,7 @@ void CMiniMapTexture::Render(Renderer::Backend::GL::CDeviceCommandContext* devic
|
||||
}
|
||||
|
||||
void CMiniMapTexture::CreateTextures(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext, const CTerrain* terrain)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext, const CTerrain* terrain)
|
||||
{
|
||||
DestroyTextures();
|
||||
|
||||
@ -238,7 +238,7 @@ void CMiniMapTexture::CreateTextures(
|
||||
Renderer::Backend::Sampler::Filter::LINEAR,
|
||||
Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE);
|
||||
|
||||
Renderer::Backend::GL::CDevice* backendDevice = deviceCommandContext->GetDevice();
|
||||
Renderer::Backend::IDevice* backendDevice = deviceCommandContext->GetDevice();
|
||||
|
||||
// Create terrain texture
|
||||
m_TerrainTexture = backendDevice->CreateTexture2D("MiniMapTerrainTexture",
|
||||
@ -272,7 +272,7 @@ void CMiniMapTexture::DestroyTextures()
|
||||
}
|
||||
|
||||
void CMiniMapTexture::RebuildTerrainTexture(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CTerrain* terrain)
|
||||
{
|
||||
const u32 x = 0;
|
||||
@ -338,7 +338,7 @@ void CMiniMapTexture::RebuildTerrainTexture(
|
||||
}
|
||||
|
||||
void CMiniMapTexture::RenderFinalTexture(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
// only update 2x / second
|
||||
// (note: since units only move a few pixels per second on the minimap,
|
||||
@ -579,7 +579,7 @@ void CMiniMapTexture::RenderFinalTexture(
|
||||
|
||||
if (m_EntitiesDrawn > 0)
|
||||
{
|
||||
Renderer::Backend::GL::CDeviceCommandContext::Rect scissorRect;
|
||||
Renderer::Backend::IDeviceCommandContext::Rect scissorRect;
|
||||
scissorRect.x = scissorRect.y = 1;
|
||||
scissorRect.width = scissorRect.height = FINAL_TEXTURE_SIZE - 2;
|
||||
deviceCommandContext->SetScissors(1, &scissorRect);
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "graphics/Color.h"
|
||||
#include "graphics/Texture.h"
|
||||
#include "maths/Vector2D.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
#include "renderer/VertexArray.h"
|
||||
|
||||
#include <memory>
|
||||
@ -46,9 +46,9 @@ public:
|
||||
/**
|
||||
* Redraws the texture if it's dirty.
|
||||
*/
|
||||
void Render(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void Render(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
Renderer::Backend::GL::CTexture* GetTexture() const { return m_FinalTexture.get(); }
|
||||
Renderer::Backend::ITexture* GetTexture() const { return m_FinalTexture.get(); }
|
||||
|
||||
/**
|
||||
* @return The maximum height for unit passage in water.
|
||||
@ -67,14 +67,14 @@ public:
|
||||
|
||||
private:
|
||||
void CreateTextures(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CTerrain* terrain);
|
||||
void DestroyTextures();
|
||||
void RebuildTerrainTexture(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CTerrain* terrain);
|
||||
void RenderFinalTexture(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
CSimulation2& m_Simulation;
|
||||
|
||||
@ -83,10 +83,10 @@ private:
|
||||
double m_LastFinalTextureUpdate = 0.0;
|
||||
|
||||
// minimap texture handles
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture>
|
||||
std::unique_ptr<Renderer::Backend::ITexture>
|
||||
m_TerrainTexture, m_FinalTexture;
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer>
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer>
|
||||
m_FinalTextureFramebuffer;
|
||||
|
||||
// texture data
|
||||
|
@ -33,7 +33,7 @@ CParticleEmitter::CParticleEmitter(const CParticleEmitterTypePtr& type) :
|
||||
m_Type(type), m_Active(true), m_NextParticleIdx(0), m_EmissionRoundingError(0.f),
|
||||
m_LastUpdateTime(type->m_Manager.GetCurrentTime()),
|
||||
m_IndexArray(false),
|
||||
m_VertexArray(Renderer::Backend::GL::CBuffer::Type::VERTEX, true),
|
||||
m_VertexArray(Renderer::Backend::IBuffer::Type::VERTEX, true),
|
||||
m_LastFrameNumber(-1)
|
||||
{
|
||||
// If we should start with particles fully emitted, pretend that we
|
||||
@ -175,7 +175,7 @@ void CParticleEmitter::PrepareForRendering()
|
||||
}
|
||||
|
||||
void CParticleEmitter::Bind(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader)
|
||||
{
|
||||
m_Type->m_Texture->UploadBackendTextureIfNeeded(deviceCommandContext);
|
||||
@ -201,7 +201,7 @@ void CParticleEmitter::Bind(
|
||||
}
|
||||
|
||||
void CParticleEmitter::RenderArray(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (m_Particles.empty())
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "graphics/ModelAbstract.h"
|
||||
#include "graphics/ParticleEmitterType.h"
|
||||
#include "maths/Quaternion.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
#include "renderer/VertexArray.h"
|
||||
|
||||
@ -123,14 +123,14 @@ public:
|
||||
* Bind rendering state (textures and blend modes).
|
||||
*/
|
||||
void Bind(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader);
|
||||
|
||||
/**
|
||||
* Draw the vertex array.
|
||||
*/
|
||||
void RenderArray(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Stop this emitter emitting new particles, and pass responsibility for rendering
|
||||
|
@ -226,7 +226,7 @@ CVector4D CShaderUniforms::GetVector(const char* name) const
|
||||
}
|
||||
|
||||
void CShaderUniforms::BindUniforms(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader) const
|
||||
{
|
||||
for (const SItems::Item& item : m_Items->items)
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
|
||||
#include <map>
|
||||
@ -180,7 +180,7 @@ public:
|
||||
* Bind the collection of uniforms onto the given shader.
|
||||
*/
|
||||
void BindUniforms(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader) const;
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
|
||||
@ -141,6 +141,15 @@ bool CShaderManager::NewEffect(const CStr& name, const CShaderDefines& baseDefin
|
||||
if (ret != PSRETURN_OK)
|
||||
return false;
|
||||
|
||||
// By default we assume that we have techinques for every dummy shader.
|
||||
if (g_VideoMode.GetBackend() == CVideoMode::Backend::DUMMY)
|
||||
{
|
||||
const Renderer::Backend::GraphicsPipelineStateDesc passPipelineStateDesc =
|
||||
Renderer::Backend::MakeDefaultGraphicsPipelineStateDesc();
|
||||
tech->SetPasses({{passPipelineStateDesc, LoadProgram("dummy", baseDefines)}});
|
||||
return true;
|
||||
}
|
||||
|
||||
// Define all the elements and attributes used in the XML file
|
||||
#define EL(x) int el_##x = XeroFile.GetElementID(#x)
|
||||
#define AT(x) int at_##x = XeroFile.GetAttributeID(#x)
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "ShaderProgram.h"
|
||||
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
|
||||
CShaderProgram::CShaderProgram(const CStr& name, const CShaderDefines& defines)
|
||||
: m_Name(name), m_Defines(defines)
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -306,7 +306,7 @@ CTerrainTextureManager::LoadAlphaMap(const VfsPath& alphaMapType)
|
||||
}
|
||||
|
||||
void CTerrainTextureManager::UploadResourcesIfNeeded(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
for (const CTerrainTextureManager::TerrainAlphaMap::iterator& it : m_AlphaMapsToUpload)
|
||||
{
|
||||
@ -314,7 +314,7 @@ void CTerrainTextureManager::UploadResourcesIfNeeded(
|
||||
if (!alphaMap.m_CompositeDataToUpload)
|
||||
continue;
|
||||
// Upload the composite texture.
|
||||
Renderer::Backend::GL::CTexture* texture = alphaMap.m_CompositeAlphaMap.get();
|
||||
Renderer::Backend::ITexture* texture = alphaMap.m_CompositeAlphaMap.get();
|
||||
deviceCommandContext->UploadTexture(
|
||||
texture, Renderer::Backend::Format::A8_UNORM, alphaMap.m_CompositeDataToUpload.get(),
|
||||
texture->GetWidth() * texture->GetHeight());
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "lib/file/vfs/vfs_path.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/Singleton.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@ -72,7 +72,7 @@ public:
|
||||
struct TerrainAlpha
|
||||
{
|
||||
// Composite alpha map (all the alpha maps packed into one texture).
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_CompositeAlphaMap;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_CompositeAlphaMap;
|
||||
// Data is used to separate file loading and uploading to GPU.
|
||||
std::shared_ptr<u8> m_CompositeDataToUpload;
|
||||
// Coordinates of each (untransformed) alpha map within the packed texture.
|
||||
@ -121,7 +121,7 @@ public:
|
||||
|
||||
CTerrainTextureManager::TerrainAlphaMap::iterator LoadAlphaMap(const VfsPath& alphaMapType);
|
||||
|
||||
void UploadResourcesIfNeeded(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void UploadResourcesIfNeeded(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
private:
|
||||
// All texture entries created by this class, for easy freeing now that
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include "graphics/Terrain.h"
|
||||
#include "lib/bits.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "simulation2/Simulation2.h"
|
||||
#include "simulation2/helpers/Grid.h"
|
||||
@ -57,7 +57,7 @@ bool CTerritoryTexture::UpdateDirty()
|
||||
return cmpTerritoryManager && cmpTerritoryManager->NeedUpdateTexture(&m_DirtyID);
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CTexture* CTerritoryTexture::GetTexture()
|
||||
Renderer::Backend::ITexture* CTerritoryTexture::GetTexture()
|
||||
{
|
||||
ENSURE(!UpdateDirty());
|
||||
return m_Texture.get();
|
||||
@ -75,7 +75,7 @@ const CMatrix3D& CTerritoryTexture::GetMinimapTextureMatrix()
|
||||
return m_MinimapTextureMatrix;
|
||||
}
|
||||
|
||||
void CTerritoryTexture::ConstructTexture(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void CTerritoryTexture::ConstructTexture(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
CmpPtr<ICmpTerrain> cmpTerrain(m_Simulation, SYSTEM_ENTITY);
|
||||
if (!cmpTerrain)
|
||||
@ -129,7 +129,7 @@ void CTerritoryTexture::ConstructTexture(Renderer::Backend::GL::CDeviceCommandCo
|
||||
}
|
||||
}
|
||||
|
||||
void CTerritoryTexture::RecomputeTexture(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void CTerritoryTexture::RecomputeTexture(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
// If the map was resized, delete and regenerate the texture
|
||||
if (m_Texture)
|
||||
@ -246,7 +246,7 @@ void CTerritoryTexture::GenerateBitmap(const Grid<u8>& territories, u8* bitmap,
|
||||
bitmap[(j*w+i)*4 + 3] = 0;
|
||||
}
|
||||
|
||||
void CTerritoryTexture::UpdateIfNeeded(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void CTerritoryTexture::UpdateIfNeeded(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (UpdateDirty())
|
||||
RecomputeTexture(deviceCommandContext);
|
||||
|
@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
#include "maths/Matrix3D.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
||||
class CSimulation2;
|
||||
template<typename T>
|
||||
@ -40,7 +40,7 @@ public:
|
||||
* Also potentially switches the current active texture unit, and enables texturing on it.
|
||||
* The texture is in 32-bit BGRA format.
|
||||
*/
|
||||
Renderer::Backend::GL::CTexture* GetTexture();
|
||||
Renderer::Backend::ITexture* GetTexture();
|
||||
|
||||
/**
|
||||
* Returns a matrix to map (x,y,z) world coordinates onto (u,v) texture
|
||||
@ -60,7 +60,7 @@ public:
|
||||
* Updates the texture if needed (territory was changed or the texture
|
||||
* wasn't created).
|
||||
*/
|
||||
void UpdateIfNeeded(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void UpdateIfNeeded(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -69,8 +69,8 @@ private:
|
||||
bool UpdateDirty();
|
||||
|
||||
void DeleteTexture();
|
||||
void ConstructTexture(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void RecomputeTexture(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void ConstructTexture(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
void RecomputeTexture(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
void GenerateBitmap(const Grid<u8>& territories, u8* bitmap, ssize_t w, ssize_t h);
|
||||
|
||||
@ -78,7 +78,7 @@ private:
|
||||
|
||||
size_t m_DirtyID;
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_Texture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_Texture;
|
||||
|
||||
ssize_t m_MapSize; // tiles per side
|
||||
|
||||
|
@ -202,7 +202,7 @@ struct SBatchCompare
|
||||
};
|
||||
|
||||
void CTextRenderer::Render(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, const CMatrix3D& transform)
|
||||
{
|
||||
std::vector<u16> indexes;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "maths/Rect.h"
|
||||
#include "maths/Vector2D.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
@ -104,7 +104,7 @@ public:
|
||||
* Render all of the previously printed text calls.
|
||||
*/
|
||||
void Render(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, const CMatrix3D& transform);
|
||||
|
||||
private:
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/Util.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -115,10 +114,10 @@ public:
|
||||
}
|
||||
|
||||
void CreateTexture(
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture,
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture,
|
||||
CTextureManagerImpl* textureManager)
|
||||
{
|
||||
Renderer::Backend::GL::CTexture* fallback = backendTexture.get();
|
||||
Renderer::Backend::ITexture* fallback = backendTexture.get();
|
||||
CTextureProperties props(VfsPath{});
|
||||
m_Texture = CTexturePtr(new CTexture(
|
||||
std::move(backendTexture), fallback, props, textureManager));
|
||||
@ -133,13 +132,10 @@ private:
|
||||
class CSingleColorTexture final : public CPredefinedTexture
|
||||
{
|
||||
public:
|
||||
CSingleColorTexture(const CColor& color, const bool disableGL,
|
||||
CSingleColorTexture(const CColor& color, Renderer::Backend::IDevice* device,
|
||||
CTextureManagerImpl* textureManager)
|
||||
: m_Color(color)
|
||||
{
|
||||
if (disableGL)
|
||||
return;
|
||||
|
||||
std::stringstream textureName;
|
||||
textureName << "SingleColorTexture (";
|
||||
textureName << "R:" << m_Color.r << ", ";
|
||||
@ -147,8 +143,8 @@ public:
|
||||
textureName << "B:" << m_Color.b << ", ";
|
||||
textureName << "A:" << m_Color.a << ")";
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture =
|
||||
g_VideoMode.GetBackendDevice()->CreateTexture2D(
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture =
|
||||
device->CreateTexture2D(
|
||||
textureName.str().c_str(),
|
||||
Renderer::Backend::Format::R8G8B8A8_UNORM,
|
||||
1, 1, Renderer::Backend::Sampler::MakeDefaultSampler(
|
||||
@ -157,7 +153,7 @@ public:
|
||||
CreateTexture(std::move(backendTexture), textureManager);
|
||||
}
|
||||
|
||||
void Upload(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void Upload(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (!GetTexture() || !GetTexture()->GetBackendTexture())
|
||||
return;
|
||||
@ -182,13 +178,10 @@ private:
|
||||
class CSingleColorTextureCube final : public CPredefinedTexture
|
||||
{
|
||||
public:
|
||||
CSingleColorTextureCube(const CColor& color, const bool disableGL,
|
||||
CSingleColorTextureCube(const CColor& color, Renderer::Backend::IDevice* device,
|
||||
CTextureManagerImpl* textureManager)
|
||||
: m_Color(color)
|
||||
{
|
||||
if (disableGL)
|
||||
return;
|
||||
|
||||
std::stringstream textureName;
|
||||
textureName << "SingleColorTextureCube (";
|
||||
textureName << "R:" << m_Color.r << ", ";
|
||||
@ -196,9 +189,9 @@ public:
|
||||
textureName << "B:" << m_Color.b << ", ";
|
||||
textureName << "A:" << m_Color.a << ")";
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture =
|
||||
g_VideoMode.GetBackendDevice()->CreateTexture(
|
||||
textureName.str().c_str(), Renderer::Backend::GL::CTexture::Type::TEXTURE_CUBE,
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture =
|
||||
device->CreateTexture(
|
||||
textureName.str().c_str(), Renderer::Backend::ITexture::Type::TEXTURE_CUBE,
|
||||
Renderer::Backend::Format::R8G8B8A8_UNORM,
|
||||
1, 1, Renderer::Backend::Sampler::MakeDefaultSampler(
|
||||
Renderer::Backend::Sampler::Filter::LINEAR,
|
||||
@ -206,7 +199,7 @@ public:
|
||||
CreateTexture(std::move(backendTexture), textureManager);
|
||||
}
|
||||
|
||||
void Upload(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void Upload(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (!GetTexture() || !GetTexture()->GetBackendTexture())
|
||||
return;
|
||||
@ -240,12 +233,9 @@ public:
|
||||
static const uint32_t NUMBER_OF_LEVELS = 9;
|
||||
|
||||
CGradientTexture(const CColor& colorFrom, const CColor& colorTo,
|
||||
const bool disableGL, CTextureManagerImpl* textureManager)
|
||||
Renderer::Backend::IDevice* device, CTextureManagerImpl* textureManager)
|
||||
: m_ColorFrom(colorFrom), m_ColorTo(colorTo)
|
||||
{
|
||||
if (disableGL)
|
||||
return;
|
||||
|
||||
std::stringstream textureName;
|
||||
textureName << "GradientTexture";
|
||||
textureName << " From (";
|
||||
@ -259,8 +249,8 @@ public:
|
||||
textureName << "B:" << m_ColorTo.b << ",";
|
||||
textureName << "A:" << m_ColorTo.a << ")";
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture =
|
||||
g_VideoMode.GetBackendDevice()->CreateTexture2D(
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture =
|
||||
device->CreateTexture2D(
|
||||
textureName.str().c_str(),
|
||||
Renderer::Backend::Format::R8G8B8A8_UNORM,
|
||||
WIDTH, 1, Renderer::Backend::Sampler::MakeDefaultSampler(
|
||||
@ -270,7 +260,7 @@ public:
|
||||
CreateTexture(std::move(backendTexture), textureManager);
|
||||
}
|
||||
|
||||
void Upload(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void Upload(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (!GetTexture() || !GetTexture()->GetBackendTexture())
|
||||
return;
|
||||
@ -356,29 +346,25 @@ class CTextureManagerImpl
|
||||
{
|
||||
friend class CTexture;
|
||||
public:
|
||||
CTextureManagerImpl(PIVFS vfs, bool highQuality, bool disableGL) :
|
||||
m_VFS(vfs), m_CacheLoader(vfs, L".dds"), m_DisableGL(disableGL),
|
||||
CTextureManagerImpl(PIVFS vfs, bool highQuality, Renderer::Backend::IDevice* device) :
|
||||
m_VFS(vfs), m_CacheLoader(vfs, L".dds"), m_Device(device),
|
||||
m_TextureConverter(vfs, highQuality),
|
||||
m_DefaultTexture(CColor(0.25f, 0.25f, 0.25f, 1.0f), disableGL, this),
|
||||
m_ErrorTexture(CColor(1.0f, 0.0f, 1.0f, 1.0f), disableGL, this),
|
||||
m_WhiteTexture(CColor(1.0f, 1.0f, 1.0f, 1.0f), disableGL, this),
|
||||
m_TransparentTexture(CColor(0.0f, 0.0f, 0.0f, 0.0f), disableGL, this),
|
||||
m_DefaultTexture(CColor(0.25f, 0.25f, 0.25f, 1.0f), device, this),
|
||||
m_ErrorTexture(CColor(1.0f, 0.0f, 1.0f, 1.0f), device, this),
|
||||
m_WhiteTexture(CColor(1.0f, 1.0f, 1.0f, 1.0f), device, this),
|
||||
m_TransparentTexture(CColor(0.0f, 0.0f, 0.0f, 0.0f), device, this),
|
||||
m_AlphaGradientTexture(
|
||||
CColor(1.0f, 1.0f, 1.0f, 0.0f), CColor(1.0f, 1.0f, 1.0f, 1.0f), disableGL, this),
|
||||
m_BlackTextureCube(CColor(0.0f, 0.0f, 0.0f, 1.0f), disableGL, this)
|
||||
CColor(1.0f, 1.0f, 1.0f, 0.0f), CColor(1.0f, 1.0f, 1.0f, 1.0f), device, this),
|
||||
m_BlackTextureCube(CColor(0.0f, 0.0f, 0.0f, 1.0f), device, this)
|
||||
{
|
||||
// Allow hotloading of textures
|
||||
RegisterFileReloadFunc(ReloadChangedFileCB, this);
|
||||
|
||||
if (disableGL)
|
||||
return;
|
||||
|
||||
Renderer::Backend::GL::CDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
m_HasS3TC =
|
||||
backendDevice->IsTextureFormatSupported(Renderer::Backend::Format::BC1_RGB_UNORM) &&
|
||||
backendDevice->IsTextureFormatSupported(Renderer::Backend::Format::BC1_RGBA_UNORM) &&
|
||||
backendDevice->IsTextureFormatSupported(Renderer::Backend::Format::BC2_UNORM) &&
|
||||
backendDevice->IsTextureFormatSupported(Renderer::Backend::Format::BC3_UNORM);
|
||||
m_Device->IsTextureFormatSupported(Renderer::Backend::Format::BC1_RGB_UNORM) &&
|
||||
m_Device->IsTextureFormatSupported(Renderer::Backend::Format::BC1_RGBA_UNORM) &&
|
||||
m_Device->IsTextureFormatSupported(Renderer::Backend::Format::BC2_UNORM) &&
|
||||
m_Device->IsTextureFormatSupported(Renderer::Backend::Format::BC3_UNORM);
|
||||
}
|
||||
|
||||
~CTextureManagerImpl()
|
||||
@ -418,8 +404,7 @@ public:
|
||||
{
|
||||
// Construct a new default texture with the given properties to use as the search key
|
||||
CTexturePtr texture(new CTexture(
|
||||
nullptr, m_DisableGL ? nullptr : m_DefaultTexture.GetTexture()->GetBackendTexture(),
|
||||
props, this));
|
||||
nullptr, m_DefaultTexture.GetTexture()->GetBackendTexture(), props, this));
|
||||
|
||||
// Try to find an existing texture with the given properties
|
||||
TextureCache::iterator it = m_TextureCache.find(texture);
|
||||
@ -435,10 +420,10 @@ public:
|
||||
}
|
||||
|
||||
CTexturePtr WrapBackendTexture(
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture)
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture)
|
||||
{
|
||||
ENSURE(backendTexture);
|
||||
Renderer::Backend::GL::CTexture* fallback = backendTexture.get();
|
||||
Renderer::Backend::ITexture* fallback = backendTexture.get();
|
||||
|
||||
CTextureProperties props(VfsPath{});
|
||||
CTexturePtr texture(new CTexture(
|
||||
@ -454,15 +439,12 @@ public:
|
||||
*/
|
||||
void LoadTexture(const CTexturePtr& texture, const VfsPath& path)
|
||||
{
|
||||
if (m_DisableGL)
|
||||
return;
|
||||
|
||||
PROFILE2("load texture");
|
||||
PROFILE2_ATTR("name: %ls", path.string().c_str());
|
||||
|
||||
std::shared_ptr<u8> fileData;
|
||||
size_t fileSize;
|
||||
const Status loadStatus = g_VFS->LoadFile(path, fileData, fileSize);
|
||||
const Status loadStatus = m_VFS->LoadFile(path, fileData, fileSize);
|
||||
if (loadStatus != INFO::OK)
|
||||
{
|
||||
LOGERROR("Texture failed to load; \"%s\" %s",
|
||||
@ -578,7 +560,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
texture->m_BackendTexture = g_VideoMode.GetBackendDevice()->CreateTexture2D(
|
||||
texture->m_BackendTexture = m_Device->CreateTexture2D(
|
||||
texture->m_Properties.m_Path.string8().c_str(),
|
||||
format, (width >> texture->m_BaseLevelOffset), (height >> texture->m_BaseLevelOffset),
|
||||
defaultSamplerDesc, MIPLevelCount - texture->m_BaseLevelOffset);
|
||||
@ -767,7 +749,7 @@ public:
|
||||
}
|
||||
|
||||
bool MakeUploadProgress(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (!m_PredefinedTexturesUploaded)
|
||||
{
|
||||
@ -886,7 +868,7 @@ public:
|
||||
private:
|
||||
PIVFS m_VFS;
|
||||
CCacheLoader m_CacheLoader;
|
||||
bool m_DisableGL;
|
||||
Renderer::Backend::IDevice* m_Device = nullptr;
|
||||
CTextureConverter m_TextureConverter;
|
||||
|
||||
CSingleColorTexture m_DefaultTexture;
|
||||
@ -918,8 +900,8 @@ private:
|
||||
};
|
||||
|
||||
CTexture::CTexture(
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> texture,
|
||||
Renderer::Backend::GL::CTexture* fallback,
|
||||
std::unique_ptr<Renderer::Backend::ITexture> texture,
|
||||
Renderer::Backend::ITexture* fallback,
|
||||
const CTextureProperties& props, CTextureManagerImpl* textureManager) :
|
||||
m_BackendTexture(std::move(texture)), m_FallbackBackendTexture(fallback),
|
||||
m_BaseColor(0), m_State(UNLOADED), m_Properties(props),
|
||||
@ -930,7 +912,7 @@ CTexture::CTexture(
|
||||
CTexture::~CTexture() = default;
|
||||
|
||||
void CTexture::UploadBackendTextureIfNeeded(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (IsUploaded())
|
||||
return;
|
||||
@ -960,12 +942,12 @@ void CTexture::UploadBackendTextureIfNeeded(
|
||||
m_State = UPLOADED;
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CTexture* CTexture::GetBackendTexture()
|
||||
Renderer::Backend::ITexture* CTexture::GetBackendTexture()
|
||||
{
|
||||
return m_BackendTexture && IsUploaded() ? m_BackendTexture.get() : m_FallbackBackendTexture;
|
||||
}
|
||||
|
||||
const Renderer::Backend::GL::CTexture* CTexture::GetBackendTexture() const
|
||||
const Renderer::Backend::ITexture* CTexture::GetBackendTexture() const
|
||||
{
|
||||
return m_BackendTexture && IsUploaded() ? m_BackendTexture.get() : m_FallbackBackendTexture;
|
||||
}
|
||||
@ -1000,8 +982,8 @@ void CTexture::Prefetch()
|
||||
}
|
||||
|
||||
void CTexture::ResetBackendTexture(
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture,
|
||||
Renderer::Backend::GL::CTexture* fallbackBackendTexture)
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture,
|
||||
Renderer::Backend::ITexture* fallbackBackendTexture)
|
||||
{
|
||||
m_BackendTexture = std::move(backendTexture);
|
||||
m_FallbackBackendTexture = fallbackBackendTexture;
|
||||
@ -1040,8 +1022,8 @@ size_t CTexture::GetUploadedSize() const
|
||||
|
||||
// CTextureManager: forward all calls to impl:
|
||||
|
||||
CTextureManager::CTextureManager(PIVFS vfs, bool highQuality, bool disableGL) :
|
||||
m(new CTextureManagerImpl(vfs, highQuality, disableGL))
|
||||
CTextureManager::CTextureManager(PIVFS vfs, bool highQuality, Renderer::Backend::IDevice* device) :
|
||||
m(new CTextureManagerImpl(vfs, highQuality, device))
|
||||
{
|
||||
}
|
||||
|
||||
@ -1056,7 +1038,7 @@ CTexturePtr CTextureManager::CreateTexture(const CTextureProperties& props)
|
||||
}
|
||||
|
||||
CTexturePtr CTextureManager::WrapBackendTexture(
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture)
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture)
|
||||
{
|
||||
return m->WrapBackendTexture(std::move(backendTexture));
|
||||
}
|
||||
@ -1097,7 +1079,7 @@ bool CTextureManager::MakeProgress()
|
||||
}
|
||||
|
||||
bool CTextureManager::MakeUploadProgress(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
return m->MakeUploadProgress(deviceCommandContext);
|
||||
}
|
||||
|
@ -21,8 +21,9 @@
|
||||
#include "graphics/Texture.h"
|
||||
#include "lib/file/vfs/vfs.h"
|
||||
#include "lib/tex/tex.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -58,7 +59,7 @@ class CTextureManagerImpl;
|
||||
* These will be loaded in the background, when there are no higher-priority textures
|
||||
* to load.
|
||||
*
|
||||
* The same texture file can be safely loaded multiple times with different GL parameters
|
||||
* The same texture file can be safely loaded multiple times with different backend parameters
|
||||
* (but this should be avoided whenever possible, as it wastes VRAM).
|
||||
*
|
||||
* For release packages, DDS files can be precached by appending ".dds" to their name,
|
||||
@ -77,9 +78,8 @@ public:
|
||||
* Construct texture manager. vfs must be the VFS instance used for all textures
|
||||
* loaded from this object.
|
||||
* highQuality is slower and intended for batch-conversion modes.
|
||||
* disableGL is intended for tests, and will disable all GL uploads.
|
||||
*/
|
||||
CTextureManager(PIVFS vfs, bool highQuality, bool disableGL);
|
||||
CTextureManager(PIVFS vfs, bool highQuality, Renderer::Backend::IDevice* device);
|
||||
|
||||
~CTextureManager();
|
||||
|
||||
@ -93,7 +93,7 @@ public:
|
||||
* Wraps a backend texture.
|
||||
*/
|
||||
CTexturePtr WrapBackendTexture(
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture);
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture);
|
||||
|
||||
/**
|
||||
* Returns a magenta texture. Use this for highlighting errors
|
||||
@ -133,7 +133,7 @@ public:
|
||||
* Work on asynchronous texture uploading operations, if any.
|
||||
* Returns true if it did any work. Mostly the same as MakeProgress.
|
||||
*/
|
||||
bool MakeUploadProgress(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
bool MakeUploadProgress(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Synchronously converts and compresses and saves the texture,
|
||||
@ -294,13 +294,13 @@ public:
|
||||
* will be uploaded.
|
||||
*/
|
||||
void UploadBackendTextureIfNeeded(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Returns a backend texture if successfully uploaded, else fallback.
|
||||
*/
|
||||
Renderer::Backend::GL::CTexture* GetBackendTexture();
|
||||
const Renderer::Backend::GL::CTexture* GetBackendTexture() const;
|
||||
Renderer::Backend::ITexture* GetBackendTexture();
|
||||
const Renderer::Backend::ITexture* GetBackendTexture() const;
|
||||
|
||||
/**
|
||||
* Attempt to load the texture data quickly, as with
|
||||
@ -336,19 +336,19 @@ private:
|
||||
|
||||
// Only the texture manager can create these
|
||||
explicit CTexture(
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> texture,
|
||||
Renderer::Backend::GL::CTexture* fallback,
|
||||
std::unique_ptr<Renderer::Backend::ITexture> texture,
|
||||
Renderer::Backend::ITexture* fallback,
|
||||
const CTextureProperties& props, CTextureManagerImpl* textureManager);
|
||||
|
||||
void ResetBackendTexture(
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> backendTexture,
|
||||
Renderer::Backend::GL::CTexture* fallbackBackendTexture);
|
||||
std::unique_ptr<Renderer::Backend::ITexture> backendTexture,
|
||||
Renderer::Backend::ITexture* fallbackBackendTexture);
|
||||
|
||||
const CTextureProperties m_Properties;
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_BackendTexture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_BackendTexture;
|
||||
// It's possible to m_FallbackBackendTexture references m_BackendTexture.
|
||||
Renderer::Backend::GL::CTexture* m_FallbackBackendTexture = nullptr;
|
||||
Renderer::Backend::ITexture* m_FallbackBackendTexture = nullptr;
|
||||
u32 m_BaseColor;
|
||||
std::unique_ptr<Tex> m_TextureData;
|
||||
size_t m_UploadedSize = 0;
|
||||
|
@ -21,16 +21,21 @@
|
||||
#include "lib/external_libraries/libsdl.h"
|
||||
#include "lib/file/vfs/vfs.h"
|
||||
#include "lib/tex/tex.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
|
||||
class TestTextureManager : public CxxTest::TestSuite
|
||||
{
|
||||
PIVFS m_VFS;
|
||||
std::unique_ptr<Renderer::Backend::IDevice> m_Device;
|
||||
|
||||
public:
|
||||
|
||||
void setUp()
|
||||
{
|
||||
CConfigDB::Initialise();
|
||||
|
||||
DeleteDirectory(DataDir()/"_testcache"); // clean up in case the last test run failed
|
||||
|
||||
m_VFS = CreateVfs();
|
||||
@ -38,6 +43,8 @@ public:
|
||||
TS_ASSERT_OK(m_VFS->Mount(L"cache/", DataDir() / "_testcache" / "", 0, VFS_MAX_PRIORITY));
|
||||
|
||||
CXeromyces::Startup();
|
||||
|
||||
m_Device = std::make_unique<Renderer::Backend::Dummy::CDevice>();
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
@ -46,12 +53,14 @@ public:
|
||||
|
||||
m_VFS.reset();
|
||||
DeleteDirectory(DataDir()/"_testcache");
|
||||
|
||||
CConfigDB::Shutdown();
|
||||
}
|
||||
|
||||
void test_load_basic()
|
||||
{
|
||||
{
|
||||
CTextureManager texman(m_VFS, false, true);
|
||||
CTextureManager texman(m_VFS, false, m_Device.get());
|
||||
|
||||
CTexturePtr t1 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo.png"));
|
||||
|
||||
@ -82,7 +91,7 @@ public:
|
||||
|
||||
// New texture manager - should use the cached file
|
||||
{
|
||||
CTextureManager texman(m_VFS, false, true);
|
||||
CTextureManager texman(m_VFS, false, m_Device.get());
|
||||
|
||||
CTexturePtr t1 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo.png"));
|
||||
|
||||
@ -94,7 +103,7 @@ public:
|
||||
|
||||
void test_load_formats()
|
||||
{
|
||||
CTextureManager texman(m_VFS, false, true);
|
||||
CTextureManager texman(m_VFS, false, m_Device.get());
|
||||
CTexturePtr t1 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo.tga"));
|
||||
CTexturePtr t2 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo-abgr.dds"));
|
||||
CTexturePtr t3 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo-dxt1.dds"));
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "gui/SettingTypes/CGUIString.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
||||
#include <math.h>
|
||||
@ -418,7 +418,7 @@ bool CGUIText::AssembleCalls(
|
||||
|
||||
void CGUIText::Draw(CGUI& pGUI, CCanvas2D& canvas, const CGUIColor& DefaultColor, const CVector2D& pos, CRect clipping) const
|
||||
{
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
|
||||
bool isClipped = clipping != CRect();
|
||||
@ -431,7 +431,7 @@ void CGUIText::Draw(CGUI& pGUI, CCanvas2D& canvas, const CGUIColor& DefaultColor
|
||||
clipping.right = std::floor(clipping.right);
|
||||
|
||||
const float scale = g_VideoMode.GetScale();
|
||||
Renderer::Backend::GL::CDeviceCommandContext::Rect scissorRect;
|
||||
Renderer::Backend::IDeviceCommandContext::Rect scissorRect;
|
||||
scissorRect.x = std::ceil(clipping.left * scale);
|
||||
scissorRect.y = std::ceil(g_yres - clipping.bottom * scale);
|
||||
scissorRect.width = std::floor(clipping.GetWidth() * scale);
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "ps/Globals.h"
|
||||
#include "ps/Hotkey.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
||||
#include <sstream>
|
||||
@ -1191,7 +1191,7 @@ void CInput::UpdateCachedSize()
|
||||
|
||||
void CInput::Draw(CCanvas2D& canvas)
|
||||
{
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
|
||||
if (m_CursorBlinkRate > 0.0)
|
||||
@ -1244,7 +1244,7 @@ void CInput::Draw(CCanvas2D& canvas)
|
||||
if (cliparea != CRect())
|
||||
{
|
||||
const float scale = g_VideoMode.GetScale();
|
||||
Renderer::Backend::GL::CDeviceCommandContext::Rect scissorRect;
|
||||
Renderer::Backend::IDeviceCommandContext::Rect scissorRect;
|
||||
scissorRect.x = cliparea.left * scale;
|
||||
scissorRect.y = g_yres - cliparea.bottom * scale;
|
||||
scissorRect.width = cliparea.GetWidth() * scale;
|
||||
|
@ -95,7 +95,7 @@ void CropPointsByCircle(const std::array<CVector3D, 4>& points, const CVector3D&
|
||||
}
|
||||
|
||||
void DrawTexture(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
float angle, float x, float y, float x2, float y2, float mapScale)
|
||||
{
|
||||
// Rotate the texture coordinates (0,0)-(coordMax,coordMax) around their center point (m,m)
|
||||
@ -427,7 +427,7 @@ void CMiniMap::Draw(CCanvas2D& canvas)
|
||||
Renderer::Backend::BlendFactor::ONE_MINUS_SRC_ALPHA;
|
||||
pipelineStateDesc.blendState.colorBlendOp = pipelineStateDesc.blendState.alphaBlendOp =
|
||||
Renderer::Backend::BlendOp::ADD;
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
deviceCommandContext->SetGraphicsPipelineState(pipelineStateDesc);
|
||||
deviceCommandContext->BeginPass();
|
||||
|
@ -74,7 +74,7 @@ that of Atlas depending on commandline parameters.
|
||||
#include "graphics/GameView.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "gui/GUIManager.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "rlinterface/RLInterface.h"
|
||||
#include "scriptinterface/ScriptContext.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -25,6 +25,7 @@
|
||||
#include "lib/file/archive/archive_zip.h"
|
||||
#include "lib/file/vfs/vfs_util.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@ -76,7 +77,8 @@ void CArchiveBuilder::Build(const OsPath& archive, bool compress)
|
||||
|
||||
// Use CTextureManager instead of CTextureConverter directly,
|
||||
// so it can deal with all the loading of settings.xml files
|
||||
CTextureManager textureManager(m_VFS, true, true);
|
||||
Renderer::Backend::Dummy::CDevice device;
|
||||
CTextureManager textureManager(m_VFS, true, &device);
|
||||
|
||||
CColladaManager colladaManager(m_VFS);
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "ps/scripting/JSInterface_Debug.h"
|
||||
#include "ps/UserReport.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "scriptinterface/FunctionWrapper.h"
|
||||
#include "scriptinterface/JSON.h"
|
||||
#include "scriptinterface/Object.h"
|
||||
@ -137,7 +137,11 @@ void RunHardwareDetection()
|
||||
|
||||
ReportFreeType(rq, settings);
|
||||
|
||||
g_VideoMode.GetBackendDevice()->Report(rq, settings);
|
||||
JS::RootedValue backendDeviceSettings(rq.cx);
|
||||
Script::CreateObject(rq, &backendDeviceSettings);
|
||||
|
||||
g_VideoMode.GetBackendDevice()->Report(rq, backendDeviceSettings);
|
||||
Script::SetProperty(rq, settings, "renderer_backend", backendDeviceSettings);
|
||||
|
||||
Script::SetProperty(rq, settings, "video_desktop_xres", g_VideoMode.GetDesktopXRes());
|
||||
Script::SetProperty(rq, settings, "video_desktop_yres", g_VideoMode.GetDesktopYRes());
|
||||
@ -191,7 +195,7 @@ void RunHardwareDetection()
|
||||
Script::SetProperty(rq, settings, "timer_resolution", timer_Resolution());
|
||||
|
||||
// The version should be increased for every meaningful change.
|
||||
const int reportVersion = 18;
|
||||
const int reportVersion = 19;
|
||||
|
||||
// Send the same data to the reporting system
|
||||
g_UserReporter.SubmitReport(
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "lib/ogl.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/Profiler2.h"
|
||||
#include "ps/VideoMode.h"
|
||||
|
||||
#include <deque>
|
||||
#include <stack>
|
||||
@ -69,6 +70,8 @@ class CProfiler2GPUARB
|
||||
public:
|
||||
static bool IsSupported()
|
||||
{
|
||||
if (g_VideoMode.GetBackend() != CVideoMode::Backend::GL)
|
||||
return false;
|
||||
return ogl_HaveExtension("GL_ARB_timer_query");
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "ps/GameSetup/GameSetup.h"
|
||||
#include "ps/Pyrogenesis.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
|
||||
#if CONFIG2_AUDIO
|
||||
#include "soundmanager/SoundManager.h"
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "ps/Game.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/Pyrogenesis.h"
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
||||
@ -235,6 +236,8 @@ void CVideoMode::ReadConfig()
|
||||
CFG_GET_VAL("rendererbackend", rendererBackend);
|
||||
if (rendererBackend == "glarb")
|
||||
m_Backend = Backend::GL_ARB;
|
||||
else if (rendererBackend == "dummy")
|
||||
m_Backend = Backend::DUMMY;
|
||||
else
|
||||
m_Backend = Backend::GL;
|
||||
}
|
||||
@ -526,6 +529,11 @@ void CVideoMode::Shutdown()
|
||||
|
||||
bool CVideoMode::CreateBackendDevice(const bool createSDLContext)
|
||||
{
|
||||
if (m_Backend == Backend::DUMMY)
|
||||
{
|
||||
m_BackendDevice = std::make_unique<Renderer::Backend::Dummy::CDevice>();
|
||||
return true;
|
||||
}
|
||||
m_BackendDevice = Renderer::Backend::GL::CDevice::Create(createSDLContext ? m_Window : nullptr, m_Backend == Backend::GL_ARB);
|
||||
if (!m_BackendDevice && m_Backend == Backend::GL)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -28,10 +28,7 @@ namespace Renderer
|
||||
{
|
||||
namespace Backend
|
||||
{
|
||||
namespace GL
|
||||
{
|
||||
class CDevice;
|
||||
}
|
||||
class IDevice;
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +38,8 @@ public:
|
||||
enum class Backend
|
||||
{
|
||||
GL,
|
||||
GL_ARB
|
||||
GL_ARB,
|
||||
DUMMY
|
||||
};
|
||||
|
||||
CVideoMode();
|
||||
@ -128,7 +126,7 @@ public:
|
||||
|
||||
Backend GetBackend() const { return m_Backend; }
|
||||
|
||||
Renderer::Backend::GL::CDevice* GetBackendDevice() { return m_BackendDevice.get(); }
|
||||
Renderer::Backend::IDevice* GetBackendDevice() { return m_BackendDevice.get(); }
|
||||
|
||||
private:
|
||||
void ReadConfig();
|
||||
@ -184,7 +182,7 @@ private:
|
||||
std::unique_ptr<CCursor> m_Cursor;
|
||||
|
||||
Backend m_Backend = Backend::GL;
|
||||
std::unique_ptr<Renderer::Backend::GL::CDevice> m_BackendDevice;
|
||||
std::unique_ptr<Renderer::Backend::IDevice> m_BackendDevice;
|
||||
};
|
||||
|
||||
extern CVideoMode g_VideoMode;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "maths/Matrix3D.h"
|
||||
#include "maths/Vector3D.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
|
||||
@ -38,7 +38,7 @@ namespace
|
||||
{
|
||||
|
||||
void SetGraphicsPipelineStateFromTechAndColor(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderTechniquePtr& tech, const CColor& color, const bool depthTestEnabled = true,
|
||||
const bool wireframe = false)
|
||||
{
|
||||
@ -80,7 +80,7 @@ void CDebugRenderer::DrawLine(
|
||||
{
|
||||
CShaderTechniquePtr debugLineTech =
|
||||
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
SetGraphicsPipelineStateFromTechAndColor(
|
||||
deviceCommandContext, debugLineTech, color, depthTestEnabled);
|
||||
@ -138,7 +138,7 @@ void CDebugRenderer::DrawCircle(const CVector3D& origin, const float radius, con
|
||||
{
|
||||
CShaderTechniquePtr debugCircleTech =
|
||||
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
SetGraphicsPipelineStateFromTechAndColor(
|
||||
deviceCommandContext, debugCircleTech, color);
|
||||
@ -202,7 +202,7 @@ void CDebugRenderer::DrawCameraFrustum(const CCamera& camera, const CColor& colo
|
||||
|
||||
CShaderTechniquePtr overlayTech =
|
||||
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
SetGraphicsPipelineStateFromTechAndColor(
|
||||
deviceCommandContext, overlayTech, color, true, wireframe);
|
||||
@ -301,7 +301,7 @@ void CDebugRenderer::DrawBoundingBox(
|
||||
const CMatrix3D& transform, bool wireframe)
|
||||
{
|
||||
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_solid);
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
SetGraphicsPipelineStateFromTechAndColor(
|
||||
deviceCommandContext, shaderTech, color, true, wireframe);
|
||||
@ -348,7 +348,7 @@ void CDebugRenderer::DrawBoundingBox(
|
||||
void CDebugRenderer::DrawBrush(const CBrush& brush, const CColor& color, bool wireframe)
|
||||
{
|
||||
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_solid);
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
SetGraphicsPipelineStateFromTechAndColor(
|
||||
deviceCommandContext, shaderTech, color, true, wireframe);
|
||||
|
@ -95,7 +95,7 @@ void CDecalRData::Update(CSimulation2* simulation)
|
||||
}
|
||||
|
||||
void CDecalRData::RenderDecals(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CDecalRData*>& decals, const CShaderDefines& context, ShadowMap* shadow)
|
||||
{
|
||||
PROFILE3("render terrain decals");
|
||||
@ -324,7 +324,7 @@ void CDecalRData::BuildVertexData()
|
||||
{
|
||||
m_VBDecals = g_VBMan.AllocateChunk(
|
||||
sizeof(SDecalVertex), vertices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::VERTEX, false);
|
||||
Renderer::Backend::IBuffer::Type::VERTEX, false);
|
||||
}
|
||||
m_VBDecals->m_Owner->UpdateChunkVertices(m_VBDecals.Get(), vertices.data());
|
||||
|
||||
@ -366,7 +366,7 @@ void CDecalRData::BuildVertexData()
|
||||
{
|
||||
m_VBDecalsIndices = g_VBMan.AllocateChunk(
|
||||
sizeof(u16), indices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::INDEX, false);
|
||||
Renderer::Backend::IBuffer::Type::INDEX, false);
|
||||
}
|
||||
m_VBDecalsIndices->m_Owner->UpdateChunkVertices(m_VBDecalsIndices.Get(), indices.data());
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "graphics/RenderableObject.h"
|
||||
#include "maths/Vector2D.h"
|
||||
#include "maths/Vector3D.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/VertexBufferManager.h"
|
||||
|
||||
#include <vector>
|
||||
@ -40,7 +40,7 @@ public:
|
||||
void Update(CSimulation2* simulation);
|
||||
|
||||
static void RenderDecals(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CDecalRData*>& decals, const CShaderDefines& context, ShadowMap* shadow);
|
||||
|
||||
CModelDecal* GetDecal() { return m_Decal; }
|
||||
|
@ -49,7 +49,7 @@ struct ShaderModelDef : public CModelDefRPrivate
|
||||
|
||||
ShaderModelDef::ShaderModelDef(const CModelDefPtr& mdef)
|
||||
: m_IndexArray(false),
|
||||
m_Array(Renderer::Backend::GL::CBuffer::Type::VERTEX, false)
|
||||
m_Array(Renderer::Backend::IBuffer::Type::VERTEX, false)
|
||||
{
|
||||
size_t numVertices = mdef->GetNumVertices();
|
||||
|
||||
@ -91,7 +91,7 @@ struct ShaderModel : public CModelRData
|
||||
|
||||
ShaderModel(const void* key)
|
||||
: CModelRData(key),
|
||||
m_Array(Renderer::Backend::GL::CBuffer::Type::VERTEX, true)
|
||||
m_Array(Renderer::Backend::IBuffer::Type::VERTEX, true)
|
||||
{}
|
||||
};
|
||||
|
||||
@ -179,13 +179,13 @@ void ShaderModelVertexRenderer::BeginPass()
|
||||
|
||||
// Cleanup one rendering pass
|
||||
void ShaderModelVertexRenderer::EndPass(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext))
|
||||
Renderer::Backend::IDeviceCommandContext* UNUSED(deviceCommandContext))
|
||||
{
|
||||
}
|
||||
|
||||
// Prepare UV coordinates for this modeldef
|
||||
void ShaderModelVertexRenderer::PrepareModelDef(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CModelDef& def)
|
||||
{
|
||||
m->shadermodeldef = (ShaderModelDef*)def.GetRenderData(m);
|
||||
@ -214,7 +214,7 @@ void ShaderModelVertexRenderer::PrepareModelDef(
|
||||
|
||||
// Render one model
|
||||
void ShaderModelVertexRenderer::RenderModel(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* UNUSED(shader), CModel* model, CModelRData* data)
|
||||
{
|
||||
const CModelDefPtr& mdldef = model->GetModelDef();
|
||||
|
@ -41,12 +41,12 @@ public:
|
||||
|
||||
void BeginPass() override;
|
||||
void EndPass(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext) override;
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext) override;
|
||||
void PrepareModelDef(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CModelDef& def) override;
|
||||
void RenderModel(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, CModel* model, CModelRData* data) override;
|
||||
|
||||
protected:
|
||||
|
@ -55,7 +55,7 @@ struct IModelDef : public CModelDefRPrivate
|
||||
|
||||
|
||||
IModelDef::IModelDef(const CModelDefPtr& mdef, bool gpuSkinning, bool calculateTangents)
|
||||
: m_IndexArray(false), m_Array(Renderer::Backend::GL::CBuffer::Type::VERTEX, false)
|
||||
: m_IndexArray(false), m_Array(Renderer::Backend::IBuffer::Type::VERTEX, false)
|
||||
{
|
||||
size_t numVertices = mdef->GetNumVertices();
|
||||
|
||||
@ -300,13 +300,13 @@ void InstancingModelRenderer::BeginPass()
|
||||
|
||||
// Cleanup rendering pass.
|
||||
void InstancingModelRenderer::EndPass(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext))
|
||||
Renderer::Backend::IDeviceCommandContext* UNUSED(deviceCommandContext))
|
||||
{
|
||||
}
|
||||
|
||||
// Prepare UV coordinates for this modeldef
|
||||
void InstancingModelRenderer::PrepareModelDef(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CModelDef& def)
|
||||
{
|
||||
m->imodeldef = (IModelDef*)def.GetRenderData(m);
|
||||
@ -367,7 +367,7 @@ void InstancingModelRenderer::PrepareModelDef(
|
||||
|
||||
// Render one model
|
||||
void InstancingModelRenderer::RenderModel(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, CModel* model, CModelRData* UNUSED(data))
|
||||
{
|
||||
const CModelDefPtr& mdldef = model->GetModelDef();
|
||||
|
@ -44,11 +44,11 @@ public:
|
||||
|
||||
void BeginPass() override;
|
||||
void EndPass(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext) override;
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext) override;
|
||||
void PrepareModelDef(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CModelDef& def) override;
|
||||
void RenderModel(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
void RenderModel(Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, CModel* model, CModelRData* data) override;
|
||||
|
||||
protected:
|
||||
|
@ -345,7 +345,7 @@ struct SMRCompareTechBucket
|
||||
};
|
||||
|
||||
void ShaderModelRenderer::Render(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const RenderModifierPtr& modifier, const CShaderDefines& context, int cullGroup, int flags)
|
||||
{
|
||||
if (m->submissions[cullGroup].empty())
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "graphics/MeshManager.h"
|
||||
#include "graphics/RenderableObject.h"
|
||||
#include "graphics/SColor.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/VertexArray.h"
|
||||
|
||||
class RenderModifier;
|
||||
@ -159,7 +159,7 @@ public:
|
||||
* CModel::GetFlags() are rendered.
|
||||
*/
|
||||
virtual void Render(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const RenderModifierPtr& modifier, const CShaderDefines& context, int cullGroup, int flags) = 0;
|
||||
|
||||
/**
|
||||
@ -268,7 +268,7 @@ public:
|
||||
virtual void PrepareModels();
|
||||
virtual void EndFrame();
|
||||
virtual void Render(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const RenderModifierPtr& modifier, const CShaderDefines& context, int cullGroup, int flags);
|
||||
|
||||
private:
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "graphics/MeshManager.h"
|
||||
#include "graphics/ShaderProgramPtr.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
|
||||
class CModel;
|
||||
@ -110,7 +110,7 @@ public:
|
||||
* ModelRenderer implementations must call this function after
|
||||
* rendering related functions for one pass have been called.
|
||||
*/
|
||||
virtual void EndPass(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext) = 0;
|
||||
virtual void EndPass(Renderer::Backend::IDeviceCommandContext* deviceCommandContext) = 0;
|
||||
|
||||
|
||||
/**
|
||||
@ -125,7 +125,7 @@ public:
|
||||
* @param def The model definition.
|
||||
*/
|
||||
virtual void PrepareModelDef(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CModelDef& def) = 0;
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ public:
|
||||
* succeed.
|
||||
*/
|
||||
virtual void RenderModel(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, CModel* model, CModelRData* data) = 0;
|
||||
};
|
||||
|
||||
|
@ -154,7 +154,7 @@ struct OverlayRendererInternals
|
||||
const float OverlayRenderer::OVERLAY_VOFFSET = 0.2f;
|
||||
|
||||
OverlayRendererInternals::OverlayRendererInternals()
|
||||
: quadVertices(Renderer::Backend::GL::CBuffer::Type::VERTEX, true),
|
||||
: quadVertices(Renderer::Backend::IBuffer::Type::VERTEX, true),
|
||||
quadIndices(false)
|
||||
{
|
||||
quadAttributePos.format = Renderer::Backend::Format::R32G32B32_SFLOAT;
|
||||
@ -368,7 +368,7 @@ void OverlayRenderer::PrepareForRendering()
|
||||
}
|
||||
|
||||
void OverlayRenderer::RenderOverlaysBeforeWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
PROFILE3_GPU("overlays (before)");
|
||||
GPU_SCOPED_LABEL(deviceCommandContext, "Render overlays before water");
|
||||
@ -383,7 +383,7 @@ void OverlayRenderer::RenderOverlaysBeforeWater(
|
||||
}
|
||||
|
||||
void OverlayRenderer::RenderOverlaysAfterWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
PROFILE3_GPU("overlays (after)");
|
||||
GPU_SCOPED_LABEL(deviceCommandContext, "Render overlays after water");
|
||||
@ -393,7 +393,7 @@ void OverlayRenderer::RenderOverlaysAfterWater(
|
||||
RenderSphereOverlays(deviceCommandContext);
|
||||
}
|
||||
|
||||
void OverlayRenderer::RenderTexturedOverlayLines(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
void OverlayRenderer::RenderTexturedOverlayLines(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (m->texlines.empty())
|
||||
return;
|
||||
@ -477,7 +477,7 @@ void OverlayRenderer::RenderTexturedOverlayLines(Renderer::Backend::GL::CDeviceC
|
||||
}
|
||||
|
||||
void OverlayRenderer::RenderTexturedOverlayLines(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, bool alwaysVisible)
|
||||
{
|
||||
for (size_t i = 0; i < m->texlines.size(); ++i)
|
||||
@ -494,7 +494,7 @@ void OverlayRenderer::RenderTexturedOverlayLines(
|
||||
}
|
||||
|
||||
void OverlayRenderer::RenderQuadOverlays(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (m->quadBatchMap.empty())
|
||||
return;
|
||||
@ -589,7 +589,7 @@ void OverlayRenderer::RenderQuadOverlays(
|
||||
}
|
||||
|
||||
void OverlayRenderer::RenderForegroundOverlays(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CCamera& viewCamera)
|
||||
{
|
||||
PROFILE3_GPU("overlays (fg)");
|
||||
@ -739,7 +739,7 @@ void OverlayRendererInternals::GenerateSphere()
|
||||
}
|
||||
|
||||
void OverlayRenderer::RenderSphereOverlays(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
PROFILE3_GPU("overlays (spheres)");
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define INCLUDED_OVERLAYRENDERER
|
||||
|
||||
#include "graphics/ShaderProgram.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
||||
struct SOverlayLine;
|
||||
struct SOverlayTexturedLine;
|
||||
@ -101,7 +101,7 @@ public:
|
||||
* and should be drawn before water (i.e. may be visible under the water)
|
||||
*/
|
||||
void RenderOverlaysBeforeWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Render all the submitted overlays that are embedded in the world
|
||||
@ -109,7 +109,7 @@ public:
|
||||
* and should be drawn after water (i.e. may be visible on top of the water)
|
||||
*/
|
||||
void RenderOverlaysAfterWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Render all the submitted overlays that should appear on top of everything
|
||||
@ -117,7 +117,7 @@ public:
|
||||
* @param viewCamera camera to be used for billboard computations
|
||||
*/
|
||||
void RenderForegroundOverlays(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CCamera& viewCamera);
|
||||
|
||||
/// Small vertical offset of overlays from terrain to prevent visual glitches
|
||||
@ -130,7 +130,7 @@ private:
|
||||
* renders textured overlay lines batched according to their visibility status by delegating
|
||||
* to RenderTexturedOverlayLines(CShaderProgramPtr, bool).
|
||||
*/
|
||||
void RenderTexturedOverlayLines(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void RenderTexturedOverlayLines(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Helper method; renders those overlay lines currently registered in the internals (i.e.
|
||||
@ -139,18 +139,18 @@ private:
|
||||
* requires a separate shader to be used.
|
||||
*/
|
||||
void RenderTexturedOverlayLines(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, bool alwaysVisible);
|
||||
|
||||
/**
|
||||
* Helper method; batch-renders all registered quad overlays, batched by their texture for effiency.
|
||||
*/
|
||||
void RenderQuadOverlays(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void RenderQuadOverlays(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Helper method; batch-renders all sphere quad overlays.
|
||||
*/
|
||||
void RenderSphereOverlays(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void RenderSphereOverlays(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
private:
|
||||
OverlayRendererInternals* m;
|
||||
|
@ -127,7 +127,7 @@ void ParticleRenderer::PrepareForRendering(const CShaderDefines& context)
|
||||
}
|
||||
|
||||
void ParticleRenderer::RenderParticles(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup, bool wireframe)
|
||||
{
|
||||
CShaderTechnique* lastTech = nullptr;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#ifndef INCLUDED_PARTICLERENDERER
|
||||
#define INCLUDED_PARTICLERENDERER
|
||||
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
||||
class CParticleEmitter;
|
||||
class CShaderDefines;
|
||||
@ -56,7 +56,7 @@ public:
|
||||
* Render all the submitted particles.
|
||||
*/
|
||||
void RenderParticles(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup, bool wireframe = false);
|
||||
|
||||
/**
|
||||
|
@ -283,7 +283,7 @@ void CPatchRData::BuildBlends()
|
||||
|
||||
m_VBBlends = g_VBMan.AllocateChunk(
|
||||
sizeof(SBlendVertex), blendVertices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::VERTEX, false,
|
||||
Renderer::Backend::IBuffer::Type::VERTEX, false,
|
||||
nullptr, CVertexBufferManager::Group::TERRAIN);
|
||||
m_VBBlends->m_Owner->UpdateChunkVertices(m_VBBlends.Get(), &blendVertices[0]);
|
||||
|
||||
@ -293,7 +293,7 @@ void CPatchRData::BuildBlends()
|
||||
|
||||
m_VBBlendIndices = g_VBMan.AllocateChunk(
|
||||
sizeof(u16), blendIndices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::INDEX, false,
|
||||
Renderer::Backend::IBuffer::Type::INDEX, false,
|
||||
nullptr, CVertexBufferManager::Group::TERRAIN);
|
||||
m_VBBlendIndices->m_Owner->UpdateChunkVertices(m_VBBlendIndices.Get(), &blendIndices[0]);
|
||||
}
|
||||
@ -497,7 +497,7 @@ void CPatchRData::BuildIndices()
|
||||
// Construct vertex buffer
|
||||
m_VBBaseIndices = g_VBMan.AllocateChunk(
|
||||
sizeof(u16), indices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::INDEX, false, nullptr, CVertexBufferManager::Group::TERRAIN);
|
||||
Renderer::Backend::IBuffer::Type::INDEX, false, nullptr, CVertexBufferManager::Group::TERRAIN);
|
||||
m_VBBaseIndices->m_Owner->UpdateChunkVertices(m_VBBaseIndices.Get(), &indices[0]);
|
||||
}
|
||||
|
||||
@ -543,7 +543,7 @@ void CPatchRData::BuildVertices()
|
||||
{
|
||||
m_VBBase = g_VBMan.AllocateChunk(
|
||||
sizeof(SBaseVertex), vsize * vsize,
|
||||
Renderer::Backend::GL::CBuffer::Type::VERTEX, false,
|
||||
Renderer::Backend::IBuffer::Type::VERTEX, false,
|
||||
nullptr, CVertexBufferManager::Group::TERRAIN);
|
||||
}
|
||||
|
||||
@ -637,7 +637,7 @@ void CPatchRData::BuildSides()
|
||||
{
|
||||
m_VBSides = g_VBMan.AllocateChunk(
|
||||
sizeof(SSideVertex), sideVertices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::VERTEX, false,
|
||||
Renderer::Backend::IBuffer::Type::VERTEX, false,
|
||||
nullptr, CVertexBufferManager::Group::DEFAULT);
|
||||
}
|
||||
m_VBSides->m_Owner->UpdateChunkVertices(m_VBSides.Get(), &sideVertices[0]);
|
||||
@ -715,7 +715,7 @@ using TextureBatches = PooledBatchMap<CTerrainTextureEntry*, VertexBufferBatches
|
||||
using ShaderTechniqueBatches = PooledBatchMap<std::pair<CStrIntern, CShaderDefines>, TextureBatches>;
|
||||
|
||||
void CPatchRData::RenderBases(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CPatchRData*>& patches, const CShaderDefines& context, ShadowMap* shadow)
|
||||
{
|
||||
PROFILE3("render terrain bases");
|
||||
@ -887,7 +887,7 @@ struct SBlendStackItem
|
||||
};
|
||||
|
||||
void CPatchRData::RenderBlends(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CPatchRData*>& patches, const CShaderDefines& context, ShadowMap* shadow)
|
||||
{
|
||||
PROFILE3("render terrain blends");
|
||||
@ -1009,7 +1009,7 @@ void CPatchRData::RenderBlends(
|
||||
Renderer::Backend::IShaderProgram* shader = techBase->GetShader(pass);
|
||||
TerrainRenderer::PrepareShader(deviceCommandContext, shader, shadow);
|
||||
|
||||
Renderer::Backend::GL::CTexture* lastBlendTex = nullptr;
|
||||
Renderer::Backend::ITexture* lastBlendTex = nullptr;
|
||||
|
||||
const int32_t baseTexBindingSlot =
|
||||
shader->GetBindingSlot(str_baseTex);
|
||||
@ -1035,7 +1035,7 @@ void CPatchRData::RenderBlends(
|
||||
samp.Sampler->GetBackendTexture());
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CTexture* currentBlendTex = itt->m_Texture->m_TerrainAlpha->second.m_CompositeAlphaMap.get();
|
||||
Renderer::Backend::ITexture* currentBlendTex = itt->m_Texture->m_TerrainAlpha->second.m_CompositeAlphaMap.get();
|
||||
if (currentBlendTex != lastBlendTex)
|
||||
{
|
||||
deviceCommandContext->SetTexture(
|
||||
@ -1110,7 +1110,7 @@ void CPatchRData::RenderBlends(
|
||||
}
|
||||
|
||||
void CPatchRData::RenderStreams(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CPatchRData*>& patches, const bool bindPositionAsTexCoord)
|
||||
{
|
||||
PROFILE3("render terrain streams");
|
||||
@ -1210,7 +1210,7 @@ void CPatchRData::RenderOutline()
|
||||
}
|
||||
|
||||
void CPatchRData::RenderSides(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CPatchRData*>& patches)
|
||||
{
|
||||
PROFILE3("render terrain sides");
|
||||
@ -1446,13 +1446,13 @@ void CPatchRData::BuildWater()
|
||||
{
|
||||
m_VBWater = g_VBMan.AllocateChunk(
|
||||
sizeof(SWaterVertex), water_vertex_data.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::VERTEX, false,
|
||||
Renderer::Backend::IBuffer::Type::VERTEX, false,
|
||||
nullptr, CVertexBufferManager::Group::WATER);
|
||||
m_VBWater->m_Owner->UpdateChunkVertices(m_VBWater.Get(), &water_vertex_data[0]);
|
||||
|
||||
m_VBWaterIndices = g_VBMan.AllocateChunk(
|
||||
sizeof(GLushort), water_indices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::INDEX, false,
|
||||
Renderer::Backend::IBuffer::Type::INDEX, false,
|
||||
nullptr, CVertexBufferManager::Group::WATER);
|
||||
m_VBWaterIndices->m_Owner->UpdateChunkVertices(m_VBWaterIndices.Get(), &water_indices[0]);
|
||||
}
|
||||
@ -1461,21 +1461,21 @@ void CPatchRData::BuildWater()
|
||||
{
|
||||
m_VBWaterShore = g_VBMan.AllocateChunk(
|
||||
sizeof(SWaterVertex), water_vertex_data_shore.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::VERTEX, false,
|
||||
Renderer::Backend::IBuffer::Type::VERTEX, false,
|
||||
nullptr, CVertexBufferManager::Group::WATER);
|
||||
m_VBWaterShore->m_Owner->UpdateChunkVertices(m_VBWaterShore.Get(), &water_vertex_data_shore[0]);
|
||||
|
||||
// Construct indices buffer
|
||||
m_VBWaterIndicesShore = g_VBMan.AllocateChunk(
|
||||
sizeof(GLushort), water_indices_shore.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::INDEX, false,
|
||||
Renderer::Backend::IBuffer::Type::INDEX, false,
|
||||
nullptr, CVertexBufferManager::Group::WATER);
|
||||
m_VBWaterIndicesShore->m_Owner->UpdateChunkVertices(m_VBWaterIndicesShore.Get(), &water_indices_shore[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void CPatchRData::RenderWaterSurface(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const bool bindWaterData)
|
||||
{
|
||||
ASSERT(m_UpdateFlags == 0);
|
||||
@ -1511,7 +1511,7 @@ void CPatchRData::RenderWaterSurface(
|
||||
}
|
||||
|
||||
void CPatchRData::RenderWaterShore(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
ASSERT(m_UpdateFlags == 0);
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "graphics/RenderableObject.h"
|
||||
#include "maths/Vector2D.h"
|
||||
#include "maths/Vector3D.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
#include "renderer/VertexBufferManager.h"
|
||||
|
||||
@ -49,26 +49,26 @@ public:
|
||||
void RenderPriorities(CTextRenderer& textRenderer);
|
||||
|
||||
void RenderWaterSurface(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const bool bindWaterData);
|
||||
void RenderWaterShore(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
CPatch* GetPatch() { return m_Patch; }
|
||||
|
||||
const CBoundingBoxAligned& GetWaterBounds() const { return m_WaterBounds; }
|
||||
|
||||
static void RenderBases(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CPatchRData*>& patches, const CShaderDefines& context, ShadowMap* shadow);
|
||||
static void RenderBlends(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CPatchRData*>& patches, const CShaderDefines& context, ShadowMap* shadow);
|
||||
static void RenderStreams(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CPatchRData*>& patches, const bool bindPositionAsTexCoord);
|
||||
static void RenderSides(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const std::vector<CPatchRData*>& patches);
|
||||
|
||||
static void PrepareShader(ShadowMap* shadow);
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "ps/Game.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "ps/World.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
#include "tools/atlas/GameInterface/GameLoop.h"
|
||||
@ -122,7 +122,7 @@ void CPostprocManager::RecreateBuffers()
|
||||
{
|
||||
Cleanup();
|
||||
|
||||
Renderer::Backend::GL::CDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
Renderer::Backend::IDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
|
||||
#define GEN_BUFFER_RGBA(name, w, h) \
|
||||
name = backendDevice->CreateTexture2D( \
|
||||
@ -186,9 +186,9 @@ void CPostprocManager::RecreateBuffers()
|
||||
|
||||
|
||||
void CPostprocManager::ApplyBlurDownscale2x(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::GL::CFramebuffer* framebuffer,
|
||||
Renderer::Backend::GL::CTexture* inTex, int inWidth, int inHeight)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IFramebuffer* framebuffer,
|
||||
Renderer::Backend::ITexture* inTex, int inWidth, int inHeight)
|
||||
{
|
||||
deviceCommandContext->SetFramebuffer(framebuffer);
|
||||
|
||||
@ -249,11 +249,11 @@ void CPostprocManager::ApplyBlurDownscale2x(
|
||||
}
|
||||
|
||||
void CPostprocManager::ApplyBlurGauss(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::GL::CTexture* inTex,
|
||||
Renderer::Backend::GL::CTexture* tempTex,
|
||||
Renderer::Backend::GL::CFramebuffer* tempFramebuffer,
|
||||
Renderer::Backend::GL::CFramebuffer* outFramebuffer,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::ITexture* inTex,
|
||||
Renderer::Backend::ITexture* tempTex,
|
||||
Renderer::Backend::IFramebuffer* tempFramebuffer,
|
||||
Renderer::Backend::IFramebuffer* outFramebuffer,
|
||||
int inWidth, int inHeight)
|
||||
{
|
||||
deviceCommandContext->SetFramebuffer(tempFramebuffer);
|
||||
@ -351,10 +351,10 @@ void CPostprocManager::ApplyBlurGauss(
|
||||
}
|
||||
|
||||
void CPostprocManager::ApplyBlur(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
uint32_t width = m_Width, height = m_Height;
|
||||
Renderer::Backend::GL::CTexture* previousTexture =
|
||||
Renderer::Backend::ITexture* previousTexture =
|
||||
(m_WhichBuffer ? m_ColorTex1 : m_ColorTex2).get();
|
||||
|
||||
for (BlurScale& scale : m_BlurScales)
|
||||
@ -370,7 +370,7 @@ void CPostprocManager::ApplyBlur(
|
||||
|
||||
|
||||
void CPostprocManager::CaptureRenderOutput(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
ENSURE(m_IsInitialized);
|
||||
|
||||
@ -386,7 +386,7 @@ void CPostprocManager::CaptureRenderOutput(
|
||||
|
||||
|
||||
void CPostprocManager::ReleaseRenderOutput(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
ENSURE(m_IsInitialized);
|
||||
|
||||
@ -402,7 +402,7 @@ void CPostprocManager::ReleaseRenderOutput(
|
||||
}
|
||||
|
||||
void CPostprocManager::ApplyEffect(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderTechniquePtr& shaderTech, int pass)
|
||||
{
|
||||
// select the other FBO for rendering
|
||||
@ -481,7 +481,7 @@ void CPostprocManager::ApplyEffect(
|
||||
}
|
||||
|
||||
void CPostprocManager::ApplyPostproc(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
ENSURE(m_IsInitialized);
|
||||
|
||||
@ -635,10 +635,10 @@ void CPostprocManager::SetDepthBufferClipPlanes(float nearPlane, float farPlane)
|
||||
|
||||
void CPostprocManager::CreateMultisampleBuffer()
|
||||
{
|
||||
Renderer::Backend::GL::CDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
Renderer::Backend::IDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
|
||||
m_MultisampleColorTex = backendDevice->CreateTexture("PostProcColorMS",
|
||||
Renderer::Backend::GL::CTexture::Type::TEXTURE_2D_MULTISAMPLE,
|
||||
Renderer::Backend::ITexture::Type::TEXTURE_2D_MULTISAMPLE,
|
||||
Renderer::Backend::Format::R8G8B8A8_UNORM, m_Width, m_Height,
|
||||
Renderer::Backend::Sampler::MakeDefaultSampler(
|
||||
Renderer::Backend::Sampler::Filter::LINEAR,
|
||||
@ -646,7 +646,7 @@ void CPostprocManager::CreateMultisampleBuffer()
|
||||
|
||||
// Allocate the Depth/Stencil texture.
|
||||
m_MultisampleDepthTex = backendDevice->CreateTexture("PostProcDepthMS",
|
||||
Renderer::Backend::GL::CTexture::Type::TEXTURE_2D_MULTISAMPLE,
|
||||
Renderer::Backend::ITexture::Type::TEXTURE_2D_MULTISAMPLE,
|
||||
Renderer::Backend::Format::D24_S8, m_Width, m_Height,
|
||||
Renderer::Backend::Sampler::MakeDefaultSampler(
|
||||
Renderer::Backend::Sampler::Filter::LINEAR,
|
||||
@ -680,7 +680,7 @@ bool CPostprocManager::IsMultisampleEnabled() const
|
||||
}
|
||||
|
||||
void CPostprocManager::ResolveMultisampleFramebuffer(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (!m_UsingMultisampleBuffer)
|
||||
return;
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
#include "graphics/ShaderTechniquePtr.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "renderer/backend/gl/Framebuffer.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IFramebuffer.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
@ -66,39 +66,39 @@ public:
|
||||
// to our textures instead of directly to the system framebuffer.
|
||||
// @note CPostprocManager must be initialized first
|
||||
void CaptureRenderOutput(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
// First renders blur textures, then calls ApplyEffect for each effect pass,
|
||||
// ping-ponging the buffers at each step.
|
||||
// @note CPostprocManager must be initialized first
|
||||
void ApplyPostproc(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
// Blits the final postprocessed texture to the system framebuffer. The system framebuffer
|
||||
// is selected as the output buffer. Should be called before silhouette rendering.
|
||||
// @note CPostprocManager must be initialized first
|
||||
void ReleaseRenderOutput(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void ReleaseRenderOutput(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
// Returns true if we render main scene in the MSAA framebuffer.
|
||||
bool IsMultisampleEnabled() const;
|
||||
|
||||
// Resolves the MSAA framebuffer into the regular one.
|
||||
void ResolveMultisampleFramebuffer(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
private:
|
||||
void CreateMultisampleBuffer();
|
||||
void DestroyMultisampleBuffer();
|
||||
|
||||
// Two framebuffers, that we flip between at each shader pass.
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer>
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer>
|
||||
m_CaptureFramebuffer, m_PingFramebuffer, m_PongFramebuffer;
|
||||
|
||||
// Unique color textures for the framebuffers.
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_ColorTex1, m_ColorTex2;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_ColorTex1, m_ColorTex2;
|
||||
|
||||
// The framebuffers share a depth/stencil texture.
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_DepthTex;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_DepthTex;
|
||||
float m_NearPlane, m_FarPlane;
|
||||
|
||||
// A framebuffer and textures x2 for each blur level we render.
|
||||
@ -106,8 +106,8 @@ private:
|
||||
{
|
||||
struct Step
|
||||
{
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer> framebuffer;
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> texture;
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer> framebuffer;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> texture;
|
||||
};
|
||||
std::array<Step, 2> steps;
|
||||
};
|
||||
@ -128,8 +128,8 @@ private:
|
||||
CStr m_AAName;
|
||||
CShaderTechniquePtr m_AATech;
|
||||
bool m_UsingMultisampleBuffer;
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer> m_MultisampleFramebuffer;
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture>
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer> m_MultisampleFramebuffer;
|
||||
std::unique_ptr<Renderer::Backend::ITexture>
|
||||
m_MultisampleColorTex, m_MultisampleDepthTex;
|
||||
uint32_t m_MultisampleCount;
|
||||
std::vector<uint32_t> m_AllowedSampleCounts;
|
||||
@ -142,25 +142,25 @@ private:
|
||||
|
||||
// Creates blur textures at various scales, for bloom, DOF, etc.
|
||||
void ApplyBlur(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
// High quality GPU image scaling to half size. outTex must have exactly half the size
|
||||
// of inTex. inWidth and inHeight are the dimensions of inTex in texels.
|
||||
void ApplyBlurDownscale2x(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::GL::CFramebuffer* framebuffer,
|
||||
Renderer::Backend::GL::CTexture* inTex,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IFramebuffer* framebuffer,
|
||||
Renderer::Backend::ITexture* inTex,
|
||||
int inWidth, int inHeight);
|
||||
|
||||
// GPU-based Gaussian blur in two passes. inOutTex contains the input image and will be filled
|
||||
// with the blurred image. tempTex must have the same size as inOutTex.
|
||||
// inWidth and inHeight are the dimensions of the images in texels.
|
||||
void ApplyBlurGauss(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::GL::CTexture* inTex,
|
||||
Renderer::Backend::GL::CTexture* tempTex,
|
||||
Renderer::Backend::GL::CFramebuffer* tempFramebuffer,
|
||||
Renderer::Backend::GL::CFramebuffer* outFramebuffer,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::ITexture* inTex,
|
||||
Renderer::Backend::ITexture* tempTex,
|
||||
Renderer::Backend::IFramebuffer* tempFramebuffer,
|
||||
Renderer::Backend::IFramebuffer* outFramebuffer,
|
||||
int inWidth, int inHeight);
|
||||
|
||||
// Applies a pass of a given effect to the entire current framebuffer. The shader is
|
||||
@ -168,7 +168,7 @@ private:
|
||||
// the depth buffer, a number of blur textures, the screen size, the zNear/zFar planes and
|
||||
// some other parameters used by the optional bloom/HDR pass.
|
||||
void ApplyEffect(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderTechniquePtr& shaderTech, int pass);
|
||||
|
||||
// Delete all allocated buffers/textures from GPU memory.
|
||||
|
@ -68,7 +68,7 @@ ShaderRenderModifier::ShaderRenderModifier()
|
||||
}
|
||||
|
||||
void ShaderRenderModifier::BeginPass(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader)
|
||||
{
|
||||
const CMatrix3D transform =
|
||||
@ -133,7 +133,7 @@ void ShaderRenderModifier::BeginPass(
|
||||
}
|
||||
|
||||
void ShaderRenderModifier::PrepareModel(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
CModel* model)
|
||||
{
|
||||
if (m_BindingInstancingTransform >= 0)
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
* Must be implemented by derived classes.
|
||||
*/
|
||||
virtual void BeginPass(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader) = 0;
|
||||
|
||||
/**
|
||||
@ -68,7 +68,7 @@ public:
|
||||
* @param model The model that is about to be rendered.
|
||||
*/
|
||||
virtual void PrepareModel(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
CModel* model) = 0;
|
||||
};
|
||||
|
||||
@ -121,10 +121,10 @@ public:
|
||||
|
||||
// Implementation
|
||||
void BeginPass(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader) override;
|
||||
void PrepareModel(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
CModel* model) override;
|
||||
|
||||
private:
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "ps/Util.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/DebugRenderer.h"
|
||||
#include "renderer/PostprocManager.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
@ -242,7 +242,7 @@ class CRenderer::Internals
|
||||
{
|
||||
NONCOPYABLE(Internals);
|
||||
public:
|
||||
std::unique_ptr<Renderer::Backend::GL::CDeviceCommandContext> deviceCommandContext;
|
||||
std::unique_ptr<Renderer::Backend::IDeviceCommandContext> deviceCommandContext;
|
||||
|
||||
/// true if CRenderer::Open has been called
|
||||
bool IsOpen;
|
||||
@ -274,7 +274,7 @@ public:
|
||||
Internals() :
|
||||
IsOpen(false), ShadersDirty(true), profileTable(g_Renderer.m_Stats),
|
||||
deviceCommandContext(g_VideoMode.GetBackendDevice()->CreateCommandContext()),
|
||||
textureManager(g_VFS, false, false)
|
||||
textureManager(g_VFS, false, g_VideoMode.GetBackendDevice())
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -712,7 +712,7 @@ void CRenderer::EndFrame()
|
||||
void CRenderer::SetViewport(const SViewPort &vp)
|
||||
{
|
||||
m_Viewport = vp;
|
||||
Renderer::Backend::GL::CDeviceCommandContext::Rect viewportRect;
|
||||
Renderer::Backend::IDeviceCommandContext::Rect viewportRect;
|
||||
viewportRect.x = vp.m_X;
|
||||
viewportRect.y = vp.m_Y;
|
||||
viewportRect.width = vp.m_Width;
|
||||
@ -776,7 +776,7 @@ void CRenderer::MakeScreenShotOnNextFrame(ScreenShotType screenShotType)
|
||||
m_ScreenShotType = screenShotType;
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CDeviceCommandContext* CRenderer::GetDeviceCommandContext()
|
||||
Renderer::Backend::IDeviceCommandContext* CRenderer::GetDeviceCommandContext()
|
||||
{
|
||||
return m->deviceCommandContext.get();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "graphics/ShaderDefines.h"
|
||||
#include "graphics/ShaderProgramPtr.h"
|
||||
#include "ps/Singleton.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
#include "renderer/Scene.h"
|
||||
|
||||
@ -136,7 +136,7 @@ public:
|
||||
*/
|
||||
void MakeScreenShotOnNextFrame(ScreenShotType screenShotType);
|
||||
|
||||
Renderer::Backend::GL::CDeviceCommandContext* GetDeviceCommandContext();
|
||||
Renderer::Backend::IDeviceCommandContext* GetDeviceCommandContext();
|
||||
|
||||
protected:
|
||||
friend class CPatchRData;
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "ps/World.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/DebugRenderer.h"
|
||||
#include "renderer/HWLightingModelRenderer.h"
|
||||
#include "renderer/InstancingModelRenderer.h"
|
||||
@ -144,7 +144,7 @@ public:
|
||||
* Renders all non-alpha-blended models with the given context.
|
||||
*/
|
||||
void CallModelRenderers(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, int flags)
|
||||
{
|
||||
CShaderDefines contextSkinned = context;
|
||||
@ -167,7 +167,7 @@ public:
|
||||
* Renders all alpha-blended models with the given context.
|
||||
*/
|
||||
void CallTranspModelRenderers(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, int flags)
|
||||
{
|
||||
CShaderDefines contextSkinned = context;
|
||||
@ -293,7 +293,7 @@ void CSceneRenderer::SetSimulation(CSimulation2* simulation)
|
||||
}
|
||||
|
||||
void CSceneRenderer::RenderShadowMap(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context)
|
||||
{
|
||||
PROFILE3_GPU("shadow map");
|
||||
@ -336,7 +336,7 @@ void CSceneRenderer::RenderShadowMap(
|
||||
}
|
||||
|
||||
void CSceneRenderer::RenderPatches(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup)
|
||||
{
|
||||
PROFILE3_GPU("patches");
|
||||
@ -366,7 +366,7 @@ void CSceneRenderer::RenderPatches(
|
||||
}
|
||||
|
||||
void CSceneRenderer::RenderModels(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup)
|
||||
{
|
||||
PROFILE3_GPU("models");
|
||||
@ -389,7 +389,7 @@ void CSceneRenderer::RenderModels(
|
||||
}
|
||||
|
||||
void CSceneRenderer::RenderTransparentModels(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, ETransparentMode transparentMode)
|
||||
{
|
||||
PROFILE3_GPU("transparent models");
|
||||
@ -544,7 +544,7 @@ void CSceneRenderer::ComputeRefractionCamera(CCamera& camera, const CBoundingBox
|
||||
|
||||
// RenderReflections: render the water reflections to the reflection texture
|
||||
void CSceneRenderer::RenderReflections(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, const CBoundingBoxAligned& scissor)
|
||||
{
|
||||
PROFILE3_GPU("water reflections");
|
||||
@ -573,7 +573,7 @@ void CSceneRenderer::RenderReflections(
|
||||
screenScissor.x2 = (GLint)ceil((reflectionScissor[1].X*0.5f+0.5f)*vpWidth);
|
||||
screenScissor.y2 = (GLint)ceil((reflectionScissor[1].Y*0.5f+0.5f)*vpHeight);
|
||||
|
||||
Renderer::Backend::GL::CDeviceCommandContext::Rect scissorRect;
|
||||
Renderer::Backend::IDeviceCommandContext::Rect scissorRect;
|
||||
scissorRect.x = screenScissor.x1;
|
||||
scissorRect.y = screenScissor.y1;
|
||||
scissorRect.width = screenScissor.x2 - screenScissor.x1;
|
||||
@ -609,7 +609,7 @@ void CSceneRenderer::RenderReflections(
|
||||
|
||||
// RenderRefractions: render the water refractions to the refraction texture
|
||||
void CSceneRenderer::RenderRefractions(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, const CBoundingBoxAligned &scissor)
|
||||
{
|
||||
PROFILE3_GPU("water refractions");
|
||||
@ -643,7 +643,7 @@ void CSceneRenderer::RenderRefractions(
|
||||
screenScissor.x2 = (GLint)ceil((refractionScissor[1].X*0.5f+0.5f)*vpWidth);
|
||||
screenScissor.y2 = (GLint)ceil((refractionScissor[1].Y*0.5f+0.5f)*vpHeight);
|
||||
|
||||
Renderer::Backend::GL::CDeviceCommandContext::Rect scissorRect;
|
||||
Renderer::Backend::IDeviceCommandContext::Rect scissorRect;
|
||||
scissorRect.x = screenScissor.x1;
|
||||
scissorRect.y = screenScissor.y1;
|
||||
scissorRect.width = screenScissor.x2 - screenScissor.x1;
|
||||
@ -672,7 +672,7 @@ void CSceneRenderer::RenderRefractions(
|
||||
}
|
||||
|
||||
void CSceneRenderer::RenderSilhouettes(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context)
|
||||
{
|
||||
PROFILE3_GPU("silhouettes");
|
||||
@ -726,7 +726,7 @@ void CSceneRenderer::RenderSilhouettes(
|
||||
}
|
||||
|
||||
void CSceneRenderer::RenderParticles(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup)
|
||||
{
|
||||
PROFILE3_GPU("particles");
|
||||
@ -745,7 +745,7 @@ void CSceneRenderer::RenderParticles(
|
||||
|
||||
// RenderSubmissions: force rendering of any batched objects
|
||||
void CSceneRenderer::RenderSubmissions(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CBoundingBoxAligned& waterScissor)
|
||||
{
|
||||
PROFILE3("render submissions");
|
||||
@ -1060,7 +1060,7 @@ void CSceneRenderer::SubmitNonRecursive(CModel* model)
|
||||
|
||||
// Render the given scene
|
||||
void CSceneRenderer::RenderScene(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext, Scene& scene)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext, Scene& scene)
|
||||
{
|
||||
m_CurrentScene = &scene;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "graphics/ShaderDefines.h"
|
||||
#include "graphics/ShaderProgramPtr.h"
|
||||
#include "ps/Singleton.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
#include "renderer/Scene.h"
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
* Render the given scene immediately.
|
||||
* @param scene a Scene object describing what should be rendered.
|
||||
*/
|
||||
void RenderScene(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext, Scene& scene);
|
||||
void RenderScene(Renderer::Backend::IDeviceCommandContext* deviceCommandContext, Scene& scene);
|
||||
|
||||
/**
|
||||
* Return the scene that is currently being rendered.
|
||||
@ -195,41 +195,41 @@ protected:
|
||||
|
||||
// render any batched objects
|
||||
void RenderSubmissions(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CBoundingBoxAligned& waterScissor);
|
||||
|
||||
// patch rendering stuff
|
||||
void RenderPatches(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup);
|
||||
|
||||
// model rendering stuff
|
||||
void RenderModels(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup);
|
||||
void RenderTransparentModels(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, ETransparentMode transparentMode);
|
||||
|
||||
void RenderSilhouettes(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context);
|
||||
|
||||
void RenderParticles(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup);
|
||||
|
||||
// shadow rendering stuff
|
||||
void RenderShadowMap(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context);
|
||||
|
||||
// render water reflection and refraction textures
|
||||
void RenderReflections(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, const CBoundingBoxAligned& scissor);
|
||||
void RenderRefractions(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, const CBoundingBoxAligned& scissor);
|
||||
|
||||
void ComputeReflectionCamera(CCamera& camera, const CBoundingBoxAligned& scissor) const;
|
||||
|
@ -34,8 +34,8 @@
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
#include "renderer/DebugRenderer.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
@ -58,8 +58,8 @@ constexpr float DEFAULT_CASCADE_DISTANCE_RATIO = 1.7f;
|
||||
*/
|
||||
struct ShadowMapInternals
|
||||
{
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer> Framebuffer;
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> Texture;
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer> Framebuffer;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> Texture;
|
||||
|
||||
// bit depth for the depth texture
|
||||
int DepthTextureBits;
|
||||
@ -109,7 +109,7 @@ struct ShadowMapInternals
|
||||
// incorrectly when the FBO has only a depth attachment.
|
||||
// When m_ShadowAlphaFix is true, we use DummyTexture to store a useless
|
||||
// alpha texture which is attached to the FBO as a workaround.
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> DummyTexture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> DummyTexture;
|
||||
|
||||
// Copy of renderer's standard view camera, saved between
|
||||
// BeginRender and EndRender while we replace it with the shadow camera
|
||||
@ -472,7 +472,7 @@ void ShadowMapInternals::CreateTexture()
|
||||
Texture.reset();
|
||||
DummyTexture.reset();
|
||||
|
||||
Renderer::Backend::GL::CDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
Renderer::Backend::IDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
|
||||
CFG_GET_VAL("shadowquality", QualityLevel);
|
||||
|
||||
@ -569,7 +569,7 @@ void ShadowMapInternals::CreateTexture()
|
||||
// Set up to render into shadow map texture
|
||||
void ShadowMap::BeginRender()
|
||||
{
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext =
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext =
|
||||
g_Renderer.GetDeviceCommandContext();
|
||||
deviceCommandContext->SetGraphicsPipelineState(
|
||||
Renderer::Backend::MakeDefaultGraphicsPipelineStateDesc());
|
||||
@ -605,7 +605,7 @@ void ShadowMap::PrepareCamera(const int cascade)
|
||||
g_Renderer.GetSceneRenderer().SetViewCamera(camera);
|
||||
|
||||
const SViewPort& cascadeViewPort = m->Cascades[cascade].ViewPort;
|
||||
Renderer::Backend::GL::CDeviceCommandContext::Rect scissorRect;
|
||||
Renderer::Backend::IDeviceCommandContext::Rect scissorRect;
|
||||
scissorRect.x = cascadeViewPort.m_X;
|
||||
scissorRect.y = cascadeViewPort.m_Y;
|
||||
scissorRect.width = cascadeViewPort.m_Width;
|
||||
@ -631,7 +631,7 @@ void ShadowMap::EndRender()
|
||||
}
|
||||
|
||||
void ShadowMap::BindTo(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader) const
|
||||
{
|
||||
const int32_t shadowTexBindingSlot = shader->GetBindingSlot(str_shadowTex);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#ifndef INCLUDED_SHADOWMAP
|
||||
#define INCLUDED_SHADOWMAP
|
||||
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
|
||||
class CBoundingBoxAligned;
|
||||
@ -127,7 +127,7 @@ public:
|
||||
* Binds all needed resources and uniforms to draw shadows using the shader.
|
||||
*/
|
||||
void BindTo(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader) const;
|
||||
|
||||
/**
|
||||
|
@ -444,7 +444,7 @@ void SilhouetteRenderer::RenderSubmitCasters(SceneCollector& collector)
|
||||
}
|
||||
|
||||
void SilhouetteRenderer::RenderDebugBounds(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext))
|
||||
Renderer::Backend::IDeviceCommandContext* UNUSED(deviceCommandContext))
|
||||
{
|
||||
if (m_DebugBounds.empty())
|
||||
return;
|
||||
@ -454,7 +454,7 @@ void SilhouetteRenderer::RenderDebugBounds(
|
||||
}
|
||||
|
||||
void SilhouetteRenderer::RenderDebugOverlays(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (m_DebugRects.empty())
|
||||
return;
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "graphics/Overlay.h"
|
||||
#include "maths/BoundingBoxAligned.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
||||
class CCamera;
|
||||
class CModel;
|
||||
@ -42,9 +42,9 @@ public:
|
||||
void RenderSubmitCasters(SceneCollector& collector);
|
||||
|
||||
void RenderDebugBounds(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
void RenderDebugOverlays(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
void EndFrame();
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
@ -41,13 +41,13 @@
|
||||
#include <algorithm>
|
||||
|
||||
SkyManager::SkyManager()
|
||||
: m_VertexArray(Renderer::Backend::GL::CBuffer::Type::VERTEX, false)
|
||||
: m_VertexArray(Renderer::Backend::IBuffer::Type::VERTEX, false)
|
||||
{
|
||||
CFG_GET_VAL("showsky", m_SkyVisible);
|
||||
}
|
||||
|
||||
void SkyManager::LoadAndUploadSkyTexturesIfNeeded(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (m_SkyTextureCube)
|
||||
return;
|
||||
@ -117,9 +117,9 @@ void SkyManager::LoadAndUploadSkyTexturesIfNeeded(
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> skyCubeMap =
|
||||
std::unique_ptr<Renderer::Backend::ITexture> skyCubeMap =
|
||||
g_VideoMode.GetBackendDevice()->CreateTexture("SkyCubeMap",
|
||||
Renderer::Backend::GL::CTexture::Type::TEXTURE_CUBE,
|
||||
Renderer::Backend::ITexture::Type::TEXTURE_CUBE,
|
||||
Renderer::Backend::Format::R8G8B8A8_UNORM, textures[0].m_Width, textures[0].m_Height,
|
||||
Renderer::Backend::Sampler::MakeDefaultSampler(
|
||||
Renderer::Backend::Sampler::Filter::LINEAR,
|
||||
@ -166,7 +166,7 @@ void SkyManager::LoadAndUploadSkyTexturesIfNeeded(
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CTexture* SkyManager::GetSkyCube()
|
||||
Renderer::Backend::ITexture* SkyManager::GetSkyCube()
|
||||
{
|
||||
return m_SkyTextureCube->GetBackendTexture();
|
||||
}
|
||||
@ -203,7 +203,7 @@ std::vector<CStrW> SkyManager::GetSkySets() const
|
||||
}
|
||||
|
||||
void SkyManager::RenderSky(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
GPU_SCOPED_LABEL(deviceCommandContext, "Render sky");
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
#define INCLUDED_SKYMANAGER
|
||||
|
||||
#include "graphics/Texture.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
#include "renderer/VertexArray.h"
|
||||
|
||||
#include <memory>
|
||||
@ -42,7 +42,7 @@ public:
|
||||
* Render the sky.
|
||||
*/
|
||||
void RenderSky(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Return the currently selected sky set name.
|
||||
@ -52,7 +52,7 @@ public:
|
||||
return m_SkySet;
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CTexture* GetSkyCube();
|
||||
Renderer::Backend::ITexture* GetSkyCube();
|
||||
|
||||
/**
|
||||
* Set the sky set name.
|
||||
@ -79,7 +79,7 @@ public:
|
||||
* Load all sky textures from files and upload to GPU.
|
||||
*/
|
||||
void LoadAndUploadSkyTexturesIfNeeded(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
private:
|
||||
void CreateSkyCube();
|
||||
|
@ -29,7 +29,8 @@
|
||||
#include "ps/Game.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/World.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
#include "renderer/TerrainRenderer.h"
|
||||
@ -64,7 +65,7 @@ ITerrainOverlay::~ITerrainOverlay()
|
||||
|
||||
|
||||
void ITerrainOverlay::RenderOverlaysBeforeWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (g_TerrainOverlayList.empty())
|
||||
return;
|
||||
@ -77,7 +78,7 @@ void ITerrainOverlay::RenderOverlaysBeforeWater(
|
||||
}
|
||||
|
||||
void ITerrainOverlay::RenderOverlaysAfterWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext, int cullGroup)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext, int cullGroup)
|
||||
{
|
||||
if (g_TerrainOverlayList.empty())
|
||||
return;
|
||||
@ -114,7 +115,7 @@ void TerrainOverlay::GetTileExtents(
|
||||
}
|
||||
|
||||
void TerrainOverlay::RenderBeforeWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (!m_Terrain)
|
||||
return; // should never happen, but let's play it safe
|
||||
@ -139,14 +140,14 @@ void TerrainOverlay::RenderBeforeWater(
|
||||
}
|
||||
|
||||
void TerrainOverlay::RenderTile(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CColor& color, bool drawHidden)
|
||||
{
|
||||
RenderTile(deviceCommandContext, color, drawHidden, m_i, m_j);
|
||||
}
|
||||
|
||||
void TerrainOverlay::RenderTile(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CColor& color, bool drawHidden, ssize_t i, ssize_t j)
|
||||
{
|
||||
// TODO: unnecessary computation calls has been removed but we should use
|
||||
@ -230,14 +231,14 @@ void TerrainOverlay::RenderTile(
|
||||
}
|
||||
|
||||
void TerrainOverlay::RenderTileOutline(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CColor& color, bool drawHidden)
|
||||
{
|
||||
RenderTileOutline(deviceCommandContext, color, drawHidden, m_i, m_j);
|
||||
}
|
||||
|
||||
void TerrainOverlay::RenderTileOutline(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CColor& color, bool drawHidden, ssize_t i, ssize_t j)
|
||||
{
|
||||
std::vector<float> vertices;
|
||||
@ -304,7 +305,7 @@ TerrainTextureOverlay::TerrainTextureOverlay(float texelsPerTile, int priority)
|
||||
TerrainTextureOverlay::~TerrainTextureOverlay() = default;
|
||||
|
||||
void TerrainTextureOverlay::RenderAfterWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext, int cullGroup)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext, int cullGroup)
|
||||
{
|
||||
CTerrain* terrain = g_Game->GetWorld()->GetTerrain();
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
#ifndef INCLUDED_TERRAINOVERLAY
|
||||
#define INCLUDED_TERRAINOVERLAY
|
||||
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
||||
struct CColor;
|
||||
struct SColor4ub;
|
||||
@ -44,24 +44,24 @@ class ITerrainOverlay
|
||||
public:
|
||||
virtual ~ITerrainOverlay();
|
||||
|
||||
virtual void RenderBeforeWater(Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext)) { }
|
||||
virtual void RenderBeforeWater(Renderer::Backend::IDeviceCommandContext* UNUSED(deviceCommandContext)) { }
|
||||
|
||||
virtual void RenderAfterWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext), int UNUSED(cullGroup)) { }
|
||||
Renderer::Backend::IDeviceCommandContext* UNUSED(deviceCommandContext), int UNUSED(cullGroup)) { }
|
||||
|
||||
/**
|
||||
* Draw all ITerrainOverlay objects that exist
|
||||
* and that should be drawn before water.
|
||||
*/
|
||||
static void RenderOverlaysBeforeWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/**
|
||||
* Draw all ITerrainOverlay objects that exist
|
||||
* and that should be drawn after water.
|
||||
*/
|
||||
static void RenderOverlaysAfterWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext, int cullGroup);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext, int cullGroup);
|
||||
|
||||
protected:
|
||||
ITerrainOverlay(int priority);
|
||||
@ -129,7 +129,7 @@ protected:
|
||||
* @param j <i>j</i> coordinate of tile being processed
|
||||
*/
|
||||
virtual void ProcessTile(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
ssize_t i, ssize_t j) = 0;
|
||||
|
||||
/**
|
||||
@ -140,14 +140,14 @@ protected:
|
||||
* should be drawn
|
||||
*/
|
||||
void RenderTile(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CColor& color, bool drawHidden);
|
||||
|
||||
/**
|
||||
* Draw a filled quad on top of the given tile.
|
||||
*/
|
||||
void RenderTile(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CColor& color, bool drawHidden, ssize_t i, ssize_t j);
|
||||
|
||||
/**
|
||||
@ -159,20 +159,20 @@ protected:
|
||||
* should be drawn
|
||||
*/
|
||||
void RenderTileOutline(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CColor& color, bool drawHidden);
|
||||
|
||||
/**
|
||||
* Draw an outlined quad on top of the given tile.
|
||||
*/
|
||||
void RenderTileOutline(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CColor& color, bool drawHidden, ssize_t i, ssize_t j);
|
||||
|
||||
private:
|
||||
// Process all tiles
|
||||
void RenderBeforeWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext) override;
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext) override;
|
||||
|
||||
// Temporary storage of tile coordinates, so ProcessTile doesn't need to
|
||||
// pass it to RenderTile/etc (and doesn't have a chance to get it wrong)
|
||||
@ -210,10 +210,10 @@ protected:
|
||||
|
||||
private:
|
||||
void RenderAfterWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext, int cullGroup) override;
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext, int cullGroup) override;
|
||||
|
||||
float m_TexelsPerTile;
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_Texture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_Texture;
|
||||
};
|
||||
|
||||
#endif // INCLUDED_TERRAINOVERLAY
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "ps/Game.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/World.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/DecalRData.h"
|
||||
#include "renderer/PatchRData.h"
|
||||
#include "renderer/Renderer.h"
|
||||
@ -161,9 +161,9 @@ void TerrainRenderer::EndFrame()
|
||||
}
|
||||
|
||||
void TerrainRenderer::RenderTerrainOverlayTexture(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup, CMatrix3D& textureMatrix,
|
||||
Renderer::Backend::GL::CTexture* texture)
|
||||
Renderer::Backend::ITexture* texture)
|
||||
{
|
||||
ENSURE(m->phase == Phase_Render);
|
||||
|
||||
@ -227,7 +227,7 @@ void TerrainRenderer::RenderTerrainOverlayTexture(
|
||||
* Set up all the uniforms for a shader pass.
|
||||
*/
|
||||
void TerrainRenderer::PrepareShader(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, ShadowMap* shadow)
|
||||
{
|
||||
CSceneRenderer& sceneRenderer = g_Renderer.GetSceneRenderer();
|
||||
@ -270,7 +270,7 @@ void TerrainRenderer::PrepareShader(
|
||||
}
|
||||
|
||||
void TerrainRenderer::RenderTerrainShader(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, ShadowMap* shadow)
|
||||
{
|
||||
ENSURE(m->phase == Phase_Render);
|
||||
@ -311,7 +311,7 @@ void TerrainRenderer::RenderTerrainShader(
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Render un-textured patches as polygons
|
||||
void TerrainRenderer::RenderPatches(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup, const CShaderDefines& defines, const CColor& color)
|
||||
{
|
||||
ENSURE(m->phase == Phase_Render);
|
||||
@ -344,7 +344,7 @@ void TerrainRenderer::RenderPatches(
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Render outlines of submitted patches as lines
|
||||
void TerrainRenderer::RenderOutlines(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup)
|
||||
{
|
||||
ENSURE(m->phase == Phase_Render);
|
||||
@ -383,7 +383,7 @@ CBoundingBoxAligned TerrainRenderer::ScissorWater(int cullGroup, const CCamera&
|
||||
|
||||
// Render fancy water
|
||||
bool TerrainRenderer::RenderFancyWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, ShadowMap* shadow)
|
||||
{
|
||||
PROFILE3_GPU("fancy water");
|
||||
@ -598,7 +598,7 @@ bool TerrainRenderer::RenderFancyWater(
|
||||
}
|
||||
|
||||
void TerrainRenderer::RenderSimpleWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup)
|
||||
{
|
||||
PROFILE3_GPU("simple water");
|
||||
@ -654,7 +654,7 @@ void TerrainRenderer::RenderSimpleWater(
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Render water that is part of the terrain
|
||||
void TerrainRenderer::RenderWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, ShadowMap* shadow)
|
||||
{
|
||||
const WaterManager& waterManager = g_Renderer.GetSceneRenderer().GetWaterManager();
|
||||
@ -666,7 +666,7 @@ void TerrainRenderer::RenderWater(
|
||||
}
|
||||
|
||||
void TerrainRenderer::RenderWaterFoamOccluders(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup)
|
||||
{
|
||||
CSceneRenderer& sceneRenderer = g_Renderer.GetSceneRenderer();
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
#include "graphics/Color.h"
|
||||
#include "maths/BoundingBoxAligned.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
|
||||
class CCamera;
|
||||
@ -103,7 +103,7 @@ public:
|
||||
* @param shadow A prepared shadow map, in case rendering with shadows is enabled.
|
||||
*/
|
||||
void RenderTerrainShader(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, ShadowMap* shadow);
|
||||
|
||||
/**
|
||||
@ -116,7 +116,7 @@ public:
|
||||
* @param color Fill color of the patches.
|
||||
*/
|
||||
void RenderPatches(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup, const CShaderDefines& defines,
|
||||
const CColor& color = CColor(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
|
||||
@ -129,7 +129,7 @@ public:
|
||||
* @param filtered If true then only render objects that passed CullPatches.
|
||||
*/
|
||||
void RenderOutlines(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup);
|
||||
|
||||
/**
|
||||
@ -140,14 +140,14 @@ public:
|
||||
* frame before calling RenderWater.
|
||||
*/
|
||||
void RenderWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, ShadowMap* shadow);
|
||||
|
||||
/**
|
||||
* Renders terrain to a framebuffer to occlude shore foams.
|
||||
*/
|
||||
void RenderWaterFoamOccluders(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup);
|
||||
|
||||
/**
|
||||
@ -166,8 +166,8 @@ public:
|
||||
* Intended for use by TerrainTextureOverlay.
|
||||
*/
|
||||
void RenderTerrainOverlayTexture(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup, CMatrix3D& textureMatrix, Renderer::Backend::GL::CTexture* texture);
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup, CMatrix3D& textureMatrix, Renderer::Backend::ITexture* texture);
|
||||
|
||||
private:
|
||||
TerrainRendererInternals* m;
|
||||
@ -177,18 +177,18 @@ private:
|
||||
* Returns false if unable to render with fancy water.
|
||||
*/
|
||||
bool RenderFancyWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CShaderDefines& context, int cullGroup, ShadowMap* shadow);
|
||||
|
||||
/**
|
||||
* RenderSimpleWater: internal rendering method for water
|
||||
*/
|
||||
void RenderSimpleWater(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
int cullGroup);
|
||||
|
||||
static void PrepareShader(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IShaderProgram* shader, ShadowMap* shadow);
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* to use VertexArray where possible, though. */
|
||||
|
||||
void CTexturedLineRData::Render(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const SOverlayTexturedLine& line, Renderer::Backend::IShaderProgram* shader)
|
||||
{
|
||||
if (!m_VB || !m_VBIndices)
|
||||
@ -322,7 +322,7 @@ void CTexturedLineRData::Update(const SOverlayTexturedLine& line)
|
||||
m_BoundingBox += vertex.m_Position;
|
||||
|
||||
m_VB = g_VBMan.AllocateChunk(
|
||||
sizeof(SVertex), vertices.size(), Renderer::Backend::GL::CBuffer::Type::VERTEX, false);
|
||||
sizeof(SVertex), vertices.size(), Renderer::Backend::IBuffer::Type::VERTEX, false);
|
||||
// Allocation might fail (e.g. due to too many vertices).
|
||||
if (m_VB)
|
||||
{
|
||||
@ -333,7 +333,7 @@ void CTexturedLineRData::Update(const SOverlayTexturedLine& line)
|
||||
indices[k] += static_cast<u16>(m_VB->m_Index);
|
||||
|
||||
m_VBIndices = g_VBMan.AllocateChunk(
|
||||
sizeof(u16), indices.size(), Renderer::Backend::GL::CBuffer::Type::INDEX, false);
|
||||
sizeof(u16), indices.size(), Renderer::Backend::IBuffer::Type::INDEX, false);
|
||||
if (m_VBIndices)
|
||||
m_VBIndices->m_Owner->UpdateChunkVertices(m_VBIndices.Get(), &indices[0]);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "graphics/ShaderProgram.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "maths/BoundingBoxAligned.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/VertexBufferManager.h"
|
||||
|
||||
class CFrustum;
|
||||
@ -52,7 +52,7 @@ public:
|
||||
~CTexturedLineRData() = default;
|
||||
|
||||
void Update(const SOverlayTexturedLine& line);
|
||||
void Render(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
void Render(Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const SOverlayTexturedLine& line, Renderer::Backend::IShaderProgram* shader);
|
||||
|
||||
bool IsVisibleInFrustum(const CFrustum& frustum) const;
|
||||
|
@ -65,7 +65,7 @@ size_t GetAttributeSize(const Renderer::Backend::Format format)
|
||||
} // anonymous namespace
|
||||
|
||||
VertexArray::VertexArray(
|
||||
const Renderer::Backend::GL::CBuffer::Type type, const bool dynamic)
|
||||
const Renderer::Backend::IBuffer::Type type, const bool dynamic)
|
||||
: m_Type(type), m_Dynamic(dynamic)
|
||||
{
|
||||
m_NumberOfVertices = 0;
|
||||
@ -245,11 +245,11 @@ void VertexArray::Layout()
|
||||
|
||||
m_Stride += attrSize;
|
||||
|
||||
if (m_Type == Renderer::Backend::GL::CBuffer::Type::VERTEX)
|
||||
if (m_Type == Renderer::Backend::IBuffer::Type::VERTEX)
|
||||
m_Stride = Align<4>(m_Stride);
|
||||
}
|
||||
|
||||
if (m_Type == Renderer::Backend::GL::CBuffer::Type::VERTEX)
|
||||
if (m_Type == Renderer::Backend::IBuffer::Type::VERTEX)
|
||||
m_Stride = RoundStride(m_Stride);
|
||||
|
||||
if (m_Stride)
|
||||
@ -283,7 +283,7 @@ void VertexArray::Upload()
|
||||
}
|
||||
|
||||
void VertexArray::UploadIfNeeded(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
m_VB->m_Owner->UploadIfNeeded(deviceCommandContext);
|
||||
}
|
||||
@ -299,7 +299,7 @@ void VertexArray::FreeBackingStore()
|
||||
}
|
||||
|
||||
VertexIndexArray::VertexIndexArray(const bool dynamic) :
|
||||
VertexArray(Renderer::Backend::GL::CBuffer::Type::INDEX, dynamic)
|
||||
VertexArray(Renderer::Backend::IBuffer::Type::INDEX, dynamic)
|
||||
{
|
||||
m_Attr.format = Renderer::Backend::Format::R16_UINT;
|
||||
AddAttribute(&m_Attr);
|
||||
|
@ -19,8 +19,8 @@
|
||||
#define INCLUDED_VERTEXARRAY
|
||||
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/gl/Buffer.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IBuffer.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/VertexBufferManager.h"
|
||||
|
||||
#include <vector>
|
||||
@ -160,7 +160,7 @@ public:
|
||||
|
||||
public:
|
||||
VertexArray(
|
||||
const Renderer::Backend::GL::CBuffer::Type type, const bool dynamic);
|
||||
const Renderer::Backend::IBuffer::Type type, const bool dynamic);
|
||||
~VertexArray();
|
||||
|
||||
// Set the number of vertices stored in the array
|
||||
@ -182,13 +182,13 @@ public:
|
||||
// Make this vertex array's data available for the next series of calls to Bind
|
||||
void PrepareForRendering();
|
||||
|
||||
void UploadIfNeeded(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void UploadIfNeeded(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
// If you know for certain that you'll never have to change the data again,
|
||||
// call this to free some memory.
|
||||
void FreeBackingStore();
|
||||
|
||||
Renderer::Backend::GL::CBuffer* GetBuffer() { return m_VB ? m_VB->m_Owner->GetBuffer() : nullptr; }
|
||||
Renderer::Backend::IBuffer* GetBuffer() { return m_VB ? m_VB->m_Owner->GetBuffer() : nullptr; }
|
||||
|
||||
uint32_t GetOffset() const { return m_VB ? m_VB->m_Index : 0; }
|
||||
|
||||
@ -202,7 +202,7 @@ private:
|
||||
return VertexArrayIterator<T>(m_BackingStore + attr->offset, m_Stride);
|
||||
}
|
||||
|
||||
Renderer::Backend::GL::CBuffer::Type m_Type;
|
||||
Renderer::Backend::IBuffer::Type m_Type;
|
||||
bool m_Dynamic;
|
||||
size_t m_NumberOfVertices;
|
||||
std::vector<Attribute*> m_Attributes;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Errors.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -38,27 +38,27 @@ constexpr std::size_t MAX_VB_SIZE_BYTES = 4 * 1024 * 1024;
|
||||
|
||||
CVertexBuffer::CVertexBuffer(
|
||||
const char* name, const size_t vertexSize,
|
||||
const Renderer::Backend::GL::CBuffer::Type type, const bool dynamic)
|
||||
const Renderer::Backend::IBuffer::Type type, const bool dynamic)
|
||||
: CVertexBuffer(name, vertexSize, type, dynamic, MAX_VB_SIZE_BYTES)
|
||||
{
|
||||
}
|
||||
|
||||
CVertexBuffer::CVertexBuffer(
|
||||
const char* name, const size_t vertexSize,
|
||||
const Renderer::Backend::GL::CBuffer::Type type, const bool dynamic,
|
||||
const Renderer::Backend::IBuffer::Type type, const bool dynamic,
|
||||
const size_t maximumBufferSize)
|
||||
: m_VertexSize(vertexSize), m_HasNeededChunks(false)
|
||||
{
|
||||
size_t size = maximumBufferSize;
|
||||
|
||||
if (type == Renderer::Backend::GL::CBuffer::Type::VERTEX)
|
||||
if (type == Renderer::Backend::IBuffer::Type::VERTEX)
|
||||
{
|
||||
// We want to store 16-bit indices to any vertex in a buffer, so the
|
||||
// buffer must never be bigger than vertexSize*64K bytes since we can
|
||||
// address at most 64K of them with 16-bit indices
|
||||
size = std::min(size, vertexSize * 65536);
|
||||
}
|
||||
else if (type == Renderer::Backend::GL::CBuffer::Type::INDEX)
|
||||
else if (type == Renderer::Backend::IBuffer::Type::INDEX)
|
||||
{
|
||||
ENSURE(vertexSize == sizeof(u16));
|
||||
}
|
||||
@ -89,7 +89,7 @@ CVertexBuffer::~CVertexBuffer()
|
||||
}
|
||||
|
||||
bool CVertexBuffer::CompatibleVertexType(
|
||||
const size_t vertexSize, const Renderer::Backend::GL::CBuffer::Type type,
|
||||
const size_t vertexSize, const Renderer::Backend::IBuffer::Type type,
|
||||
const bool dynamic) const
|
||||
{
|
||||
ENSURE(m_Buffer);
|
||||
@ -102,7 +102,7 @@ bool CVertexBuffer::CompatibleVertexType(
|
||||
// if no free chunks available
|
||||
CVertexBuffer::VBChunk* CVertexBuffer::Allocate(
|
||||
const size_t vertexSize, const size_t numberOfVertices,
|
||||
const Renderer::Backend::GL::CBuffer::Type type, const bool dynamic,
|
||||
const Renderer::Backend::IBuffer::Type type, const bool dynamic,
|
||||
void* backingStore)
|
||||
{
|
||||
// check this is the right kind of buffer
|
||||
@ -226,7 +226,7 @@ void CVertexBuffer::UpdateChunkVertices(VBChunk* chunk, void* data)
|
||||
}
|
||||
|
||||
void CVertexBuffer::UploadIfNeeded(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
|
||||
{
|
||||
if (UseStreaming(m_Buffer->IsDynamic()))
|
||||
{
|
||||
|
@ -22,8 +22,8 @@
|
||||
#ifndef INCLUDED_VERTEXBUFFER
|
||||
#define INCLUDED_VERTEXBUFFER
|
||||
|
||||
#include "renderer/backend/gl/Buffer.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/IBuffer.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@ -92,14 +92,14 @@ public:
|
||||
// constructor, destructor
|
||||
CVertexBuffer(
|
||||
const char* name, const size_t vertexSize,
|
||||
const Renderer::Backend::GL::CBuffer::Type type, const bool dynamic);
|
||||
const Renderer::Backend::IBuffer::Type type, const bool dynamic);
|
||||
CVertexBuffer(
|
||||
const char* name, const size_t vertexSize,
|
||||
const Renderer::Backend::GL::CBuffer::Type type, const bool dynamic,
|
||||
const Renderer::Backend::IBuffer::Type type, const bool dynamic,
|
||||
const size_t maximumBufferSize);
|
||||
~CVertexBuffer();
|
||||
|
||||
void UploadIfNeeded(Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext);
|
||||
void UploadIfNeeded(Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||
|
||||
/// Make the vertex data available for the next usage.
|
||||
void PrepareForRendering(VBChunk* chunk);
|
||||
@ -113,7 +113,7 @@ public:
|
||||
|
||||
/// Returns true if this vertex buffer is compatible with the specified vertex type and intended usage.
|
||||
bool CompatibleVertexType(
|
||||
const size_t vertexSize, const Renderer::Backend::GL::CBuffer::Type type,
|
||||
const size_t vertexSize, const Renderer::Backend::IBuffer::Type type,
|
||||
const bool dynamic) const;
|
||||
|
||||
void DumpStatus() const;
|
||||
@ -130,7 +130,7 @@ public:
|
||||
*/
|
||||
static bool UseStreaming(const bool dynamic);
|
||||
|
||||
Renderer::Backend::GL::CBuffer* GetBuffer() { return m_Buffer.get(); }
|
||||
Renderer::Backend::IBuffer* GetBuffer() { return m_Buffer.get(); }
|
||||
|
||||
private:
|
||||
friend class CVertexBufferManager; // allow allocate only via CVertexBufferManager
|
||||
@ -139,7 +139,7 @@ private:
|
||||
/// and with the given type - return null if no free chunks available
|
||||
VBChunk* Allocate(
|
||||
const size_t vertexSize, const size_t numberOfVertices,
|
||||
const Renderer::Backend::GL::CBuffer::Type type, const bool dynamic,
|
||||
const Renderer::Backend::IBuffer::Type type, const bool dynamic,
|
||||
void* backingStore);
|
||||
/// Return given chunk to this buffer
|
||||
void Release(VBChunk* chunk);
|
||||
@ -155,7 +155,7 @@ private:
|
||||
/// Available free vertices - total of all free vertices in the free list
|
||||
size_t m_FreeVertices;
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CBuffer> m_Buffer;
|
||||
std::unique_ptr<Renderer::Backend::IBuffer> m_Buffer;
|
||||
|
||||
bool m_HasNeededChunks;
|
||||
};
|
||||
|
@ -27,15 +27,15 @@ namespace
|
||||
{
|
||||
|
||||
const char* GetBufferTypeName(
|
||||
const Renderer::Backend::GL::CBuffer::Type type)
|
||||
const Renderer::Backend::IBuffer::Type type)
|
||||
{
|
||||
const char* name = "UnknownBuffer";
|
||||
switch (type)
|
||||
{
|
||||
case Renderer::Backend::GL::CBuffer::Type::VERTEX:
|
||||
case Renderer::Backend::IBuffer::Type::VERTEX:
|
||||
name = "VertexBuffer";
|
||||
break;
|
||||
case Renderer::Backend::GL::CBuffer::Type::INDEX:
|
||||
case Renderer::Backend::IBuffer::Type::INDEX:
|
||||
name = "IndexBuffer";
|
||||
break;
|
||||
default:
|
||||
@ -121,7 +121,7 @@ void CVertexBufferManager::Shutdown()
|
||||
*/
|
||||
CVertexBufferManager::Handle CVertexBufferManager::AllocateChunk(
|
||||
const size_t vertexSize, const size_t numberOfVertices,
|
||||
const Renderer::Backend::GL::CBuffer::Type type,
|
||||
const Renderer::Backend::IBuffer::Type type,
|
||||
const bool dynamic, void* backingStore, Group group)
|
||||
{
|
||||
ENSURE(vertexSize > 0);
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
*/
|
||||
Handle AllocateChunk(
|
||||
const size_t vertexSize, const size_t numberOfVertices,
|
||||
const Renderer::Backend::GL::CBuffer::Type type,
|
||||
const Renderer::Backend::IBuffer::Type type,
|
||||
const bool dynamic, void* backingStore = nullptr, Group group = Group::DEFAULT);
|
||||
|
||||
/// Returns the given @p chunk to its owning buffer
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "ps/Game.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "ps/World.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
@ -183,7 +183,7 @@ int WaterManager::LoadWaterTextures()
|
||||
|
||||
void WaterManager::RecreateOrLoadTexturesIfNeeded()
|
||||
{
|
||||
Renderer::Backend::GL::CDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
Renderer::Backend::IDevice* backendDevice = g_VideoMode.GetBackendDevice();
|
||||
|
||||
// Use screen-sized textures for minimum artifacts.
|
||||
const size_t newRefTextureSize = round_up_to_pow2(g_Renderer.GetHeight());
|
||||
@ -554,7 +554,7 @@ void WaterManager::CreateWaveMeshes()
|
||||
// Generic indexes, max-length
|
||||
m_ShoreWavesVBIndices = g_VBMan.AllocateChunk(
|
||||
sizeof(GLushort), water_indices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::INDEX, false,
|
||||
Renderer::Backend::IBuffer::Type::INDEX, false,
|
||||
nullptr, CVertexBufferManager::Group::WATER);
|
||||
m_ShoreWavesVBIndices->m_Owner->UpdateChunkVertices(m_ShoreWavesVBIndices.Get(), &water_indices[0]);
|
||||
|
||||
@ -775,7 +775,7 @@ void WaterManager::CreateWaveMeshes()
|
||||
|
||||
shoreWave->m_VBVertices = g_VBMan.AllocateChunk(
|
||||
sizeof(SWavesVertex), vertices.size(),
|
||||
Renderer::Backend::GL::CBuffer::Type::VERTEX, false,
|
||||
Renderer::Backend::IBuffer::Type::VERTEX, false,
|
||||
nullptr, CVertexBufferManager::Group::WATER);
|
||||
shoreWave->m_VBVertices->m_Owner->UpdateChunkVertices(shoreWave->m_VBVertices.Get(), &vertices[0]);
|
||||
|
||||
@ -785,7 +785,7 @@ void WaterManager::CreateWaveMeshes()
|
||||
}
|
||||
|
||||
void WaterManager::RenderWaves(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CFrustum& frustrum)
|
||||
{
|
||||
GPU_SCOPED_LABEL(deviceCommandContext, "Render Waves");
|
||||
|
@ -26,9 +26,9 @@
|
||||
#include "graphics/Texture.h"
|
||||
#include "maths/Matrix3D.h"
|
||||
#include "maths/Vector2D.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
#include "renderer/backend/gl/Framebuffer.h"
|
||||
#include "renderer/backend/gl/Texture.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/IFramebuffer.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
#include "renderer/VertexBufferManager.h"
|
||||
|
||||
#include <memory>
|
||||
@ -66,10 +66,10 @@ public:
|
||||
CTexturePtr m_WaveTex;
|
||||
CTexturePtr m_FoamTex;
|
||||
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_FancyTexture;
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_FancyTextureDepth;
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_ReflFboDepthTexture;
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_RefrFboDepthTexture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_FancyTexture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_FancyTextureDepth;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_ReflFboDepthTexture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_RefrFboDepthTexture;
|
||||
|
||||
// used to know what to update when updating parts of the terrain only.
|
||||
u32 m_updatei0;
|
||||
@ -101,14 +101,14 @@ public:
|
||||
float m_RepeatPeriod;
|
||||
|
||||
// Reflection and refraction textures for fancy water
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_ReflectionTexture;
|
||||
std::unique_ptr<Renderer::Backend::GL::CTexture> m_RefractionTexture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_ReflectionTexture;
|
||||
std::unique_ptr<Renderer::Backend::ITexture> m_RefractionTexture;
|
||||
size_t m_RefTextureSize;
|
||||
|
||||
// framebuffer objects
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer> m_RefractionFramebuffer;
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer> m_ReflectionFramebuffer;
|
||||
std::unique_ptr<Renderer::Backend::GL::CFramebuffer> m_FancyEffectsFramebuffer;
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer> m_RefractionFramebuffer;
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer> m_ReflectionFramebuffer;
|
||||
std::unique_ptr<Renderer::Backend::IFramebuffer> m_FancyEffectsFramebuffer;
|
||||
|
||||
// Model-view-projection matrices for reflected & refracted cameras
|
||||
// (used to let the vertex shader do projective texturing)
|
||||
@ -192,7 +192,7 @@ public:
|
||||
bool WillRenderFancyWater() const;
|
||||
|
||||
void RenderWaves(
|
||||
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const CFrustum& frustrum);
|
||||
|
||||
/**
|
||||
|
49
source/renderer/backend/IBuffer.h
Normal file
49
source/renderer/backend/IBuffer.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_IBUFFER
|
||||
#define INCLUDED_RENDERER_BACKEND_IBUFFER
|
||||
|
||||
#include "renderer/backend/IDeviceObject.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
class IBuffer : public IDeviceObject<IBuffer>
|
||||
{
|
||||
public:
|
||||
enum class Type
|
||||
{
|
||||
VERTEX,
|
||||
INDEX
|
||||
};
|
||||
|
||||
virtual Type GetType() const = 0;
|
||||
virtual uint32_t GetSize() const = 0;
|
||||
virtual bool IsDynamic() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_IBUFFER
|
108
source/renderer/backend/IDevice.h
Normal file
108
source/renderer/backend/IDevice.h
Normal file
@ -0,0 +1,108 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_IDEVICE
|
||||
#define INCLUDED_RENDERER_BACKEND_IDEVICE
|
||||
|
||||
#include "graphics/Color.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IBuffer.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/IFramebuffer.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
#include "renderer/backend/ITexture.h"
|
||||
#include "scriptinterface/ScriptForward.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class CShaderDefines;
|
||||
class CStr;
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
class IDevice
|
||||
{
|
||||
public:
|
||||
struct Capabilities
|
||||
{
|
||||
bool S3TC;
|
||||
bool ARBShaders;
|
||||
bool ARBShadersShadow;
|
||||
bool computeShaders;
|
||||
bool debugLabels;
|
||||
bool debugScopedLabels;
|
||||
bool multisampling;
|
||||
bool anisotropicFiltering;
|
||||
uint32_t maxSampleCount;
|
||||
float maxAnisotropy;
|
||||
uint32_t maxTextureSize;
|
||||
};
|
||||
|
||||
virtual ~IDevice() {}
|
||||
|
||||
virtual const std::string& GetName() const = 0;
|
||||
virtual const std::string& GetVersion() const = 0;
|
||||
virtual const std::string& GetDriverInformation() const = 0;
|
||||
virtual const std::vector<std::string>& GetExtensions() const = 0;
|
||||
|
||||
virtual void Report(const ScriptRequest& rq, JS::HandleValue settings) = 0;
|
||||
|
||||
virtual IFramebuffer* GetCurrentBackbuffer() = 0;
|
||||
|
||||
virtual std::unique_ptr<IDeviceCommandContext> CreateCommandContext() = 0;
|
||||
|
||||
virtual std::unique_ptr<ITexture> CreateTexture(const char* name, const ITexture::Type type,
|
||||
const Format format, const uint32_t width, const uint32_t height,
|
||||
const Sampler::Desc& defaultSamplerDesc, const uint32_t MIPLevelCount, const uint32_t sampleCount) = 0;
|
||||
|
||||
virtual std::unique_ptr<ITexture> CreateTexture2D(const char* name,
|
||||
const Format format, const uint32_t width, const uint32_t height,
|
||||
const Sampler::Desc& defaultSamplerDesc, const uint32_t MIPLevelCount = 1, const uint32_t sampleCount = 1) = 0;
|
||||
|
||||
virtual std::unique_ptr<IFramebuffer> CreateFramebuffer(
|
||||
const char* name, ITexture* colorAttachment,
|
||||
ITexture* depthStencilAttachment) = 0;
|
||||
|
||||
virtual std::unique_ptr<IFramebuffer> CreateFramebuffer(
|
||||
const char* name, ITexture* colorAttachment,
|
||||
ITexture* depthStencilAttachment, const CColor& clearColor) = 0;
|
||||
|
||||
virtual std::unique_ptr<IBuffer> CreateBuffer(
|
||||
const char* name, const IBuffer::Type type, const uint32_t size, const bool dynamic) = 0;
|
||||
|
||||
virtual std::unique_ptr<IShaderProgram> CreateShaderProgram(
|
||||
const CStr& name, const CShaderDefines& defines) = 0;
|
||||
|
||||
virtual void Present() = 0;
|
||||
|
||||
virtual bool IsTextureFormatSupported(const Format format) const = 0;
|
||||
|
||||
virtual const Capabilities& GetCapabilities() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_IDEVICE
|
157
source/renderer/backend/IDeviceCommandContext.h
Normal file
157
source/renderer/backend/IDeviceCommandContext.h
Normal file
@ -0,0 +1,157 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_IDEVICECOMMANDCONTEXT
|
||||
#define INCLUDED_RENDERER_BACKEND_IDEVICECOMMANDCONTEXT
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IDeviceObject.h"
|
||||
#include "renderer/backend/PipelineState.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
class IBuffer;
|
||||
class IDevice;
|
||||
class IFramebuffer;
|
||||
class ITexture;
|
||||
|
||||
class IDeviceCommandContext : public IDeviceObject<IDeviceCommandContext>
|
||||
{
|
||||
public:
|
||||
virtual void SetGraphicsPipelineState(const GraphicsPipelineStateDesc& pipelineStateDesc) = 0;
|
||||
|
||||
virtual void BlitFramebuffer(
|
||||
IFramebuffer* destinationFramebuffer, IFramebuffer* sourceFramebuffer) = 0;
|
||||
|
||||
virtual void ClearFramebuffer() = 0;
|
||||
virtual void ClearFramebuffer(const bool color, const bool depth, const bool stencil) = 0;
|
||||
virtual void SetFramebuffer(IFramebuffer* framebuffer) = 0;
|
||||
virtual void ReadbackFramebufferSync(
|
||||
const uint32_t x, const uint32_t y, const uint32_t width, const uint32_t height,
|
||||
void* data) = 0;
|
||||
|
||||
virtual void UploadTexture(ITexture* texture, const Format dataFormat,
|
||||
const void* data, const size_t dataSize,
|
||||
const uint32_t level = 0, const uint32_t layer = 0) = 0;
|
||||
virtual void UploadTextureRegion(ITexture* texture, const Format dataFormat,
|
||||
const void* data, const size_t dataSize,
|
||||
const uint32_t xOffset, const uint32_t yOffset,
|
||||
const uint32_t width, const uint32_t height,
|
||||
const uint32_t level = 0, const uint32_t layer = 0) = 0;
|
||||
|
||||
using UploadBufferFunction = std::function<void(u8*)>;
|
||||
virtual void UploadBuffer(IBuffer* buffer, const void* data, const uint32_t dataSize) = 0;
|
||||
virtual void UploadBuffer(IBuffer* buffer, const UploadBufferFunction& uploadFunction) = 0;
|
||||
virtual void UploadBufferRegion(
|
||||
IBuffer* buffer, const void* data, const uint32_t dataOffset, const uint32_t dataSize) = 0;
|
||||
virtual void UploadBufferRegion(
|
||||
IBuffer* buffer, const uint32_t dataOffset, const uint32_t dataSize,
|
||||
const UploadBufferFunction& uploadFunction) = 0;
|
||||
|
||||
// TODO: maybe we should add a more common type, like CRectI.
|
||||
struct Rect
|
||||
{
|
||||
int32_t x, y;
|
||||
int32_t width, height;
|
||||
};
|
||||
virtual void SetScissors(const uint32_t scissorCount, const Rect* scissors) = 0;
|
||||
virtual void SetViewports(const uint32_t viewportCount, const Rect* viewports) = 0;
|
||||
|
||||
virtual void SetVertexAttributeFormat(
|
||||
const VertexAttributeStream stream,
|
||||
const Format format,
|
||||
const uint32_t offset,
|
||||
const uint32_t stride,
|
||||
const uint32_t bindingSlot) = 0;
|
||||
virtual void SetVertexBuffer(const uint32_t bindingSlot, IBuffer* buffer) = 0;
|
||||
virtual void SetVertexBufferData(const uint32_t bindingSlot, const void* data) = 0;
|
||||
|
||||
virtual void SetIndexBuffer(IBuffer* buffer) = 0;
|
||||
virtual void SetIndexBufferData(const void* data) = 0;
|
||||
|
||||
virtual void BeginPass() = 0;
|
||||
virtual void EndPass() = 0;
|
||||
|
||||
virtual void Draw(const uint32_t firstVertex, const uint32_t vertexCount) = 0;
|
||||
virtual void DrawIndexed(
|
||||
const uint32_t firstIndex, const uint32_t indexCount, const int32_t vertexOffset) = 0;
|
||||
// TODO: should be removed when performance impact is minimal on slow hardware.
|
||||
virtual void DrawIndexedInRange(
|
||||
const uint32_t firstIndex, const uint32_t indexCount,
|
||||
const uint32_t start, const uint32_t end) = 0;
|
||||
|
||||
virtual void SetTexture(const int32_t bindingSlot, ITexture* texture) = 0;
|
||||
|
||||
virtual void SetUniform(
|
||||
const int32_t bindingSlot,
|
||||
const float value) = 0;
|
||||
virtual void SetUniform(
|
||||
const int32_t bindingSlot,
|
||||
const float valueX, const float valueY) = 0;
|
||||
virtual void SetUniform(
|
||||
const int32_t bindingSlot,
|
||||
const float valueX, const float valueY,
|
||||
const float valueZ) = 0;
|
||||
virtual void SetUniform(
|
||||
const int32_t bindingSlot,
|
||||
const float valueX, const float valueY,
|
||||
const float valueZ, const float valueW) = 0;
|
||||
virtual void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) = 0;
|
||||
|
||||
virtual void BeginScopedLabel(const char* name) = 0;
|
||||
virtual void EndScopedLabel() = 0;
|
||||
|
||||
virtual void Flush() = 0;
|
||||
};
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#define GPU_SCOPED_LABEL(deviceCommandContext, name) \
|
||||
GPUScopedLabel scopedLabel((deviceCommandContext), (name));
|
||||
|
||||
class GPUScopedLabel
|
||||
{
|
||||
public:
|
||||
GPUScopedLabel(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
const char* name)
|
||||
: m_DeviceCommandContext(deviceCommandContext)
|
||||
{
|
||||
m_DeviceCommandContext->BeginScopedLabel(name);
|
||||
}
|
||||
|
||||
~GPUScopedLabel()
|
||||
{
|
||||
m_DeviceCommandContext->EndScopedLabel();
|
||||
}
|
||||
|
||||
private:
|
||||
Renderer::Backend::IDeviceCommandContext* m_DeviceCommandContext = nullptr;
|
||||
};
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_IDEVICECOMMANDCONTEXT
|
51
source/renderer/backend/IDeviceObject.h
Normal file
51
source/renderer/backend/IDeviceObject.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_IDEVICEOBJECT
|
||||
#define INCLUDED_RENDERER_BACKEND_IDEVICEOBJECT
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
class IDevice;
|
||||
|
||||
template<typename BaseDeviceObject>
|
||||
class IDeviceObject
|
||||
{
|
||||
public:
|
||||
virtual ~IDeviceObject() {}
|
||||
|
||||
virtual IDevice* GetDevice() = 0;
|
||||
|
||||
template<typename T>
|
||||
T* As()
|
||||
{
|
||||
static_assert(std::is_base_of_v<BaseDeviceObject, T>);
|
||||
return static_cast<T*>(this);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_IDEVICEOBJECT
|
40
source/renderer/backend/IFramebuffer.h
Normal file
40
source/renderer/backend/IFramebuffer.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_IFRAMEBUFFER
|
||||
#define INCLUDED_RENDERER_BACKEND_IFRAMEBUFFER
|
||||
|
||||
#include "graphics/Color.h"
|
||||
#include "renderer/backend/IDeviceObject.h"
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
class IFramebuffer : public IDeviceObject<IFramebuffer>
|
||||
{
|
||||
public:
|
||||
virtual const CColor& GetClearColor() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_IFRAMEBUFFER
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "lib/file/vfs/vfs_path.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "renderer/backend/IDeviceObject.h"
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
@ -45,11 +46,9 @@ enum class VertexAttributeStream : uint32_t
|
||||
/**
|
||||
* IShaderProgram is a container for multiple shaders of different types.
|
||||
*/
|
||||
class IShaderProgram
|
||||
class IShaderProgram : public IDeviceObject<IShaderProgram>
|
||||
{
|
||||
public:
|
||||
virtual ~IShaderProgram() {}
|
||||
|
||||
virtual int32_t GetBindingSlot(const CStrIntern name) const = 0;
|
||||
|
||||
virtual std::vector<VfsPath> GetFileDependencies() const = 0;
|
||||
|
55
source/renderer/backend/ITexture.h
Normal file
55
source/renderer/backend/ITexture.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_ITEXTURE
|
||||
#define INCLUDED_RENDERER_BACKEND_ITEXTURE
|
||||
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IDeviceObject.h"
|
||||
#include "renderer/backend/Sampler.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
class ITexture : public IDeviceObject<ITexture>
|
||||
{
|
||||
public:
|
||||
enum class Type
|
||||
{
|
||||
TEXTURE_2D,
|
||||
TEXTURE_2D_MULTISAMPLE,
|
||||
TEXTURE_CUBE
|
||||
};
|
||||
|
||||
virtual Type GetType() const = 0;
|
||||
virtual Format GetFormat() const = 0;
|
||||
|
||||
virtual uint32_t GetWidth() const = 0;
|
||||
virtual uint32_t GetHeight() const = 0;
|
||||
virtual uint32_t GetMIPLevelCount() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_ITEXTURE
|
58
source/renderer/backend/dummy/Buffer.cpp
Normal file
58
source/renderer/backend/dummy/Buffer.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "Buffer.h"
|
||||
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
// static
|
||||
std::unique_ptr<IBuffer> CBuffer::Create(
|
||||
CDevice* device, const Type type, const uint32_t size, const bool dynamic)
|
||||
{
|
||||
std::unique_ptr<CBuffer> buffer(new CBuffer());
|
||||
buffer->m_Device = device;
|
||||
buffer->m_Type = type;
|
||||
buffer->m_Size = size;
|
||||
buffer->m_Dynamic = dynamic;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
CBuffer::CBuffer() = default;
|
||||
|
||||
CBuffer::~CBuffer() = default;
|
||||
|
||||
IDevice* CBuffer::GetDevice()
|
||||
{
|
||||
return m_Device;
|
||||
}
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
68
source/renderer/backend/dummy/Buffer.h
Normal file
68
source/renderer/backend/dummy/Buffer.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_DUMMY_BUFFER
|
||||
#define INCLUDED_RENDERER_BACKEND_DUMMY_BUFFER
|
||||
|
||||
#include "renderer/backend/IBuffer.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
class CDevice;
|
||||
|
||||
class CBuffer : public IBuffer
|
||||
{
|
||||
public:
|
||||
~CBuffer() override;
|
||||
|
||||
IDevice* GetDevice() override;
|
||||
|
||||
Type GetType() const override { return m_Type; }
|
||||
uint32_t GetSize() const override { return m_Size; }
|
||||
bool IsDynamic() const override { return m_Dynamic; }
|
||||
|
||||
private:
|
||||
friend class CDevice;
|
||||
|
||||
static std::unique_ptr<IBuffer> Create(
|
||||
CDevice* device, const Type type, const uint32_t size, const bool dynamic);
|
||||
|
||||
CBuffer();
|
||||
|
||||
CDevice* m_Device = nullptr;
|
||||
|
||||
Type m_Type = Type::VERTEX;
|
||||
uint32_t m_Size = 0;
|
||||
bool m_Dynamic = false;
|
||||
};
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_DUMMY_BUFFER
|
128
source/renderer/backend/dummy/Device.cpp
Normal file
128
source/renderer/backend/dummy/Device.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "Device.h"
|
||||
|
||||
#include "renderer/backend/dummy/Buffer.h"
|
||||
#include "renderer/backend/dummy/DeviceCommandContext.h"
|
||||
#include "renderer/backend/dummy/Framebuffer.h"
|
||||
#include "renderer/backend/dummy/ShaderProgram.h"
|
||||
#include "renderer/backend/dummy/Texture.h"
|
||||
#include "scriptinterface/JSON.h"
|
||||
#include "scriptinterface/Object.h"
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
#include "scriptinterface/ScriptRequest.h"
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
CDevice::CDevice()
|
||||
{
|
||||
m_Name = "Dummy";
|
||||
m_Version = "Unknown";
|
||||
m_DriverInformation = "Unknown";
|
||||
m_Extensions = {};
|
||||
|
||||
m_Backbuffer = CFramebuffer::Create(this);
|
||||
|
||||
m_Capabilities.S3TC = true;
|
||||
m_Capabilities.ARBShaders = false;
|
||||
m_Capabilities.ARBShadersShadow = false;
|
||||
m_Capabilities.computeShaders = true;
|
||||
m_Capabilities.debugLabels = true;
|
||||
m_Capabilities.debugScopedLabels = true;
|
||||
m_Capabilities.multisampling = true;
|
||||
m_Capabilities.anisotropicFiltering = true;
|
||||
m_Capabilities.maxSampleCount = 4u;
|
||||
m_Capabilities.maxAnisotropy = 16.0f;
|
||||
m_Capabilities.maxTextureSize = 8192u;
|
||||
}
|
||||
|
||||
CDevice::~CDevice() = default;
|
||||
|
||||
void CDevice::Report(const ScriptRequest& rq, JS::HandleValue settings)
|
||||
{
|
||||
Script::SetProperty(rq, settings, "name", "dummy");
|
||||
}
|
||||
|
||||
std::unique_ptr<IDeviceCommandContext> CDevice::CreateCommandContext()
|
||||
{
|
||||
return CDeviceCommandContext::Create(this);
|
||||
}
|
||||
|
||||
std::unique_ptr<ITexture> CDevice::CreateTexture(const char* UNUSED(name), const CTexture::Type type,
|
||||
const Format format, const uint32_t width, const uint32_t height,
|
||||
const Sampler::Desc& UNUSED(defaultSamplerDesc), const uint32_t MIPLevelCount, const uint32_t UNUSED(sampleCount))
|
||||
{
|
||||
return CTexture::Create(this, type, format, width, height, MIPLevelCount);
|
||||
}
|
||||
|
||||
std::unique_ptr<ITexture> CDevice::CreateTexture2D(const char* name,
|
||||
const Format format, const uint32_t width, const uint32_t height,
|
||||
const Sampler::Desc& defaultSamplerDesc, const uint32_t MIPLevelCount, const uint32_t sampleCount)
|
||||
{
|
||||
return CreateTexture(name, ITexture::Type::TEXTURE_2D,
|
||||
format, width, height, defaultSamplerDesc, MIPLevelCount, sampleCount);
|
||||
}
|
||||
|
||||
std::unique_ptr<IFramebuffer> CDevice::CreateFramebuffer(
|
||||
const char*, ITexture*, ITexture*)
|
||||
{
|
||||
return CFramebuffer::Create(this);
|
||||
}
|
||||
|
||||
std::unique_ptr<IFramebuffer> CDevice::CreateFramebuffer(
|
||||
const char*, ITexture*, ITexture*, const CColor&)
|
||||
{
|
||||
return CFramebuffer::Create(this);
|
||||
}
|
||||
|
||||
std::unique_ptr<IBuffer> CDevice::CreateBuffer(
|
||||
const char*, const CBuffer::Type type, const uint32_t size, const bool dynamic)
|
||||
{
|
||||
return CBuffer::Create(this, type, size, dynamic);
|
||||
}
|
||||
|
||||
std::unique_ptr<IShaderProgram> CDevice::CreateShaderProgram(
|
||||
const CStr&, const CShaderDefines&)
|
||||
{
|
||||
return CShaderProgram::Create(this);
|
||||
}
|
||||
|
||||
void CDevice::Present()
|
||||
{
|
||||
// We have nothing to present.
|
||||
}
|
||||
|
||||
bool CDevice::IsTextureFormatSupported(const Format UNUSED(format)) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
99
source/renderer/backend/dummy/Device.h
Normal file
99
source/renderer/backend/dummy/Device.h
Normal file
@ -0,0 +1,99 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE
|
||||
#define INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE
|
||||
|
||||
#include "renderer/backend/IDevice.h"
|
||||
|
||||
class CShaderDefines;
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
class CDeviceCommandContext;
|
||||
|
||||
class CDevice : public IDevice
|
||||
{
|
||||
public:
|
||||
CDevice();
|
||||
~CDevice() override;
|
||||
|
||||
const std::string& GetName() const override { return m_Name; }
|
||||
const std::string& GetVersion() const override { return m_Version; }
|
||||
const std::string& GetDriverInformation() const override { return m_DriverInformation; }
|
||||
const std::vector<std::string>& GetExtensions() const override { return m_Extensions; }
|
||||
|
||||
void Report(const ScriptRequest& rq, JS::HandleValue settings) override;
|
||||
|
||||
IFramebuffer* GetCurrentBackbuffer() override { return m_Backbuffer.get(); }
|
||||
|
||||
std::unique_ptr<IDeviceCommandContext> CreateCommandContext() override;
|
||||
|
||||
std::unique_ptr<ITexture> CreateTexture(const char* name, const ITexture::Type type,
|
||||
const Format format, const uint32_t width, const uint32_t height,
|
||||
const Sampler::Desc& defaultSamplerDesc, const uint32_t MIPLevelCount, const uint32_t sampleCount) override;
|
||||
|
||||
std::unique_ptr<ITexture> CreateTexture2D(const char* name,
|
||||
const Format format, const uint32_t width, const uint32_t height,
|
||||
const Sampler::Desc& defaultSamplerDesc, const uint32_t MIPLevelCount = 1, const uint32_t sampleCount = 1) override;
|
||||
|
||||
std::unique_ptr<IFramebuffer> CreateFramebuffer(
|
||||
const char* name, ITexture* colorAttachment,
|
||||
ITexture* depthStencilAttachment) override;
|
||||
|
||||
std::unique_ptr<IFramebuffer> CreateFramebuffer(
|
||||
const char* name, ITexture* colorAttachment,
|
||||
ITexture* depthStencilAttachment, const CColor& clearColor) override;
|
||||
|
||||
std::unique_ptr<IBuffer> CreateBuffer(
|
||||
const char* name, const IBuffer::Type type, const uint32_t size, const bool dynamic) override;
|
||||
|
||||
std::unique_ptr<IShaderProgram> CreateShaderProgram(
|
||||
const CStr& name, const CShaderDefines& defines) override;
|
||||
|
||||
void Present() override;
|
||||
|
||||
bool IsTextureFormatSupported(const Format format) const override;
|
||||
|
||||
const Capabilities& GetCapabilities() const override { return m_Capabilities; }
|
||||
|
||||
private:
|
||||
|
||||
std::string m_Name;
|
||||
std::string m_Version;
|
||||
std::string m_DriverInformation;
|
||||
std::vector<std::string> m_Extensions;
|
||||
|
||||
std::unique_ptr<IFramebuffer> m_Backbuffer;
|
||||
|
||||
Capabilities m_Capabilities{};
|
||||
};
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE
|
204
source/renderer/backend/dummy/DeviceCommandContext.cpp
Normal file
204
source/renderer/backend/dummy/DeviceCommandContext.cpp
Normal file
@ -0,0 +1,204 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "DeviceCommandContext.h"
|
||||
|
||||
#include "renderer/backend/dummy/Buffer.h"
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
#include "renderer/backend/dummy/Framebuffer.h"
|
||||
#include "renderer/backend/dummy/ShaderProgram.h"
|
||||
#include "renderer/backend/dummy/Texture.h"
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
// static
|
||||
std::unique_ptr<CDeviceCommandContext> CDeviceCommandContext::Create(CDevice* device)
|
||||
{
|
||||
std::unique_ptr<CDeviceCommandContext> deviceCommandContext(new CDeviceCommandContext());
|
||||
deviceCommandContext->m_Device = device;
|
||||
return deviceCommandContext;
|
||||
}
|
||||
|
||||
CDeviceCommandContext::CDeviceCommandContext() = default;
|
||||
|
||||
CDeviceCommandContext::~CDeviceCommandContext() = default;
|
||||
|
||||
IDevice* CDeviceCommandContext::GetDevice()
|
||||
{
|
||||
return m_Device;
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetGraphicsPipelineState(
|
||||
const GraphicsPipelineStateDesc&)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::UploadTexture(
|
||||
ITexture*, const Format, const void*, const size_t,
|
||||
const uint32_t, const uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::UploadTextureRegion(
|
||||
ITexture*, const Format, const void*, const size_t,
|
||||
const uint32_t, const uint32_t, const uint32_t, const uint32_t,
|
||||
const uint32_t, const uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::UploadBuffer(IBuffer*, const void*, const uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::UploadBuffer(IBuffer*, const UploadBufferFunction&)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::UploadBufferRegion(
|
||||
IBuffer*, const void*, const uint32_t, const uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::UploadBufferRegion(
|
||||
IBuffer*, const uint32_t, const uint32_t, const UploadBufferFunction&)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::BeginScopedLabel(const char*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::EndScopedLabel()
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::Flush()
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::BlitFramebuffer(IFramebuffer*, IFramebuffer*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::ClearFramebuffer()
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::ClearFramebuffer(const bool, const bool, const bool)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetFramebuffer(IFramebuffer*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::ReadbackFramebufferSync(
|
||||
const uint32_t, const uint32_t, const uint32_t, const uint32_t, void*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetScissors(const uint32_t, const Rect*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetViewports(const uint32_t, const Rect*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetVertexAttributeFormat(
|
||||
const VertexAttributeStream, const Format,
|
||||
const uint32_t, const uint32_t, const uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetVertexBuffer(const uint32_t, IBuffer*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetVertexBufferData(const uint32_t, const void*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetIndexBuffer(IBuffer*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetIndexBufferData(const void*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::BeginPass()
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::EndPass()
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::Draw(const uint32_t, const uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::DrawIndexed(const uint32_t, const uint32_t, const int32_t)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::DrawIndexedInRange(
|
||||
const uint32_t, const uint32_t, const uint32_t, const uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetTexture(const int32_t, ITexture*)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(const int32_t, const float)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(const int32_t, const float, const float)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(
|
||||
const int32_t, const float, const float, const float)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(
|
||||
const int32_t, const float, const float, const float, const float)
|
||||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(const int32_t, PS::span<const float>)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
143
source/renderer/backend/dummy/DeviceCommandContext.h
Normal file
143
source/renderer/backend/dummy/DeviceCommandContext.h
Normal file
@ -0,0 +1,143 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_DUMMY_DEVICECOMMANDCONTEXT
|
||||
#define INCLUDED_RENDERER_DUMMY_DEVICECOMMANDCONTEXT
|
||||
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
#include "renderer/backend/PipelineState.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
class CDevice;
|
||||
class CBuffer;
|
||||
class CFramebuffer;
|
||||
class CShaderProgram;
|
||||
class CTexture;
|
||||
|
||||
class CDeviceCommandContext : public IDeviceCommandContext
|
||||
{
|
||||
public:
|
||||
~CDeviceCommandContext();
|
||||
|
||||
IDevice* GetDevice() override;
|
||||
|
||||
void SetGraphicsPipelineState(const GraphicsPipelineStateDesc& pipelineStateDesc) override;
|
||||
|
||||
void BlitFramebuffer(IFramebuffer* destinationFramebuffer, IFramebuffer* sourceFramebuffer) override;
|
||||
|
||||
void ClearFramebuffer() override;
|
||||
void ClearFramebuffer(const bool color, const bool depth, const bool stencil) override;
|
||||
void SetFramebuffer(IFramebuffer* framebuffer) override;
|
||||
void ReadbackFramebufferSync(
|
||||
const uint32_t x, const uint32_t y, const uint32_t width, const uint32_t height,
|
||||
void* data) override;
|
||||
|
||||
void UploadTexture(ITexture* texture, const Format dataFormat,
|
||||
const void* data, const size_t dataSize,
|
||||
const uint32_t level = 0, const uint32_t layer = 0) override;
|
||||
void UploadTextureRegion(ITexture* texture, const Format dataFormat,
|
||||
const void* data, const size_t dataSize,
|
||||
const uint32_t xOffset, const uint32_t yOffset,
|
||||
const uint32_t width, const uint32_t height,
|
||||
const uint32_t level = 0, const uint32_t layer = 0) override;
|
||||
|
||||
using UploadBufferFunction = std::function<void(u8*)>;
|
||||
void UploadBuffer(IBuffer* buffer, const void* data, const uint32_t dataSize) override;
|
||||
void UploadBuffer(IBuffer* buffer, const UploadBufferFunction& uploadFunction) override;
|
||||
void UploadBufferRegion(
|
||||
IBuffer* buffer, const void* data, const uint32_t dataOffset, const uint32_t dataSize) override;
|
||||
void UploadBufferRegion(
|
||||
IBuffer* buffer, const uint32_t dataOffset, const uint32_t dataSize,
|
||||
const UploadBufferFunction& uploadFunction) override;
|
||||
|
||||
void SetScissors(const uint32_t scissorCount, const Rect* scissors) override;
|
||||
void SetViewports(const uint32_t viewportCount, const Rect* viewports) override;
|
||||
|
||||
void SetVertexAttributeFormat(
|
||||
const VertexAttributeStream stream,
|
||||
const Format format,
|
||||
const uint32_t offset,
|
||||
const uint32_t stride,
|
||||
const uint32_t bindingSlot) override;
|
||||
void SetVertexBuffer(const uint32_t bindingSlot, IBuffer* buffer) override;
|
||||
void SetVertexBufferData(const uint32_t bindingSlot, const void* data) override;
|
||||
|
||||
void SetIndexBuffer(IBuffer* buffer) override;
|
||||
void SetIndexBufferData(const void* data) override;
|
||||
|
||||
void BeginPass() override;
|
||||
void EndPass() override;
|
||||
|
||||
void Draw(const uint32_t firstVertex, const uint32_t vertexCount) override;
|
||||
void DrawIndexed(
|
||||
const uint32_t firstIndex, const uint32_t indexCount, const int32_t vertexOffset) override;
|
||||
void DrawIndexedInRange(
|
||||
const uint32_t firstIndex, const uint32_t indexCount,
|
||||
const uint32_t start, const uint32_t end) override;
|
||||
|
||||
void SetTexture(const int32_t bindingSlot, ITexture* texture) override;
|
||||
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot,
|
||||
const float value) override;
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot,
|
||||
const float valueX, const float valueY) override;
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot,
|
||||
const float valueX, const float valueY,
|
||||
const float valueZ) override;
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot,
|
||||
const float valueX, const float valueY,
|
||||
const float valueZ, const float valueW) override;
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) override;
|
||||
|
||||
void BeginScopedLabel(const char* name) override;
|
||||
void EndScopedLabel() override;
|
||||
|
||||
void Flush() override;
|
||||
|
||||
private:
|
||||
friend class CDevice;
|
||||
|
||||
static std::unique_ptr<CDeviceCommandContext> Create(CDevice* device);
|
||||
|
||||
CDeviceCommandContext();
|
||||
|
||||
CDevice* m_Device = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_DUMMY_DEVICECOMMANDCONTEXT
|
54
source/renderer/backend/dummy/Framebuffer.cpp
Normal file
54
source/renderer/backend/dummy/Framebuffer.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "Framebuffer.h"
|
||||
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
CFramebuffer::CFramebuffer() = default;
|
||||
|
||||
CFramebuffer::~CFramebuffer() = default;
|
||||
|
||||
// static
|
||||
std::unique_ptr<IFramebuffer> CFramebuffer::Create(CDevice* device)
|
||||
{
|
||||
std::unique_ptr<CFramebuffer> framebuffer(new CFramebuffer());
|
||||
framebuffer->m_Device = device;
|
||||
return framebuffer;
|
||||
}
|
||||
|
||||
IDevice* CFramebuffer::GetDevice()
|
||||
{
|
||||
return m_Device;
|
||||
}
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
63
source/renderer/backend/dummy/Framebuffer.h
Normal file
63
source/renderer/backend/dummy/Framebuffer.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_DUMMY_FRAMEBUFFER
|
||||
#define INCLUDED_RENDERER_BACKEND_DUMMY_FRAMEBUFFER
|
||||
|
||||
#include "renderer/backend/IFramebuffer.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
class CDevice;
|
||||
|
||||
class CFramebuffer : public IFramebuffer
|
||||
{
|
||||
public:
|
||||
~CFramebuffer() override;
|
||||
|
||||
IDevice* GetDevice() override;
|
||||
|
||||
const CColor& GetClearColor() const override { return m_ClearColor; }
|
||||
|
||||
private:
|
||||
friend class CDevice;
|
||||
|
||||
static std::unique_ptr<IFramebuffer> Create(CDevice* device);
|
||||
|
||||
CFramebuffer();
|
||||
|
||||
CDevice* m_Device = nullptr;
|
||||
|
||||
CColor m_ClearColor;
|
||||
};
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_DUMMY_FRAMEBUFFER
|
64
source/renderer/backend/dummy/ShaderProgram.cpp
Normal file
64
source/renderer/backend/dummy/ShaderProgram.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "ShaderProgram.h"
|
||||
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
CShaderProgram::CShaderProgram() = default;
|
||||
|
||||
CShaderProgram::~CShaderProgram() = default;
|
||||
|
||||
// static
|
||||
std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device)
|
||||
{
|
||||
std::unique_ptr<CShaderProgram> shaderProgram(new CShaderProgram());
|
||||
shaderProgram->m_Device = device;
|
||||
return shaderProgram;
|
||||
}
|
||||
|
||||
IDevice* CShaderProgram::GetDevice()
|
||||
{
|
||||
return m_Device;
|
||||
}
|
||||
|
||||
int32_t CShaderProgram::GetBindingSlot(const CStrIntern UNUSED(name)) const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::vector<VfsPath> CShaderProgram::GetFileDependencies() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
63
source/renderer/backend/dummy/ShaderProgram.h
Normal file
63
source/renderer/backend/dummy/ShaderProgram.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_DUMMY_SHADERPROGRAM
|
||||
#define INCLUDED_RENDERER_BACKEND_DUMMY_SHADERPROGRAM
|
||||
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
class CDevice;
|
||||
|
||||
class CShaderProgram : public IShaderProgram
|
||||
{
|
||||
public:
|
||||
~CShaderProgram() override;
|
||||
|
||||
IDevice* GetDevice() override;
|
||||
|
||||
int32_t GetBindingSlot(const CStrIntern name) const override;
|
||||
|
||||
std::vector<VfsPath> GetFileDependencies() const override;
|
||||
|
||||
protected:
|
||||
friend class CDevice;
|
||||
|
||||
CShaderProgram();
|
||||
|
||||
static std::unique_ptr<CShaderProgram> Create(CDevice* device);
|
||||
|
||||
CDevice* m_Device = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_DUMMY_SHADERPROGRAM
|
64
source/renderer/backend/dummy/Texture.cpp
Normal file
64
source/renderer/backend/dummy/Texture.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "Texture.h"
|
||||
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
// static
|
||||
std::unique_ptr<ITexture> CTexture::Create(
|
||||
CDevice* device, const Type type, const Format format,
|
||||
const uint32_t width, const uint32_t height,
|
||||
const uint32_t MIPLevelCount)
|
||||
{
|
||||
std::unique_ptr<CTexture> texture(new CTexture());
|
||||
|
||||
texture->m_Device = device;
|
||||
texture->m_Format = format;
|
||||
texture->m_Type = type;
|
||||
texture->m_Width = width;
|
||||
texture->m_Height = height;
|
||||
texture->m_MIPLevelCount = MIPLevelCount;
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
CTexture::CTexture() = default;
|
||||
|
||||
CTexture::~CTexture() = default;
|
||||
|
||||
IDevice* CTexture::GetDevice()
|
||||
{
|
||||
return m_Device;
|
||||
}
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
74
source/renderer/backend/dummy/Texture.h
Normal file
74
source/renderer/backend/dummy/Texture.h
Normal file
@ -0,0 +1,74 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RENDERER_BACKEND_DUMMY_TEXTURE
|
||||
#define INCLUDED_RENDERER_BACKEND_DUMMY_TEXTURE
|
||||
|
||||
#include "renderer/backend/ITexture.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
namespace Backend
|
||||
{
|
||||
|
||||
namespace Dummy
|
||||
{
|
||||
|
||||
class CDevice;
|
||||
|
||||
class CTexture : public ITexture
|
||||
{
|
||||
public:
|
||||
~CTexture() override;
|
||||
|
||||
IDevice* GetDevice() override;
|
||||
|
||||
Type GetType() const override { return m_Type; }
|
||||
Format GetFormat() const override { return m_Format; }
|
||||
|
||||
uint32_t GetWidth() const override { return m_Width; }
|
||||
uint32_t GetHeight() const override { return m_Height; }
|
||||
uint32_t GetMIPLevelCount() const override { return m_MIPLevelCount; }
|
||||
|
||||
private:
|
||||
friend class CDevice;
|
||||
|
||||
CTexture();
|
||||
|
||||
static std::unique_ptr<ITexture> Create(
|
||||
CDevice* device, const Type type, const Format format,
|
||||
const uint32_t width, const uint32_t height,
|
||||
const uint32_t MIPLevelCount);
|
||||
|
||||
CDevice* m_Device = nullptr;
|
||||
Type m_Type = Type::TEXTURE_2D;
|
||||
Format m_Format = Format::UNDEFINED;
|
||||
uint32_t m_Width = 0;
|
||||
uint32_t m_Height = 0;
|
||||
uint32_t m_MIPLevelCount = 0;
|
||||
};
|
||||
|
||||
} // namespace Dummy
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
} // namespace Renderer
|
||||
|
||||
#endif // INCLUDED_RENDERER_BACKEND_DUMMY_TEXTURE
|
@ -69,6 +69,11 @@ CBuffer::~CBuffer()
|
||||
glDeleteBuffersARB(1, &m_Handle);
|
||||
}
|
||||
|
||||
IDevice* CBuffer::GetDevice()
|
||||
{
|
||||
return m_Device;
|
||||
}
|
||||
|
||||
} // namespace GL
|
||||
|
||||
} // namespace Backend
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define INCLUDED_RENDERER_BACKEND_GL_BUFFER
|
||||
|
||||
#include "lib/ogl.h"
|
||||
#include "renderer/backend/IBuffer.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@ -34,20 +35,16 @@ namespace GL
|
||||
|
||||
class CDevice;
|
||||
|
||||
class CBuffer
|
||||
class CBuffer final : public IBuffer
|
||||
{
|
||||
public:
|
||||
enum class Type
|
||||
{
|
||||
VERTEX,
|
||||
INDEX
|
||||
};
|
||||
~CBuffer() override;
|
||||
|
||||
~CBuffer();
|
||||
IDevice* GetDevice() override;
|
||||
|
||||
Type GetType() const { return m_Type; }
|
||||
uint32_t GetSize() const { return m_Size; }
|
||||
bool IsDynamic() const { return m_Dynamic; }
|
||||
Type GetType() const override { return m_Type; }
|
||||
uint32_t GetSize() const override { return m_Size; }
|
||||
bool IsDynamic() const override { return m_Dynamic; }
|
||||
|
||||
GLuint GetHandle() { return m_Handle; }
|
||||
|
||||
@ -64,6 +61,7 @@ private:
|
||||
Type m_Type = Type::VERTEX;
|
||||
uint32_t m_Size = 0;
|
||||
bool m_Dynamic = false;
|
||||
|
||||
GLuint m_Handle = 0;
|
||||
};
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user