GPU: Improve the do_static_compilation_ check coverage
Since we use StaticShader now in many places, the check is often bypassed. Ensure that any compiled shader is either marked as static or as a GPUPass. Pull Request: https://projects.blender.org/blender/blender/pulls/144950
This commit is contained in:
@@ -46,6 +46,7 @@ struct GPUCodegenCreateInfo : ShaderCreateInfo {
|
||||
|
||||
GPUCodegenCreateInfo(const char *name) : ShaderCreateInfo(name), info_name_(name)
|
||||
{
|
||||
is_codegen_ = true;
|
||||
/* Base class is always initialized first, so we need to update the name_ pointer here. */
|
||||
name_ = info_name_.c_str();
|
||||
};
|
||||
|
||||
@@ -660,6 +660,7 @@ Shader *ShaderCompiler::compile(const shader::ShaderCreateInfo &info, bool is_ba
|
||||
|
||||
using namespace blender::gpu::shader;
|
||||
const_cast<ShaderCreateInfo &>(info).finalize();
|
||||
BLI_assert(info.do_static_compilation_ || info.is_codegen_);
|
||||
|
||||
TimePoint start_time;
|
||||
|
||||
|
||||
@@ -687,6 +687,8 @@ struct ShaderCreateInfo {
|
||||
StringRefNull name_;
|
||||
/** True if the shader is static and can be pre-compiled at compile time. */
|
||||
bool do_static_compilation_ = false;
|
||||
/** True if the shader comes from GPUCodegen. */
|
||||
bool is_codegen_ = false;
|
||||
/** If true, all additionally linked create info will be merged into this one. */
|
||||
bool finalized_ = false;
|
||||
/** If true, all resources will have an automatic location assigned. */
|
||||
|
||||
Reference in New Issue
Block a user