2022-08-03 11:42:37 +02:00
|
|
|
// Copyright (c) 2014- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program 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, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// This program 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 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
#include "Common/GPU/Shader.h"
|
|
|
|
#include "Common/GPU/ShaderWriter.h"
|
|
|
|
#include "Common/GPU/thin3d.h"
|
|
|
|
#include "Core/Config.h"
|
|
|
|
#include "Core/ConfigValues.h"
|
|
|
|
#include "Core/Reporting.h"
|
|
|
|
#include "GPU/Common/Draw2D.h"
|
|
|
|
#include "GPU/Common/DrawEngineCommon.h"
|
|
|
|
#include "GPU/Common/FramebufferManagerCommon.h"
|
|
|
|
#include "GPU/Common/TextureCacheCommon.h"
|
2022-08-17 14:28:34 +02:00
|
|
|
#include "GPU/Common/GPUStateUtils.h"
|
2022-08-03 11:42:37 +02:00
|
|
|
|
|
|
|
static const InputDef inputs[2] = {
|
2022-08-03 12:32:42 +02:00
|
|
|
{ "vec2", "a_position", Draw::SEM_POSITION },
|
2022-08-06 22:12:28 -07:00
|
|
|
{ "vec2", "a_texcoord0", Draw::SEM_TEXCOORD0 },
|
2022-08-03 11:42:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const VaryingDef varyings[1] = {
|
2022-08-03 12:32:42 +02:00
|
|
|
{ "vec2", "v_texcoord", Draw::SEM_TEXCOORD0, 0, "highp" },
|
2022-08-03 11:42:37 +02:00
|
|
|
};
|
|
|
|
|
2022-08-09 15:32:27 +02:00
|
|
|
static const SamplerDef samplers[1] = {
|
|
|
|
{ "tex" },
|
|
|
|
};
|
|
|
|
|
2022-08-21 08:53:34 +02:00
|
|
|
static const UniformDef uniforms[2] = {
|
2022-08-20 16:57:02 +02:00
|
|
|
{ "vec2", "texSize", 0 },
|
2022-08-21 08:53:34 +02:00
|
|
|
{ "float", "scaleFactor", 1},
|
2022-08-20 16:57:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Draw2DUB {
|
|
|
|
float texSizeX;
|
|
|
|
float texSizeY;
|
2022-08-21 08:53:34 +02:00
|
|
|
float scaleFactor;
|
2022-08-20 16:57:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const UniformBufferDesc draw2DUBDesc{ sizeof(Draw2DUB), {
|
|
|
|
{ "texSize", -1, 0, UniformType::FLOAT2, 0 },
|
2022-08-21 08:53:34 +02:00
|
|
|
{ "scaleFactor", -1, 1, UniformType::FLOAT1, 0 },
|
2022-08-20 16:57:02 +02:00
|
|
|
} };
|
|
|
|
|
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
Draw2DPipelineInfo GenerateDraw2DCopyColorFs(ShaderWriter &writer) {
|
2022-08-09 15:32:27 +02:00
|
|
|
writer.DeclareSamplers(samplers);
|
2022-08-07 13:19:27 +02:00
|
|
|
writer.BeginFSMain(Slice<UniformDef>::empty(), varyings, FSFLAG_NONE);
|
2022-08-09 15:32:27 +02:00
|
|
|
writer.C(" vec4 outColor = ").SampleTexture2D("tex", "v_texcoord.xy").C(";\n");
|
2022-08-07 13:19:27 +02:00
|
|
|
writer.EndFSMain("outColor", FSFLAG_NONE);
|
2022-08-17 14:42:13 +02:00
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
return Draw2DPipelineInfo{
|
|
|
|
RASTER_COLOR,
|
|
|
|
RASTER_COLOR,
|
|
|
|
};
|
2022-08-07 13:19:27 +02:00
|
|
|
}
|
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
Draw2DPipelineInfo GenerateDraw2DCopyDepthFs(ShaderWriter &writer) {
|
2022-08-07 13:19:27 +02:00
|
|
|
writer.DeclareSamplers(samplers);
|
|
|
|
writer.BeginFSMain(Slice<UniformDef>::empty(), varyings, FSFLAG_WRITEDEPTH);
|
|
|
|
writer.C(" vec4 outColor = vec4(0.0, 0.0, 0.0, 0.0);\n");
|
|
|
|
writer.C(" gl_FragDepth = ").SampleTexture2D("tex", "v_texcoord.xy").C(".x;\n");
|
|
|
|
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
2022-08-17 14:42:13 +02:00
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
return Draw2DPipelineInfo{
|
|
|
|
RASTER_DEPTH,
|
|
|
|
RASTER_DEPTH,
|
|
|
|
};
|
2022-08-03 11:42:37 +02:00
|
|
|
}
|
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
Draw2DPipelineInfo GenerateDraw2D565ToDepthFs(ShaderWriter &writer) {
|
2022-08-17 14:28:34 +02:00
|
|
|
writer.DeclareSamplers(samplers);
|
|
|
|
writer.BeginFSMain(Slice<UniformDef>::empty(), varyings, FSFLAG_WRITEDEPTH);
|
|
|
|
writer.C(" vec4 outColor = vec4(0.0, 0.0, 0.0, 0.0);\n");
|
|
|
|
// Unlike when just copying a depth buffer, here we're generating new depth values so we'll
|
|
|
|
// have to apply the scaling.
|
|
|
|
DepthScaleFactors factors = GetDepthScaleFactors();
|
|
|
|
writer.C(" vec3 rgb = ").SampleTexture2D("tex", "v_texcoord.xy").C(".xyz;\n");
|
2022-08-17 19:55:19 +02:00
|
|
|
writer.F(" highp float depthValue = (floor(rgb.x * 31.99) + floor(rgb.y * 63.99) * 32.0 + floor(rgb.z * 31.99) * 2048.0); \n");
|
|
|
|
writer.F(" gl_FragDepth = (depthValue / %f) + %f;\n", factors.scale, factors.offset);
|
2022-08-17 14:28:34 +02:00
|
|
|
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
2022-08-20 16:32:04 +02:00
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
return Draw2DPipelineInfo{
|
|
|
|
RASTER_COLOR,
|
|
|
|
RASTER_DEPTH,
|
|
|
|
};
|
2022-08-17 14:28:34 +02:00
|
|
|
}
|
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
Draw2DPipelineInfo GenerateDraw2D565ToDepthDeswizzleFs(ShaderWriter &writer) {
|
2022-08-18 15:46:20 +02:00
|
|
|
writer.DeclareSamplers(samplers);
|
2022-08-20 16:57:02 +02:00
|
|
|
writer.BeginFSMain(uniforms, varyings, FSFLAG_WRITEDEPTH);
|
2022-08-18 15:46:20 +02:00
|
|
|
writer.C(" vec4 outColor = vec4(0.0, 0.0, 0.0, 0.0);\n");
|
|
|
|
// Unlike when just copying a depth buffer, here we're generating new depth values so we'll
|
|
|
|
// have to apply the scaling.
|
|
|
|
DepthScaleFactors factors = GetDepthScaleFactors();
|
2022-08-20 16:57:02 +02:00
|
|
|
writer.C(" vec2 tsize = texSize;\n");
|
2022-08-18 15:46:20 +02:00
|
|
|
writer.C(" vec2 coord = v_texcoord * tsize;\n");
|
2022-08-21 08:53:34 +02:00
|
|
|
writer.F(" float strip = 4.0 * scaleFactor;\n");
|
2022-08-18 15:46:20 +02:00
|
|
|
writer.C(" float in_strip = mod(coord.y, strip);\n");
|
|
|
|
writer.C(" coord.y = coord.y - in_strip + strip - in_strip;\n");
|
|
|
|
writer.C(" coord /= tsize;\n");
|
|
|
|
writer.C(" vec3 rgb = ").SampleTexture2D("tex", "coord").C(".xyz;\n");
|
|
|
|
writer.F(" highp float depthValue = (floor(rgb.x * 31.99) + floor(rgb.y * 63.99) * 32.0 + floor(rgb.z * 31.99) * 2048.0); \n");
|
|
|
|
writer.F(" gl_FragDepth = (depthValue / %f) + %f;\n", factors.scale, factors.offset);
|
|
|
|
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
2022-08-23 10:05:44 +02:00
|
|
|
|
|
|
|
return Draw2DPipelineInfo{
|
|
|
|
RASTER_COLOR,
|
|
|
|
RASTER_DEPTH
|
|
|
|
};
|
2022-08-18 15:46:20 +02:00
|
|
|
}
|
|
|
|
|
2022-08-16 19:21:50 +02:00
|
|
|
void GenerateDraw2DVS(ShaderWriter &writer) {
|
2022-08-03 11:42:37 +02:00
|
|
|
writer.BeginVSMain(inputs, Slice<UniformDef>::empty(), varyings);
|
|
|
|
|
2022-08-06 22:12:28 -07:00
|
|
|
writer.C(" v_texcoord = a_texcoord0;\n"); // yes, this should be right. Should be 2.0 in the far corners.
|
2022-08-03 12:09:24 +02:00
|
|
|
writer.C(" gl_Position = vec4(a_position, 0.0, 1.0);\n");
|
2022-08-03 11:42:37 +02:00
|
|
|
|
|
|
|
writer.EndVSMain(varyings);
|
|
|
|
}
|
|
|
|
|
2022-08-23 10:35:58 +02:00
|
|
|
template <typename T>
|
|
|
|
static void DoRelease(T *&obj) {
|
|
|
|
if (obj)
|
|
|
|
obj->Release();
|
|
|
|
obj = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw2D::DeviceLost() {
|
|
|
|
DoRelease(draw2DVs_);
|
|
|
|
DoRelease(draw2DSamplerLinear_);
|
|
|
|
DoRelease(draw2DSamplerNearest_);
|
2022-08-23 20:07:53 -07:00
|
|
|
draw_ = nullptr;
|
2022-08-23 10:35:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Draw2D::DeviceRestore(Draw::DrawContext *draw) {
|
2022-08-23 20:07:53 -07:00
|
|
|
draw_ = draw;
|
2022-08-23 10:35:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Draw2D::Ensure2DResources() {
|
2022-08-16 11:11:59 +02:00
|
|
|
using namespace Draw;
|
|
|
|
|
|
|
|
const ShaderLanguageDesc &shaderLanguageDesc = draw_->GetShaderLanguageDesc();
|
|
|
|
|
|
|
|
if (!draw2DVs_) {
|
|
|
|
char *vsCode = new char[4000];
|
2022-08-16 19:21:50 +02:00
|
|
|
ShaderWriter writer(vsCode, shaderLanguageDesc, ShaderStage::Vertex);
|
|
|
|
GenerateDraw2DVS(writer);
|
2022-08-16 11:11:59 +02:00
|
|
|
draw2DVs_ = draw_->CreateShaderModule(ShaderStage::Vertex, shaderLanguageDesc.shaderLanguage, (const uint8_t *)vsCode, strlen(vsCode), "draw2d_vs");
|
|
|
|
_assert_(draw2DVs_);
|
|
|
|
delete[] vsCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!draw2DSamplerLinear_) {
|
|
|
|
SamplerStateDesc descLinear{};
|
|
|
|
descLinear.magFilter = TextureFilter::LINEAR;
|
|
|
|
descLinear.minFilter = TextureFilter::LINEAR;
|
|
|
|
descLinear.mipFilter = TextureFilter::LINEAR;
|
|
|
|
descLinear.wrapU = TextureAddressMode::CLAMP_TO_EDGE;
|
|
|
|
descLinear.wrapV = TextureAddressMode::CLAMP_TO_EDGE;
|
2022-08-23 23:55:53 +02:00
|
|
|
descLinear.wrapW = TextureAddressMode::CLAMP_TO_EDGE;
|
2022-08-16 11:11:59 +02:00
|
|
|
draw2DSamplerLinear_ = draw_->CreateSamplerState(descLinear);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!draw2DSamplerNearest_) {
|
|
|
|
SamplerStateDesc descNearest{};
|
|
|
|
descNearest.magFilter = TextureFilter::NEAREST;
|
|
|
|
descNearest.minFilter = TextureFilter::NEAREST;
|
|
|
|
descNearest.mipFilter = TextureFilter::NEAREST;
|
|
|
|
descNearest.wrapU = TextureAddressMode::CLAMP_TO_EDGE;
|
|
|
|
descNearest.wrapV = TextureAddressMode::CLAMP_TO_EDGE;
|
2022-08-23 23:55:53 +02:00
|
|
|
descNearest.wrapW = TextureAddressMode::CLAMP_TO_EDGE;
|
2022-08-16 11:11:59 +02:00
|
|
|
draw2DSamplerNearest_ = draw_->CreateSamplerState(descNearest);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-23 10:35:58 +02:00
|
|
|
Draw2DPipeline *Draw2D::Create2DPipeline(std::function<Draw2DPipelineInfo (ShaderWriter &)> generate) {
|
2022-08-22 23:50:36 +02:00
|
|
|
Ensure2DResources();
|
|
|
|
|
2022-08-03 11:42:37 +02:00
|
|
|
using namespace Draw;
|
2022-08-16 11:11:59 +02:00
|
|
|
const ShaderLanguageDesc &shaderLanguageDesc = draw_->GetShaderLanguageDesc();
|
2022-08-03 11:42:37 +02:00
|
|
|
|
2022-08-16 19:21:50 +02:00
|
|
|
char *fsCode = new char[4000];
|
|
|
|
ShaderWriter writer(fsCode, shaderLanguageDesc, ShaderStage::Fragment);
|
2022-08-23 10:05:44 +02:00
|
|
|
Draw2DPipelineInfo info = generate(writer);
|
2022-08-16 19:21:50 +02:00
|
|
|
|
|
|
|
ShaderModule *fs = draw_->CreateShaderModule(ShaderStage::Fragment, shaderLanguageDesc.shaderLanguage, (const uint8_t *)fsCode, strlen(fsCode), "draw2d_fs");
|
|
|
|
|
|
|
|
_assert_(fs);
|
|
|
|
|
|
|
|
// verts have positions in 2D clip coordinates.
|
|
|
|
static const InputLayoutDesc desc = {
|
|
|
|
{
|
|
|
|
{ 16, false },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{ 0, SEM_POSITION, DataFormat::R32G32_FLOAT, 0 },
|
|
|
|
{ 0, SEM_TEXCOORD0, DataFormat::R32G32_FLOAT, 8 },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
InputLayout *inputLayout = draw_->CreateInputLayout(desc);
|
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
BlendState *blend = draw_->CreateBlendState({ false, info.writeChannel == RASTER_COLOR ? 0xF : 0 });
|
2022-08-16 19:21:50 +02:00
|
|
|
|
2022-08-17 14:42:13 +02:00
|
|
|
DepthStencilStateDesc dsDesc{};
|
2022-08-23 10:05:44 +02:00
|
|
|
if (info.writeChannel == RASTER_DEPTH) {
|
2022-08-17 14:42:13 +02:00
|
|
|
dsDesc.depthTestEnabled = true;
|
|
|
|
dsDesc.depthWriteEnabled = true;
|
|
|
|
dsDesc.depthCompare = Draw::Comparison::ALWAYS;
|
|
|
|
}
|
2022-08-16 19:21:50 +02:00
|
|
|
|
2022-08-17 14:42:13 +02:00
|
|
|
DepthStencilState *depthStencil = draw_->CreateDepthStencilState(dsDesc);
|
|
|
|
RasterState *rasterNoCull = draw_->CreateRasterState({});
|
2022-08-16 19:21:50 +02:00
|
|
|
|
|
|
|
PipelineDesc pipelineDesc{
|
|
|
|
Primitive::TRIANGLE_STRIP,
|
|
|
|
{ draw2DVs_, fs },
|
2022-08-17 14:42:13 +02:00
|
|
|
inputLayout,
|
|
|
|
depthStencil,
|
2022-08-24 11:01:57 +02:00
|
|
|
blend,
|
|
|
|
rasterNoCull,
|
|
|
|
&draw2DUBDesc,
|
|
|
|
info.samplers.is_empty() ? samplers : info.samplers,
|
2022-08-16 19:21:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
Draw::Pipeline *pipeline = draw_->CreateGraphicsPipeline(pipelineDesc);
|
|
|
|
|
|
|
|
fs->Release();
|
|
|
|
|
|
|
|
rasterNoCull->Release();
|
2022-08-17 14:42:13 +02:00
|
|
|
blend->Release();
|
|
|
|
depthStencil->Release();
|
2022-08-16 19:21:50 +02:00
|
|
|
inputLayout->Release();
|
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
return new Draw2DPipeline {
|
|
|
|
pipeline,
|
2022-08-23 11:11:04 +02:00
|
|
|
info,
|
|
|
|
fsCode,
|
2022-08-23 10:05:44 +02:00
|
|
|
};
|
2022-08-16 19:21:50 +02:00
|
|
|
}
|
2022-08-03 11:42:37 +02:00
|
|
|
|
2022-08-22 23:50:36 +02:00
|
|
|
|
2022-08-23 10:35:58 +02:00
|
|
|
void Draw2D::DrawStrip2D(Draw::Texture *tex, Draw2DVertex *verts, int vertexCount, bool linearFilter, Draw2DPipeline *pipeline, float texW, float texH, int scaleFactor) {
|
2022-08-16 19:21:50 +02:00
|
|
|
using namespace Draw;
|
2022-08-08 12:07:50 +02:00
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
_dbg_assert_(pipeline);
|
|
|
|
|
|
|
|
if (pipeline->info.writeChannel == RASTER_DEPTH) {
|
|
|
|
_dbg_assert_(draw_->GetDeviceCaps().fragmentShaderDepthWriteSupported);
|
|
|
|
|
|
|
|
// We don't filter inputs when writing depth, results will be bad.
|
|
|
|
linearFilter = false;
|
|
|
|
}
|
|
|
|
|
2022-08-22 23:50:36 +02:00
|
|
|
Draw2DUB ub;
|
|
|
|
ub.texSizeX = tex ? tex->Width() : texW;
|
|
|
|
ub.texSizeY = tex ? tex->Height() : texH;
|
2022-08-23 10:35:58 +02:00
|
|
|
ub.scaleFactor = (float)scaleFactor;
|
2022-08-22 23:50:36 +02:00
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
draw_->BindPipeline(pipeline->pipeline);
|
2022-08-22 23:50:36 +02:00
|
|
|
draw_->UpdateDynamicUniformBuffer(&ub, sizeof(ub));
|
|
|
|
|
|
|
|
if (tex) {
|
|
|
|
draw_->BindTextures(TEX_SLOT_PSP_TEXTURE, 1, &tex);
|
|
|
|
}
|
|
|
|
draw_->BindSamplerStates(TEX_SLOT_PSP_TEXTURE, 1, linearFilter ? &draw2DSamplerLinear_ : &draw2DSamplerNearest_);
|
|
|
|
draw_->DrawUP(verts, vertexCount);
|
|
|
|
|
|
|
|
draw_->InvalidateCachedState();
|
|
|
|
|
|
|
|
gstate_c.Dirty(DIRTY_FRAGMENTSHADER_STATE | DIRTY_VERTEXSHADER_STATE);
|
|
|
|
}
|
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
Draw2DPipeline *FramebufferManagerCommon::Get2DPipeline(Draw2DShader shader) {
|
2022-08-22 23:50:36 +02:00
|
|
|
using namespace Draw;
|
2022-08-03 11:42:37 +02:00
|
|
|
|
2022-08-16 19:21:50 +02:00
|
|
|
const ShaderLanguageDesc &shaderLanguageDesc = draw_->GetShaderLanguageDesc();
|
2022-08-03 11:42:37 +02:00
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
Draw2DPipeline *pipeline = nullptr;
|
2022-08-22 23:50:36 +02:00
|
|
|
|
2022-08-17 14:28:34 +02:00
|
|
|
switch (shader) {
|
|
|
|
case DRAW2D_COPY_COLOR:
|
2022-08-16 19:21:50 +02:00
|
|
|
if (!draw2DPipelineColor_) {
|
2022-08-23 10:35:58 +02:00
|
|
|
draw2DPipelineColor_ = draw2D_.Create2DPipeline(&GenerateDraw2DCopyColorFs);
|
2022-08-16 12:46:13 +02:00
|
|
|
}
|
2022-08-22 23:50:36 +02:00
|
|
|
pipeline = draw2DPipelineColor_;
|
2022-08-16 19:21:50 +02:00
|
|
|
break;
|
2022-08-03 11:42:37 +02:00
|
|
|
|
2022-08-17 14:28:34 +02:00
|
|
|
case DRAW2D_COPY_DEPTH:
|
2022-08-16 19:21:50 +02:00
|
|
|
if (!draw_->GetDeviceCaps().fragmentShaderDepthWriteSupported) {
|
|
|
|
// Can't do it
|
2022-08-23 10:05:44 +02:00
|
|
|
return nullptr;
|
2022-08-16 11:11:59 +02:00
|
|
|
}
|
2022-08-16 19:21:50 +02:00
|
|
|
if (!draw2DPipelineDepth_) {
|
2022-08-23 10:35:58 +02:00
|
|
|
draw2DPipelineDepth_ = draw2D_.Create2DPipeline(&GenerateDraw2DCopyDepthFs);
|
2022-08-16 19:21:50 +02:00
|
|
|
}
|
2022-08-22 23:50:36 +02:00
|
|
|
pipeline = draw2DPipelineDepth_;
|
2022-08-16 11:11:59 +02:00
|
|
|
break;
|
2022-08-17 14:28:34 +02:00
|
|
|
|
|
|
|
case DRAW2D_565_TO_DEPTH:
|
|
|
|
if (!draw_->GetDeviceCaps().fragmentShaderDepthWriteSupported) {
|
|
|
|
// Can't do it
|
2022-08-23 10:05:44 +02:00
|
|
|
return nullptr;
|
2022-08-17 14:28:34 +02:00
|
|
|
}
|
|
|
|
if (!draw2DPipeline565ToDepth_) {
|
2022-08-23 10:35:58 +02:00
|
|
|
draw2DPipeline565ToDepth_ = draw2D_.Create2DPipeline(&GenerateDraw2D565ToDepthFs);
|
2022-08-17 14:28:34 +02:00
|
|
|
}
|
2022-08-22 23:50:36 +02:00
|
|
|
pipeline = draw2DPipeline565ToDepth_;
|
2022-08-17 14:28:34 +02:00
|
|
|
break;
|
2022-08-18 15:46:20 +02:00
|
|
|
|
|
|
|
case DRAW2D_565_TO_DEPTH_DESWIZZLE:
|
|
|
|
if (!draw_->GetDeviceCaps().fragmentShaderDepthWriteSupported) {
|
|
|
|
// Can't do it
|
2022-08-23 10:05:44 +02:00
|
|
|
return nullptr;
|
2022-08-18 15:46:20 +02:00
|
|
|
}
|
|
|
|
if (!draw2DPipeline565ToDepthDeswizzle_) {
|
2022-08-23 10:35:58 +02:00
|
|
|
draw2DPipeline565ToDepthDeswizzle_ = draw2D_.Create2DPipeline(&GenerateDraw2D565ToDepthDeswizzleFs);
|
2022-08-18 15:46:20 +02:00
|
|
|
}
|
2022-08-22 23:50:36 +02:00
|
|
|
pipeline = draw2DPipeline565ToDepthDeswizzle_;
|
2022-08-18 15:46:20 +02:00
|
|
|
break;
|
2022-08-08 12:07:50 +02:00
|
|
|
}
|
|
|
|
|
2022-08-23 10:05:44 +02:00
|
|
|
return pipeline;
|
2022-08-03 11:42:37 +02:00
|
|
|
}
|