Vulkan: Improve tagging of pipelines for debugging purposes
This commit is contained in:
parent
cddc612f6d
commit
347f7c4e5a
13 changed files with 53 additions and 46 deletions
|
@ -82,9 +82,9 @@ public:
|
||||||
SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override;
|
SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override;
|
||||||
RasterState *CreateRasterState(const RasterStateDesc &desc) override;
|
RasterState *CreateRasterState(const RasterStateDesc &desc) override;
|
||||||
Buffer *CreateBuffer(size_t size, uint32_t usageFlags) override;
|
Buffer *CreateBuffer(size_t size, uint32_t usageFlags) override;
|
||||||
Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc) override;
|
Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) override;
|
||||||
Texture *CreateTexture(const TextureDesc &desc) override;
|
Texture *CreateTexture(const TextureDesc &desc) override;
|
||||||
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag) override;
|
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) override;
|
||||||
Framebuffer *CreateFramebuffer(const FramebufferDesc &desc) override;
|
Framebuffer *CreateFramebuffer(const FramebufferDesc &desc) override;
|
||||||
|
|
||||||
void UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t offset, size_t size, UpdateBufferFlags flags) override;
|
void UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t offset, size_t size, UpdateBufferFlags flags) override;
|
||||||
|
@ -920,7 +920,7 @@ Texture *D3D11DrawContext::CreateTexture(const TextureDesc &desc) {
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag) {
|
ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) {
|
||||||
if (language != ShaderLanguage::HLSL_D3D11) {
|
if (language != ShaderLanguage::HLSL_D3D11) {
|
||||||
ERROR_LOG(G3D, "Unsupported shader language");
|
ERROR_LOG(G3D, "Unsupported shader language");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -965,7 +965,7 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang
|
||||||
}
|
}
|
||||||
if (errorMsgs) {
|
if (errorMsgs) {
|
||||||
errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize());
|
errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize());
|
||||||
ERROR_LOG(G3D, "Failed compiling:\n%s\n%s", data, errors.c_str());
|
ERROR_LOG(G3D, "Failed compiling %s:\n%s\n%s", tag, data, errors.c_str());
|
||||||
errorMsgs->Release();
|
errorMsgs->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,7 +1003,7 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *D3D11DrawContext::CreateGraphicsPipeline(const PipelineDesc &desc) {
|
Pipeline *D3D11DrawContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) {
|
||||||
D3D11Pipeline *dPipeline = new D3D11Pipeline();
|
D3D11Pipeline *dPipeline = new D3D11Pipeline();
|
||||||
dPipeline->blend = (D3D11BlendState *)desc.blend;
|
dPipeline->blend = (D3D11BlendState *)desc.blend;
|
||||||
dPipeline->depthStencil = (D3D11DepthStencilState *)desc.depthStencil;
|
dPipeline->depthStencil = (D3D11DepthStencilState *)desc.depthStencil;
|
||||||
|
|
|
@ -489,13 +489,13 @@ public:
|
||||||
}
|
}
|
||||||
uint32_t GetDataFormatSupport(DataFormat fmt) const override;
|
uint32_t GetDataFormatSupport(DataFormat fmt) const override;
|
||||||
|
|
||||||
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag) override;
|
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) override;
|
||||||
DepthStencilState *CreateDepthStencilState(const DepthStencilStateDesc &desc) override;
|
DepthStencilState *CreateDepthStencilState(const DepthStencilStateDesc &desc) override;
|
||||||
BlendState *CreateBlendState(const BlendStateDesc &desc) override;
|
BlendState *CreateBlendState(const BlendStateDesc &desc) override;
|
||||||
SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override;
|
SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override;
|
||||||
RasterState *CreateRasterState(const RasterStateDesc &desc) override;
|
RasterState *CreateRasterState(const RasterStateDesc &desc) override;
|
||||||
Buffer *CreateBuffer(size_t size, uint32_t usageFlags) override;
|
Buffer *CreateBuffer(size_t size, uint32_t usageFlags) override;
|
||||||
Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc) override;
|
Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) override;
|
||||||
InputLayout *CreateInputLayout(const InputLayoutDesc &desc) override;
|
InputLayout *CreateInputLayout(const InputLayoutDesc &desc) override;
|
||||||
Texture *CreateTexture(const TextureDesc &desc) override;
|
Texture *CreateTexture(const TextureDesc &desc) override;
|
||||||
|
|
||||||
|
@ -692,7 +692,7 @@ D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, ID
|
||||||
D3D9Context::~D3D9Context() {
|
D3D9Context::~D3D9Context() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderModule *D3D9Context::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t size, const std::string &tag) {
|
ShaderModule *D3D9Context::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t size, const char *tag) {
|
||||||
D3D9ShaderModule *shader = new D3D9ShaderModule(stage, tag);
|
D3D9ShaderModule *shader = new D3D9ShaderModule(stage, tag);
|
||||||
if (shader->Compile(device_, data, size)) {
|
if (shader->Compile(device_, data, size)) {
|
||||||
return shader;
|
return shader;
|
||||||
|
@ -702,15 +702,15 @@ ShaderModule *D3D9Context::CreateShaderModule(ShaderStage stage, ShaderLanguage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *D3D9Context::CreateGraphicsPipeline(const PipelineDesc &desc) {
|
Pipeline *D3D9Context::CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) {
|
||||||
if (!desc.shaders.size()) {
|
if (!desc.shaders.size()) {
|
||||||
ERROR_LOG(G3D, "Pipeline requires at least one shader");
|
ERROR_LOG(G3D, "Pipeline %s requires at least one shader", tag);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
D3D9Pipeline *pipeline = new D3D9Pipeline();
|
D3D9Pipeline *pipeline = new D3D9Pipeline();
|
||||||
for (auto iter : desc.shaders) {
|
for (auto iter : desc.shaders) {
|
||||||
if (!iter) {
|
if (!iter) {
|
||||||
ERROR_LOG(G3D, "NULL shader passed to CreateGraphicsPipeline");
|
ERROR_LOG(G3D, "NULL shader passed to CreateGraphicsPipeline(%s)", tag);
|
||||||
delete pipeline;
|
delete pipeline;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,9 +336,9 @@ public:
|
||||||
BlendState *CreateBlendState(const BlendStateDesc &desc) override;
|
BlendState *CreateBlendState(const BlendStateDesc &desc) override;
|
||||||
SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override;
|
SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override;
|
||||||
RasterState *CreateRasterState(const RasterStateDesc &desc) override;
|
RasterState *CreateRasterState(const RasterStateDesc &desc) override;
|
||||||
Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc) override;
|
Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) override;
|
||||||
InputLayout *CreateInputLayout(const InputLayoutDesc &desc) override;
|
InputLayout *CreateInputLayout(const InputLayoutDesc &desc) override;
|
||||||
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag) override;
|
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) override;
|
||||||
|
|
||||||
Texture *CreateTexture(const TextureDesc &desc) override;
|
Texture *CreateTexture(const TextureDesc &desc) override;
|
||||||
Buffer *CreateBuffer(size_t size, uint32_t usageFlags) override;
|
Buffer *CreateBuffer(size_t size, uint32_t usageFlags) override;
|
||||||
|
@ -1079,7 +1079,7 @@ void OpenGLContext::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t off
|
||||||
renderManager_.BufferSubdata(buf->buffer_, offset, size, dataCopy);
|
renderManager_.BufferSubdata(buf->buffer_, offset, size, dataCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc) {
|
Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) {
|
||||||
if (!desc.shaders.size()) {
|
if (!desc.shaders.size()) {
|
||||||
ERROR_LOG(G3D, "Pipeline requires at least one shader");
|
ERROR_LOG(G3D, "Pipeline requires at least one shader");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1099,7 +1099,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc) {
|
||||||
iter->AddRef();
|
iter->AddRef();
|
||||||
pipeline->shaders.push_back(static_cast<OpenGLShaderModule *>(iter));
|
pipeline->shaders.push_back(static_cast<OpenGLShaderModule *>(iter));
|
||||||
} else {
|
} else {
|
||||||
ERROR_LOG(G3D, "ERROR: Tried to create graphics pipeline with a null shader module");
|
ERROR_LOG(G3D, "ERROR: Tried to create graphics pipeline %s with a null shader module", tag);
|
||||||
delete pipeline;
|
delete pipeline;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1118,7 +1118,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc) {
|
||||||
pipeline->inputLayout = (OpenGLInputLayout *)desc.inputLayout;
|
pipeline->inputLayout = (OpenGLInputLayout *)desc.inputLayout;
|
||||||
return pipeline;
|
return pipeline;
|
||||||
} else {
|
} else {
|
||||||
ERROR_LOG(G3D, "Failed to create pipeline - shaders failed to link");
|
ERROR_LOG(G3D, "Failed to create pipeline %s - shaders failed to link", tag);
|
||||||
delete pipeline;
|
delete pipeline;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1163,7 +1163,7 @@ void OpenGLContext::ApplySamplers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderModule *OpenGLContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag) {
|
ShaderModule *OpenGLContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) {
|
||||||
OpenGLShaderModule *shader = new OpenGLShaderModule(&renderManager_, stage, tag);
|
OpenGLShaderModule *shader = new OpenGLShaderModule(&renderManager_, stage, tag);
|
||||||
if (shader->Compile(&renderManager_, language, data, dataSize)) {
|
if (shader->Compile(&renderManager_, language, data, dataSize)) {
|
||||||
return shader;
|
return shader;
|
||||||
|
|
|
@ -219,7 +219,7 @@ bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, con
|
||||||
std::vector<uint32_t> spirv;
|
std::vector<uint32_t> spirv;
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
if (!GLSLtoSPV(vkstage_, source_.c_str(), GLSLVariant::VULKAN, spirv, &errorMessage)) {
|
if (!GLSLtoSPV(vkstage_, source_.c_str(), GLSLVariant::VULKAN, spirv, &errorMessage)) {
|
||||||
WARN_LOG(G3D, "Shader compile to module failed: %s", errorMessage.c_str());
|
WARN_LOG(G3D, "Shader compile to module failed (%s): %s", tag_.c_str(), errorMessage.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, con
|
||||||
if (vulkan->CreateShaderModule(spirv, &module_, vkstage_ == VK_SHADER_STAGE_VERTEX_BIT ? "thin3d_vs" : "thin3d_fs")) {
|
if (vulkan->CreateShaderModule(spirv, &module_, vkstage_ == VK_SHADER_STAGE_VERTEX_BIT ? "thin3d_vs" : "thin3d_fs")) {
|
||||||
ok_ = true;
|
ok_ = true;
|
||||||
} else {
|
} else {
|
||||||
WARN_LOG(G3D, "vkCreateShaderModule failed");
|
WARN_LOG(G3D, "vkCreateShaderModule failed (%s)", tag_.c_str());
|
||||||
ok_ = false;
|
ok_ = false;
|
||||||
}
|
}
|
||||||
return ok_;
|
return ok_;
|
||||||
|
@ -384,8 +384,8 @@ public:
|
||||||
InputLayout *CreateInputLayout(const InputLayoutDesc &desc) override;
|
InputLayout *CreateInputLayout(const InputLayoutDesc &desc) override;
|
||||||
SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override;
|
SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override;
|
||||||
RasterState *CreateRasterState(const RasterStateDesc &desc) override;
|
RasterState *CreateRasterState(const RasterStateDesc &desc) override;
|
||||||
Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc) override;
|
Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) override;
|
||||||
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag) override;
|
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) override;
|
||||||
|
|
||||||
Texture *CreateTexture(const TextureDesc &desc) override;
|
Texture *CreateTexture(const TextureDesc &desc) override;
|
||||||
Buffer *CreateBuffer(size_t size, uint32_t usageFlags) override;
|
Buffer *CreateBuffer(size_t size, uint32_t usageFlags) override;
|
||||||
|
@ -1039,7 +1039,7 @@ VkDescriptorSet VKContext::GetOrCreateDescriptorSet(VkBuffer buf) {
|
||||||
return descSet;
|
return descSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc) {
|
Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) {
|
||||||
VKInputLayout *input = (VKInputLayout *)desc.inputLayout;
|
VKInputLayout *input = (VKInputLayout *)desc.inputLayout;
|
||||||
VKBlendState *blend = (VKBlendState *)desc.blend;
|
VKBlendState *blend = (VKBlendState *)desc.blend;
|
||||||
VKDepthStencilState *depth = (VKDepthStencilState *)desc.depthStencil;
|
VKDepthStencilState *depth = (VKDepthStencilState *)desc.depthStencil;
|
||||||
|
@ -1050,7 +1050,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc) {
|
||||||
pipelineFlags |= PIPELINE_FLAG_USES_DEPTH_STENCIL;
|
pipelineFlags |= PIPELINE_FLAG_USES_DEPTH_STENCIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
VKPipeline *pipeline = new VKPipeline(vulkan_, desc.uniformDesc ? desc.uniformDesc->uniformBufferSize : 16 * sizeof(float), (PipelineFlags)pipelineFlags, "thin3d");
|
VKPipeline *pipeline = new VKPipeline(vulkan_, desc.uniformDesc ? desc.uniformDesc->uniformBufferSize : 16 * sizeof(float), (PipelineFlags)pipelineFlags, tag);
|
||||||
|
|
||||||
VKRGraphicsPipelineDesc &gDesc = pipeline->vkrDesc;
|
VKRGraphicsPipelineDesc &gDesc = pipeline->vkrDesc;
|
||||||
|
|
||||||
|
@ -1122,7 +1122,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc) {
|
||||||
VkPipelineRasterizationStateCreateInfo rs{ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO };
|
VkPipelineRasterizationStateCreateInfo rs{ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO };
|
||||||
raster->ToVulkan(&gDesc.rs);
|
raster->ToVulkan(&gDesc.rs);
|
||||||
|
|
||||||
pipeline->pipeline = renderManager_.CreateGraphicsPipeline(&gDesc, 1 << RP_TYPE_BACKBUFFER, "thin3d");
|
pipeline->pipeline = renderManager_.CreateGraphicsPipeline(&gDesc, 1 << RP_TYPE_BACKBUFFER, tag ? tag : "thin3d");
|
||||||
|
|
||||||
if (desc.uniformDesc) {
|
if (desc.uniformDesc) {
|
||||||
pipeline->dynamicUniformSize = (int)desc.uniformDesc->uniformBufferSize;
|
pipeline->dynamicUniformSize = (int)desc.uniformDesc->uniformBufferSize;
|
||||||
|
@ -1280,12 +1280,12 @@ void VKContext::BindTextures(int start, int count, Texture **textures) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderModule *VKContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t size, const std::string &tag) {
|
ShaderModule *VKContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t size, const char *tag) {
|
||||||
VKShaderModule *shader = new VKShaderModule(stage, tag);
|
VKShaderModule *shader = new VKShaderModule(stage, tag);
|
||||||
if (shader->Compile(vulkan_, language, data, size)) {
|
if (shader->Compile(vulkan_, language, data, size)) {
|
||||||
return shader;
|
return shader;
|
||||||
} else {
|
} else {
|
||||||
ERROR_LOG(G3D, "Failed to compile shader:\n%s", (const char *)LineNumberString((const char *)data).c_str());
|
ERROR_LOG(G3D, "Failed to compile shader %s:\n%s", tag, (const char *)LineNumberString((const char *)data).c_str());
|
||||||
shader->Release();
|
shader->Release();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,8 +616,8 @@ public:
|
||||||
virtual RasterState *CreateRasterState(const RasterStateDesc &desc) = 0;
|
virtual RasterState *CreateRasterState(const RasterStateDesc &desc) = 0;
|
||||||
// virtual ComputePipeline CreateComputePipeline(const ComputePipelineDesc &desc) = 0
|
// virtual ComputePipeline CreateComputePipeline(const ComputePipelineDesc &desc) = 0
|
||||||
virtual InputLayout *CreateInputLayout(const InputLayoutDesc &desc) = 0;
|
virtual InputLayout *CreateInputLayout(const InputLayoutDesc &desc) = 0;
|
||||||
virtual ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag = "thin3d") = 0;
|
virtual ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag = "thin3d") = 0;
|
||||||
virtual Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc) = 0;
|
virtual Pipeline *CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) = 0;
|
||||||
|
|
||||||
// Note that these DO NOT AddRef so you must not ->Release presets unless you manually AddRef them.
|
// Note that these DO NOT AddRef so you must not ->Release presets unless you manually AddRef them.
|
||||||
ShaderModule *GetVshaderPreset(VertexShaderPreset preset) { return vsPresets_[preset]; }
|
ShaderModule *GetVshaderPreset(VertexShaderPreset preset) { return vsPresets_[preset]; }
|
||||||
|
|
|
@ -64,6 +64,7 @@ Draw2DPipelineInfo GenerateDraw2DCopyColorFs(ShaderWriter &writer) {
|
||||||
writer.EndFSMain("outColor", FSFLAG_NONE);
|
writer.EndFSMain("outColor", FSFLAG_NONE);
|
||||||
|
|
||||||
return Draw2DPipelineInfo{
|
return Draw2DPipelineInfo{
|
||||||
|
"draw2d_copy_color",
|
||||||
RASTER_COLOR,
|
RASTER_COLOR,
|
||||||
RASTER_COLOR,
|
RASTER_COLOR,
|
||||||
};
|
};
|
||||||
|
@ -77,6 +78,7 @@ Draw2DPipelineInfo GenerateDraw2DCopyDepthFs(ShaderWriter &writer) {
|
||||||
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
||||||
|
|
||||||
return Draw2DPipelineInfo{
|
return Draw2DPipelineInfo{
|
||||||
|
"draw2d_copy_depth",
|
||||||
RASTER_DEPTH,
|
RASTER_DEPTH,
|
||||||
RASTER_DEPTH,
|
RASTER_DEPTH,
|
||||||
};
|
};
|
||||||
|
@ -95,6 +97,7 @@ Draw2DPipelineInfo GenerateDraw2D565ToDepthFs(ShaderWriter &writer) {
|
||||||
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
||||||
|
|
||||||
return Draw2DPipelineInfo{
|
return Draw2DPipelineInfo{
|
||||||
|
"draw2d_565_to_depth",
|
||||||
RASTER_COLOR,
|
RASTER_COLOR,
|
||||||
RASTER_DEPTH,
|
RASTER_DEPTH,
|
||||||
};
|
};
|
||||||
|
@ -119,6 +122,7 @@ Draw2DPipelineInfo GenerateDraw2D565ToDepthDeswizzleFs(ShaderWriter &writer) {
|
||||||
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
writer.EndFSMain("outColor", FSFLAG_WRITEDEPTH);
|
||||||
|
|
||||||
return Draw2DPipelineInfo{
|
return Draw2DPipelineInfo{
|
||||||
|
"draw2d_565_to_depth_deswizzle",
|
||||||
RASTER_COLOR,
|
RASTER_COLOR,
|
||||||
RASTER_DEPTH
|
RASTER_DEPTH
|
||||||
};
|
};
|
||||||
|
@ -237,7 +241,7 @@ Draw2DPipeline *Draw2D::Create2DPipeline(std::function<Draw2DPipelineInfo (Shade
|
||||||
info.samplers.is_empty() ? samplers : info.samplers,
|
info.samplers.is_empty() ? samplers : info.samplers,
|
||||||
};
|
};
|
||||||
|
|
||||||
Draw::Pipeline *pipeline = draw_->CreateGraphicsPipeline(pipelineDesc);
|
Draw::Pipeline *pipeline = draw_->CreateGraphicsPipeline(pipelineDesc, info.tag);
|
||||||
|
|
||||||
fs->Release();
|
fs->Release();
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ inline RasterChannel Draw2DSourceChannel(Draw2DShader shader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Draw2DPipelineInfo {
|
struct Draw2DPipelineInfo {
|
||||||
|
const char *tag;
|
||||||
RasterChannel readChannel;
|
RasterChannel readChannel;
|
||||||
RasterChannel writeChannel;
|
RasterChannel writeChannel;
|
||||||
Slice<SamplerDef> samplers;
|
Slice<SamplerDef> samplers;
|
||||||
|
|
|
@ -439,7 +439,7 @@ Draw::Pipeline *PresentationCommon::CreatePipeline(std::vector<Draw::ShaderModul
|
||||||
RasterState *rasterNoCull = draw_->CreateRasterState({});
|
RasterState *rasterNoCull = draw_->CreateRasterState({});
|
||||||
|
|
||||||
PipelineDesc pipelineDesc{ Primitive::TRIANGLE_LIST, shaders, inputLayout, depth, blendstateOff, rasterNoCull, uniformDesc };
|
PipelineDesc pipelineDesc{ Primitive::TRIANGLE_LIST, shaders, inputLayout, depth, blendstateOff, rasterNoCull, uniformDesc };
|
||||||
Pipeline *pipeline = draw_->CreateGraphicsPipeline(pipelineDesc);
|
Pipeline *pipeline = draw_->CreateGraphicsPipeline(pipelineDesc, "presentation");
|
||||||
|
|
||||||
inputLayout->Release();
|
inputLayout->Release();
|
||||||
depth->Release();
|
depth->Release();
|
||||||
|
|
|
@ -185,6 +185,7 @@ Draw2DPipelineInfo GenerateReinterpretFragmentShader(ShaderWriter &writer, GEBuf
|
||||||
writer.EndFSMain("outColor", FSFLAG_NONE);
|
writer.EndFSMain("outColor", FSFLAG_NONE);
|
||||||
|
|
||||||
return Draw2DPipelineInfo{
|
return Draw2DPipelineInfo{
|
||||||
|
"reinterpret",
|
||||||
RASTER_COLOR,
|
RASTER_COLOR,
|
||||||
RASTER_COLOR,
|
RASTER_COLOR,
|
||||||
};
|
};
|
||||||
|
|
|
@ -237,7 +237,7 @@ bool FramebufferManagerCommon::PerformStencilUpload(u32 addr, int size, StencilU
|
||||||
{ stencilUploadVs, stencilUploadFs },
|
{ stencilUploadVs, stencilUploadFs },
|
||||||
inputLayout, stencilWrite, blendOff, rasterNoCull, &stencilUBDesc,
|
inputLayout, stencilWrite, blendOff, rasterNoCull, &stencilUBDesc,
|
||||||
};
|
};
|
||||||
stencilUploadPipeline_ = draw_->CreateGraphicsPipeline(stencilWriteDesc);
|
stencilUploadPipeline_ = draw_->CreateGraphicsPipeline(stencilWriteDesc, "stencil_upload");
|
||||||
_assert_(stencilUploadPipeline_);
|
_assert_(stencilUploadPipeline_);
|
||||||
|
|
||||||
delete[] fsCode;
|
delete[] fsCode;
|
||||||
|
|
|
@ -213,6 +213,7 @@ Draw2DPipeline *TextureShaderCache::GetDepalettizeShader(uint32_t clutMode, GETe
|
||||||
Draw2DPipeline *ts = draw2D_->Create2DPipeline([=](ShaderWriter &writer) -> Draw2DPipelineInfo {
|
Draw2DPipeline *ts = draw2D_->Create2DPipeline([=](ShaderWriter &writer) -> Draw2DPipelineInfo {
|
||||||
GenerateDepalFs(writer, config);
|
GenerateDepalFs(writer, config);
|
||||||
return Draw2DPipelineInfo{
|
return Draw2DPipelineInfo{
|
||||||
|
"depal",
|
||||||
config.bufferFormat == GE_FORMAT_DEPTH16 ? RASTER_DEPTH : RASTER_COLOR,
|
config.bufferFormat == GE_FORMAT_DEPTH16 ? RASTER_DEPTH : RASTER_COLOR,
|
||||||
RASTER_COLOR,
|
RASTER_COLOR,
|
||||||
samplers
|
samplers
|
||||||
|
|
|
@ -390,39 +390,39 @@ void GPUDriverTestScreen::DiscardTest() {
|
||||||
{ draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D), discardFragShader_ },
|
{ draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D), discardFragShader_ },
|
||||||
inputLayout, depthStencilWrite, blendOffNoColor, rasterNoCull, &vsColBufDesc,
|
inputLayout, depthStencilWrite, blendOffNoColor, rasterNoCull, &vsColBufDesc,
|
||||||
};
|
};
|
||||||
discardWriteDepthStencil_ = draw->CreateGraphicsPipeline(discardDesc);
|
discardWriteDepthStencil_ = draw->CreateGraphicsPipeline(discardDesc, "test");
|
||||||
discardDesc.depthStencil = depthWrite;
|
discardDesc.depthStencil = depthWrite;
|
||||||
discardWriteDepth_ = draw->CreateGraphicsPipeline(discardDesc);
|
discardWriteDepth_ = draw->CreateGraphicsPipeline(discardDesc, "test");
|
||||||
discardDesc.depthStencil = stencilWrite;
|
discardDesc.depthStencil = stencilWrite;
|
||||||
discardWriteStencil_ = draw->CreateGraphicsPipeline(discardDesc);
|
discardWriteStencil_ = draw->CreateGraphicsPipeline(discardDesc, "test");
|
||||||
|
|
||||||
PipelineDesc testDesc{
|
PipelineDesc testDesc{
|
||||||
Primitive::TRIANGLE_LIST,
|
Primitive::TRIANGLE_LIST,
|
||||||
{ draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D), draw->GetFshaderPreset(FS_TEXTURE_COLOR_2D) },
|
{ draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D), draw->GetFshaderPreset(FS_TEXTURE_COLOR_2D) },
|
||||||
inputLayout, stencilEqual, blendOff, rasterNoCull, &vsColBufDesc,
|
inputLayout, stencilEqual, blendOff, rasterNoCull, &vsColBufDesc,
|
||||||
};
|
};
|
||||||
drawTestStencilEqual_ = draw->CreateGraphicsPipeline(testDesc);
|
drawTestStencilEqual_ = draw->CreateGraphicsPipeline(testDesc, "test");
|
||||||
|
|
||||||
testDesc.depthStencil = stencilEqualDepthAlways;
|
testDesc.depthStencil = stencilEqualDepthAlways;
|
||||||
drawTestStencilEqualDepthAlways_ = draw->CreateGraphicsPipeline(testDesc);
|
drawTestStencilEqualDepthAlways_ = draw->CreateGraphicsPipeline(testDesc, "test");
|
||||||
|
|
||||||
testDesc.depthStencil = stencilNotEqual;
|
testDesc.depthStencil = stencilNotEqual;
|
||||||
drawTestStencilNotEqual_ = draw->CreateGraphicsPipeline(testDesc);
|
drawTestStencilNotEqual_ = draw->CreateGraphicsPipeline(testDesc, "test");
|
||||||
|
|
||||||
testDesc.depthStencil = stenciNotEqualDepthAlways;
|
testDesc.depthStencil = stenciNotEqualDepthAlways;
|
||||||
drawTestStencilNotEqualDepthAlways_ = draw->CreateGraphicsPipeline(testDesc);
|
drawTestStencilNotEqualDepthAlways_ = draw->CreateGraphicsPipeline(testDesc, "test");
|
||||||
|
|
||||||
testDesc.depthStencil = stencilAlwaysDepthTestGreater;
|
testDesc.depthStencil = stencilAlwaysDepthTestGreater;
|
||||||
drawTestStencilAlwaysDepthGreater_ = draw->CreateGraphicsPipeline(testDesc);
|
drawTestStencilAlwaysDepthGreater_ = draw->CreateGraphicsPipeline(testDesc, "test");
|
||||||
|
|
||||||
testDesc.depthStencil = stencilAlwaysDepthTestLessEqual;
|
testDesc.depthStencil = stencilAlwaysDepthTestLessEqual;
|
||||||
drawTestStencilAlwaysDepthLessEqual_ = draw->CreateGraphicsPipeline(testDesc);
|
drawTestStencilAlwaysDepthLessEqual_ = draw->CreateGraphicsPipeline(testDesc, "test");
|
||||||
|
|
||||||
testDesc.depthStencil = depthTestGreater;
|
testDesc.depthStencil = depthTestGreater;
|
||||||
drawTestDepthGreater_ = draw->CreateGraphicsPipeline(testDesc);
|
drawTestDepthGreater_ = draw->CreateGraphicsPipeline(testDesc, "test");
|
||||||
|
|
||||||
testDesc.depthStencil = depthTestLessEqual;
|
testDesc.depthStencil = depthTestLessEqual;
|
||||||
drawTestDepthLessEqual_ = draw->CreateGraphicsPipeline(testDesc);
|
drawTestDepthLessEqual_ = draw->CreateGraphicsPipeline(testDesc, "test");
|
||||||
|
|
||||||
inputLayout->Release();
|
inputLayout->Release();
|
||||||
blendOff->Release();
|
blendOff->Release();
|
||||||
|
@ -557,14 +557,14 @@ void GPUDriverTestScreen::ShaderTest() {
|
||||||
{ adrenoLogicDiscardVertShader_, adrenoLogicDiscardFragShader_ },
|
{ adrenoLogicDiscardVertShader_, adrenoLogicDiscardFragShader_ },
|
||||||
inputLayout, depthStencilOff, blendOff, rasterNoCull, &vsColBufDesc,
|
inputLayout, depthStencilOff, blendOff, rasterNoCull, &vsColBufDesc,
|
||||||
};
|
};
|
||||||
adrenoLogicDiscardPipeline_ = draw->CreateGraphicsPipeline(adrenoLogicDiscardDesc);
|
adrenoLogicDiscardPipeline_ = draw->CreateGraphicsPipeline(adrenoLogicDiscardDesc, "test");
|
||||||
|
|
||||||
PipelineDesc flatDesc{
|
PipelineDesc flatDesc{
|
||||||
Primitive::TRIANGLE_LIST,
|
Primitive::TRIANGLE_LIST,
|
||||||
{ flatVertShader_, flatFragShader_ },
|
{ flatVertShader_, flatFragShader_ },
|
||||||
inputLayout, depthStencilOff, blendOff, rasterNoCull, &vsColBufDesc,
|
inputLayout, depthStencilOff, blendOff, rasterNoCull, &vsColBufDesc,
|
||||||
};
|
};
|
||||||
flatShadingPipeline_ = draw->CreateGraphicsPipeline(flatDesc);
|
flatShadingPipeline_ = draw->CreateGraphicsPipeline(flatDesc, "test");
|
||||||
|
|
||||||
inputLayout->Release();
|
inputLayout->Release();
|
||||||
blendOff->Release();
|
blendOff->Release();
|
||||||
|
|
|
@ -950,13 +950,13 @@ bool CreateGlobalPipelines() {
|
||||||
inputLayout, depth, blendNormal, rasterNoCull, &vsTexColBufDesc,
|
inputLayout, depth, blendNormal, rasterNoCull, &vsTexColBufDesc,
|
||||||
};
|
};
|
||||||
|
|
||||||
colorPipeline = g_draw->CreateGraphicsPipeline(colorDesc);
|
colorPipeline = g_draw->CreateGraphicsPipeline(colorDesc, "global_color");
|
||||||
if (!colorPipeline) {
|
if (!colorPipeline) {
|
||||||
// Something really critical is wrong, don't care much about correct releasing of the states.
|
// Something really critical is wrong, don't care much about correct releasing of the states.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
texColorPipeline = g_draw->CreateGraphicsPipeline(texColorDesc);
|
texColorPipeline = g_draw->CreateGraphicsPipeline(texColorDesc, "global_texcolor");
|
||||||
if (!texColorPipeline) {
|
if (!texColorPipeline) {
|
||||||
// Something really critical is wrong, don't care much about correct releasing of the states.
|
// Something really critical is wrong, don't care much about correct releasing of the states.
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue