Skip to content

Commit

Permalink
test new lazy shader
Browse files Browse the repository at this point in the history
  • Loading branch information
OVOAOVO committed Oct 25, 2023
1 parent 2677d33 commit 43de71b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions Engine/Source/Runtime/Rendering/ParticleRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ namespace engine {

void ParticleRenderer::Init()
{
constexpr const char* particleTexture = "Textures/Particle.png";
m_particleTextureHandle = GetRenderContext()->CreateTexture(particleTexture);

GetRenderContext()->CreateUniform("s_texColor", bgfx::UniformType::Sampler);
GetRenderContext()->CreateProgram("ParticleProgram", "vs_particle.bin", "fs_particle.bin");
constexpr StringCrc ParticleProgram = StringCrc{ "ParticleProgram" };
GetRenderContext()->RegisterShaderProgram(ParticleProgram, { "vs_PBR", "fs_PBR" });
//GetRenderContext()->CreateProgram("ParticleProgram", "vs_particle.bin", "fs_particle.bin");
bgfx::setViewName(GetViewID(), "ParticleRenderer");
}

void ParticleRenderer::Warmup()
{

constexpr const char* particleTexture = "Textures/Particle.png";
m_particleTextureHandle = GetRenderContext()->CreateTexture(particleTexture);
GetRenderContext()->CreateUniform("s_texColor", bgfx::UniformType::Sampler);
GetRenderContext()->UploadShaderProgram("ParticleProgram");
}

void ParticleRenderer::UpdateView(const float* pViewMatrix, const float* pProjectionMatrix)
Expand Down Expand Up @@ -71,8 +72,7 @@ void ParticleRenderer::Render(float deltaTime)
BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) | BGFX_STATE_PT_TRISTRIP;
bgfx::setState(state);

constexpr StringCrc ParticleProgram("ParticleProgram");
bgfx::submit(GetViewID(), GetRenderContext()->GetProgram(ParticleProgram));
GetRenderContext()->Submit(GetViewID(), "ParticleProgram");
}
}

Expand Down

0 comments on commit 43de71b

Please sign in to comment.