Skip to content

Commit

Permalink
gfx msaa && memoryless (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluesky013 authored Jul 11, 2023
1 parent 242cc4e commit 72041a9
Show file tree
Hide file tree
Showing 91 changed files with 1,302 additions and 962 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/native-compile-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
jobs:
compile_windows:
name: "Windows"
if:
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: windows-2019
steps:
Expand All @@ -24,9 +24,6 @@ jobs:
run: |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js`
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external
- name: Install deps
run: |
choco install --forcex86 vulkan-sdk
- name: Compile win64
shell: bash
env:
Expand Down Expand Up @@ -55,7 +52,7 @@ jobs:
compile_android_minimal:
name: "Android Minimal"
if:
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -125,7 +122,7 @@ jobs:
compile_android:
name: "Android"
if:
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -198,7 +195,7 @@ jobs:
compile_mac_x86_64:
name: "MacOS x86_64"
if:
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -247,7 +244,7 @@ jobs:
compile_mac_arm64:
name: "MacOS arm64"
if:
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -293,13 +290,13 @@ jobs:
compile_iOS:
name: "iOS"
if:
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: macos-11
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 12.4
xcode-version: 12.4
- uses: actions/checkout@v2
- name: Download external libraries
shell: bash
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/native-simulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
jobs:
win_gen_simulator:
runs-on: windows-2019
if:
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
name: Windows
defaults:
Expand All @@ -31,10 +31,6 @@ jobs:
run: |
EXT_VERSION=`node ../.github/workflows/get-native-external-version.js`
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external external
- name: install vulkan-sdk
run: |
choco install vulkan-sdk
- name: gen simulator
run: |
gulp gen-simulator
Expand Down
23 changes: 16 additions & 7 deletions cocos/gfx/base/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export enum Feature {
SUBPASS_COLOR_INPUT,
SUBPASS_DEPTH_STENCIL_INPUT,
RASTERIZATION_ORDER_COHERENT,
MULTI_SAMPLE_RESOLVE_DEPTH_STENCIL,
COUNT,
}

Expand Down Expand Up @@ -405,6 +406,7 @@ export enum TextureFlagBit {
GENERAL_LAYOUT = 0x2, // For inout framebuffer attachments
EXTERNAL_OES = 0x4, // External oes texture
EXTERNAL_NORMAL = 0x8, // External normal texture
LAZILY_ALLOCATED = 0x10 // Try lazily allocated mode.
}

export enum FormatFeatureBit {
Expand All @@ -417,10 +419,13 @@ export enum FormatFeatureBit {
}

export enum SampleCount {
ONE, // Single sample
MULTIPLE_PERFORMANCE, // Multiple samples prioritizing performance over quality
MULTIPLE_BALANCE, // Multiple samples leveraging both quality and performance
MULTIPLE_QUALITY, // Multiple samples prioritizing quality over performance
X1 = 0x01,
X2 = 0x02,
X4 = 0x04,
X8 = 0x08,
X16 = 0x10,
X32 = 0x20,
X64 = 0x40
}

export enum VsyncMode {
Expand Down Expand Up @@ -1171,7 +1176,7 @@ export class TextureInfo {
public flags: TextureFlags = TextureFlagBit.NONE,
public layerCount: number = 1,
public levelCount: number = 1,
public samples: SampleCount = SampleCount.ONE,
public samples: SampleCount = SampleCount.X1,
public depth: number = 1,
public externalRes: number = 0,
) {}
Expand Down Expand Up @@ -1513,7 +1518,7 @@ export class ColorAttachment {

constructor (
public format: Format = Format.UNKNOWN,
public sampleCount: SampleCount = SampleCount.ONE,
public sampleCount: SampleCount = SampleCount.X1,
public loadOp: LoadOp = LoadOp.CLEAR,
public storeOp: StoreOp = StoreOp.STORE,
public barrier: GeneralBarrier = null!,
Expand All @@ -1534,7 +1539,7 @@ export class DepthStencilAttachment {

constructor (
public format: Format = Format.UNKNOWN,
public sampleCount: SampleCount = SampleCount.ONE,
public sampleCount: SampleCount = SampleCount.X1,
public depthLoadOp: LoadOp = LoadOp.CLEAR,
public depthStoreOp: StoreOp = StoreOp.STORE,
public stencilLoadOp: LoadOp = LoadOp.CLEAR,
Expand Down Expand Up @@ -1608,13 +1613,15 @@ export class RenderPassInfo {
constructor (
public colorAttachments: ColorAttachment[] = [],
public depthStencilAttachment: DepthStencilAttachment = new DepthStencilAttachment(),
public depthStencilResolveAttachment: DepthStencilAttachment = new DepthStencilAttachment(),
public subpasses: SubpassInfo[] = [],
public dependencies: SubpassDependency[] = [],
) {}

public copy (info: Readonly<RenderPassInfo>) {
deepCopy(this.colorAttachments, info.colorAttachments, ColorAttachment);
this.depthStencilAttachment.copy(info.depthStencilAttachment);
this.depthStencilResolveAttachment.copy(info.depthStencilResolveAttachment);
deepCopy(this.subpasses, info.subpasses, SubpassInfo);
deepCopy(this.dependencies, info.dependencies, SubpassDependency);
return this;
Expand Down Expand Up @@ -1703,12 +1710,14 @@ export class FramebufferInfo {
public renderPass: RenderPass = null!,
public colorTextures: Texture[] = [],
public depthStencilTexture: Texture | null = null,
public depthStencilResolveTexture: Texture | null = null,
) {}

public copy (info: Readonly<FramebufferInfo>) {
this.renderPass = info.renderPass;
this.colorTextures = info.colorTextures.slice();
this.depthStencilTexture = info.depthStencilTexture;
this.depthStencilResolveTexture = info.depthStencilResolveTexture;
return this;
}
}
Expand Down
15 changes: 13 additions & 2 deletions cocos/gfx/base/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
ShaderInfo, InputAssemblerInfo, RenderPassInfo, FramebufferInfo, DescriptorSetLayoutInfo, PipelineLayoutInfo,
QueueInfo, BufferTextureCopy, DeviceInfo, DeviceCaps, GeneralBarrierInfo, TextureBarrierInfo, BufferBarrierInfo,
SwapchainInfo, BindingMappingInfo, Format, FormatFeature, TextureType, TextureUsageBit,
TextureFlagBit, Offset, Extent, SampleCount, TextureSubresLayers,
TextureFlagBit, Offset, Extent, SampleCount, TextureSubresLayers, TextureUsage, TextureFlags,
} from './define';
import { Buffer } from './buffer';
import { CommandBuffer } from './command-buffer';
Expand Down Expand Up @@ -359,6 +359,17 @@ export abstract class Device {
* @param format The GFX format to be queried.
*/
public enableAutoBarrier (en: boolean) {}

/**
* @en Get maximum supported sample count.
* @zh 获取最大可支持的 Samples 参数
* @param format The GFX texture format.
* @param usage The GFX texture usage.
* @param flags The GFX texture create flags.
*/
public getMaxSampleCount (format: Format, usage: TextureUsage, flags: TextureFlags): SampleCount {
return SampleCount.X1;
}
}

export class DefaultResource {
Expand Down Expand Up @@ -413,7 +424,7 @@ export class DefaultResource {
2, 2,
TextureFlagBit.NONE,
1, 1,
SampleCount.ONE,
SampleCount.X1,
2,
));
const copyRegion = new BufferTextureCopy(0, 0, 0, new Offset(0, 0, 0), new Extent(2, 2, 2), new TextureSubresLayers(0, 0, 1));
Expand Down
Loading

0 comments on commit 72041a9

Please sign in to comment.