[vk, gl, spv] Opcode Promotion path emulation

This commit is contained in:
CamilleLaVey 2025-11-29 14:06:18 -04:00 committed by lizzie
parent f6f0690544
commit 1e9cb290ca
11 changed files with 394 additions and 81 deletions

View file

@ -17,6 +17,7 @@
#include "common/div_ceil.h"
#include "shader_recompiler/backend/spirv/emit_spirv.h"
#include "shader_recompiler/backend/spirv/spirv_emit_context.h"
#include "shader_recompiler/backend/spirv/texture_helpers.h"
namespace Shader::Backend::SPIRV {
namespace {
@ -47,7 +48,8 @@ Id ImageType(EmitContext& ctx, const TextureDescriptor& desc, Id sampled_type) {
const spv::ImageFormat format{spv::ImageFormat::Unknown};
const bool depth{desc.is_depth};
const bool ms{desc.is_multisample};
switch (desc.type) {
const TextureType type{EffectiveTextureType(ctx.profile, desc.type)};
switch (type) {
case TextureType::Color1D:
return ctx.TypeImage(sampled_type, spv::Dim::Dim1D, depth, false, false, 1, format);
case TextureType::ColorArray1D:
@ -93,7 +95,8 @@ spv::ImageFormat GetImageFormat(ImageFormat format) {
Id ImageType(EmitContext& ctx, const ImageDescriptor& desc, Id sampled_type) {
const spv::ImageFormat format{GetImageFormat(desc.format)};
switch (desc.type) {
const TextureType type{EffectiveTextureType(ctx.profile, desc.type)};
switch (type) {
case TextureType::Color1D:
return ctx.TypeImage(sampled_type, spv::Dim::Dim1D, false, false, false, 2, format);
case TextureType::ColorArray1D: