mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 11:31:59 +08:00
remove deferred reflection shaders (#18281)
* remove deferred reflection shaders * fix test shader * remove reflectionTex
This commit is contained in:
@@ -154,41 +154,6 @@ void SubModel::initialize(RenderingSubMesh *subMesh, const SharedPassArray &pPas
|
||||
|
||||
const auto &passes = *_passes;
|
||||
_priority = pipeline::RenderPriority::DEFAULT;
|
||||
|
||||
// initialize resources for reflection material
|
||||
if (passes[0]->getPhase() == pipeline::getPhaseID("reflection")) {
|
||||
const auto *mainWindow = Root::getInstance()->getMainWindow();
|
||||
uint32_t texWidth = mainWindow->getWidth();
|
||||
uint32_t texHeight = mainWindow->getHeight();
|
||||
const uint32_t minSize = 512;
|
||||
if (texHeight < texWidth) {
|
||||
texWidth = minSize * texWidth / texHeight;
|
||||
texHeight = minSize;
|
||||
} else {
|
||||
texWidth = minSize;
|
||||
texHeight = minSize * texHeight / texWidth;
|
||||
}
|
||||
_reflectionTex = _device->createTexture(gfx::TextureInfo{
|
||||
gfx::TextureType::TEX2D,
|
||||
gfx::TextureUsageBit::STORAGE | gfx::TextureUsageBit::TRANSFER_SRC | gfx::TextureUsageBit::SAMPLED,
|
||||
gfx::Format::RGBA8,
|
||||
texWidth,
|
||||
texHeight,
|
||||
});
|
||||
_descriptorSet->bindTexture(pipeline::REFLECTIONTEXTURE::BINDING, _reflectionTex);
|
||||
|
||||
const gfx::SamplerInfo samplerInfo{
|
||||
gfx::Filter::LINEAR,
|
||||
gfx::Filter::LINEAR,
|
||||
gfx::Filter::NONE,
|
||||
gfx::Address::CLAMP,
|
||||
gfx::Address::CLAMP,
|
||||
gfx::Address::CLAMP,
|
||||
};
|
||||
_reflectionSampler = _device->getSampler(samplerInfo);
|
||||
_descriptorSet->bindSampler(pipeline::REFLECTIONTEXTURE::BINDING, _reflectionSampler);
|
||||
_descriptorSet->bindTexture(pipeline::REFLECTIONSTORAGE::BINDING, _reflectionTex);
|
||||
}
|
||||
}
|
||||
|
||||
void SubModel::destroy() {
|
||||
@@ -203,9 +168,6 @@ void SubModel::destroy() {
|
||||
_subMesh = nullptr;
|
||||
_passes.reset();
|
||||
_shaders.clear();
|
||||
|
||||
CC_SAFE_DESTROY_NULL(_reflectionTex);
|
||||
_reflectionSampler = nullptr;
|
||||
}
|
||||
|
||||
void SubModel::onPipelineStateChanged() {
|
||||
@@ -315,7 +277,7 @@ void SubModel::updateInstancedWorldMatrix(const Mat4 &mat, int32_t idx) {
|
||||
auto &v2 = ccstd::get<Float32Array>(attrs[idx + 1]);
|
||||
auto &v3 = ccstd::get<Float32Array>(attrs[idx + +2]);
|
||||
const uint32_t copyBytes = sizeof(float) * 3;
|
||||
auto *buffer = const_cast<uint8_t *>(v1.buffer()->getData());
|
||||
auto *buffer = v1.buffer()->getData();
|
||||
|
||||
uint8_t *dst = buffer + v1.byteOffset();
|
||||
memcpy(dst, mat.m, copyBytes);
|
||||
|
||||
Reference in New Issue
Block a user