mirror of
https://github.com/libretro/parallel-gx1.git
synced 2026-11-11 23:42:40 -10:00
A generator can now build its stage through rslc's builder instead of writing GLSL for the backend to parse: AbstractGfx::CreateShaderFromBuild takes a build function, and each backend asks rslc for its own destination from the built stage - SPIR-V for Vulkan, DXBC at the device's feature level for D3D11 and D3D12, GLSL or GLSL ES at the context's version for OpenGL, MSL for Metal. VideoCommon/ShaderBuild carries the per-backend resource layout the shader headers' macros gave, and builds a stage in the worker's shader arena, again from the start where the arena has to grow. The framebuffer utility stages move first: the screen quad, texture copy, clear and EFB poke vertex stages, the passthrough geometry stages, and the texture copy, color and multisample resolve pixel stages. Each compiles to the same SPIR-V and DXBC words as its GLSL did; the text writers are gone. rslc prints OpenGL's GLSL without bindings, so the OpenGL backend binds blocks, samplers, attributes and outputs by name for every program.
92 lines
2.6 KiB
C++
92 lines
2.6 KiB
C++
// Copyright 2015 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "VideoBackends/Null/NullGfx.h"
|
|
|
|
#include "VideoBackends/Null/NullTexture.h"
|
|
|
|
#include "VideoCommon/AbstractPipeline.h"
|
|
#include "VideoCommon/AbstractShader.h"
|
|
#include "VideoCommon/NativeVertexFormat.h"
|
|
#include "VideoCommon/VideoConfig.h"
|
|
#include "VideoCommon/VideoBackendKind.h"
|
|
|
|
namespace Null
|
|
{
|
|
// Init functions
|
|
NullGfx::NullGfx()
|
|
{
|
|
g_video_backend_kind = VIDEO_BACKEND_NULL;
|
|
UpdateActiveConfig();
|
|
}
|
|
|
|
NullGfx::~NullGfx()
|
|
{
|
|
UpdateActiveConfig();
|
|
}
|
|
|
|
bool NullGfx::IsHeadless() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool NullGfx::SupportsUtilityDrawing() const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
AbstractTexture* NullGfx::CreateTexture(const TextureConfig& config,
|
|
std::string_view /* name */)
|
|
{
|
|
return new NullTexture(config);
|
|
}
|
|
|
|
AbstractStagingTexture* NullGfx::CreateStagingTexture(StagingTextureType type,
|
|
const TextureConfig& config)
|
|
{
|
|
return new NullStagingTexture(type, config);
|
|
}
|
|
|
|
AbstractShader*
|
|
NullGfx::CreateShaderFromSource(ShaderStage stage, ShaderCode* /* source */,
|
|
std::string_view /* name */)
|
|
{
|
|
return new AbstractShader(stage);
|
|
}
|
|
|
|
AbstractShader* NullGfx::CreateShaderFromBuild(ShaderStage stage, shader_build_fn /* fn */,
|
|
const void* /* arg */, std::string_view /* name */)
|
|
{
|
|
return new AbstractShader(stage);
|
|
}
|
|
|
|
AbstractShader* NullGfx::CreateShaderFromBinary(ShaderStage stage,
|
|
const void* /* data */,
|
|
size_t /* length */,
|
|
std::string_view /* name */)
|
|
{
|
|
return new AbstractShader(stage);
|
|
}
|
|
|
|
AbstractPipeline* NullGfx::CreatePipeline(const AbstractPipelineConfig& config,
|
|
const void* cache_data,
|
|
size_t cache_data_length)
|
|
{
|
|
return new AbstractPipeline();
|
|
}
|
|
|
|
AbstractFramebuffer*
|
|
NullGfx::CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment)
|
|
{
|
|
return NullFramebuffer::Create(static_cast<NullTexture*>(color_attachment),
|
|
static_cast<NullTexture*>(depth_attachment));
|
|
}
|
|
|
|
NativeVertexFormat*
|
|
NullGfx::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
|
{
|
|
return new NativeVertexFormat(vtx_decl);
|
|
}
|
|
|
|
} // namespace Null
|