mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 14:30:48 +00:00
Fullscreen Vulkan fixes
This commit includes the following changes: * When vid_fullscreen is 1, the game is now drawn centered in the screen instead of the top left corner, by modifying the viewport and scissor when drawing the world warp and UI render passes. * When vid_fullscreen is 1, the world view no longer has an incorrect size and/or aspect ratio. This was due to the world warp and UI render passes sampling from the whole color buffer instead of the restricted render area. To fix this, the postprocessing and world warp shaders now use unnormalized coordinates, corrected with the frame offset, and sample directly from the appropriate texels. * The game no longer outputs pixels which have not been written to, which are usually displayed black but may come out with undefined colors. For this, some output color attachments are cleared before drawing the final elements in the frame.
This commit is contained in:
parent
449776d3f6
commit
5fcfcd56b3
10 changed files with 274 additions and 154 deletions
|
@ -287,6 +287,8 @@ typedef struct
|
|||
|
||||
VkPipeline current_pipeline;
|
||||
qvkrenderpasstype_t current_renderpass;
|
||||
|
||||
qboolean refdef_changed;
|
||||
} vkstate_t;
|
||||
|
||||
extern vkconfig_t vk_config;
|
||||
|
|
|
@ -72,9 +72,12 @@ typedef enum
|
|||
S_ANISO_LINEAR = 5,
|
||||
S_ANISO_MIPMAP_NEAREST = 6,
|
||||
S_ANISO_MIPMAP_LINEAR = 7,
|
||||
S_SAMPLER_CNT = 8
|
||||
S_NEAREST_UNNORMALIZED = 8,
|
||||
S_SAMPLER_CNT = 9
|
||||
} qvksampler_t;
|
||||
|
||||
#define NUM_SAMPLERS (S_SAMPLER_CNT * 2)
|
||||
|
||||
// texture object
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -1,46 +1,64 @@
|
|||
// 8.13.3559
|
||||
// 1011.0.0
|
||||
#pragma once
|
||||
const uint32_t postprocess_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x00080008,0x00000033,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x07230203,0x00010000,0x0008000a,0x00000046,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000016,0x0000001e,0x00030010,
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x0000002c,0x00030010,
|
||||
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,
|
||||
0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,
|
||||
0x6e69616d,0x00000000,0x00060005,0x00000007,0x68737550,0x736e6f43,0x746e6174,0x00000000,
|
||||
0x00060006,0x00000007,0x00000000,0x74736f70,0x636f7270,0x00737365,0x00050006,0x00000007,
|
||||
0x00000001,0x6d6d6167,0x00000061,0x00030005,0x00000009,0x00006370,0x00060005,0x00000016,
|
||||
0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00050005,0x0000001a,0x78655473,0x65727574,
|
||||
0x00000000,0x00050005,0x0000001e,0x43786574,0x64726f6f,0x00000000,0x00050048,0x00000007,
|
||||
0x00000000,0x00000023,0x00000044,0x00050048,0x00000007,0x00000001,0x00000023,0x00000048,
|
||||
0x00030047,0x00000007,0x00000002,0x00040047,0x00000016,0x0000001e,0x00000000,0x00040047,
|
||||
0x0000001a,0x00000022,0x00000000,0x00040047,0x0000001a,0x00000021,0x00000000,0x00040047,
|
||||
0x0000001e,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,
|
||||
0x00030016,0x00000006,0x00000020,0x0004001e,0x00000007,0x00000006,0x00000006,0x00040020,
|
||||
0x00000008,0x00000009,0x00000007,0x0004003b,0x00000008,0x00000009,0x00000009,0x00040015,
|
||||
0x0000000a,0x00000020,0x00000001,0x0004002b,0x0000000a,0x0000000b,0x00000000,0x00040020,
|
||||
0x0000000c,0x00000009,0x00000006,0x0004002b,0x00000006,0x0000000f,0x00000000,0x00020014,
|
||||
0x00000010,0x00040017,0x00000014,0x00000006,0x00000004,0x00040020,0x00000015,0x00000003,
|
||||
0x00000014,0x0004003b,0x00000015,0x00000016,0x00000003,0x00090019,0x00000017,0x00000006,
|
||||
0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000018,
|
||||
0x00000017,0x00040020,0x00000019,0x00000000,0x00000018,0x0004003b,0x00000019,0x0000001a,
|
||||
0x00000000,0x00040017,0x0000001c,0x00000006,0x00000002,0x00040020,0x0000001d,0x00000001,
|
||||
0x0000001c,0x0004003b,0x0000001d,0x0000001e,0x00000001,0x00040017,0x00000021,0x00000006,
|
||||
0x00000003,0x0004002b,0x00000006,0x00000023,0x3fc00000,0x0004002b,0x0000000a,0x00000025,
|
||||
0x00000001,0x0004002b,0x00000006,0x0000002a,0x3f800000,0x00050036,0x00000002,0x00000004,
|
||||
0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x0000000c,0x0000000d,0x00000009,
|
||||
0x0000000b,0x0004003d,0x00000006,0x0000000e,0x0000000d,0x000500ba,0x00000010,0x00000011,
|
||||
0x0000000e,0x0000000f,0x000300f7,0x00000013,0x00000000,0x000400fa,0x00000011,0x00000012,
|
||||
0x0000002f,0x000200f8,0x00000012,0x0004003d,0x00000018,0x0000001b,0x0000001a,0x0004003d,
|
||||
0x0000001c,0x0000001f,0x0000001e,0x00050057,0x00000014,0x00000020,0x0000001b,0x0000001f,
|
||||
0x0008004f,0x00000021,0x00000022,0x00000020,0x00000020,0x00000000,0x00000001,0x00000002,
|
||||
0x0005008e,0x00000021,0x00000024,0x00000022,0x00000023,0x00050041,0x0000000c,0x00000026,
|
||||
0x00000009,0x00000025,0x0004003d,0x00000006,0x00000027,0x00000026,0x00060050,0x00000021,
|
||||
0x00000028,0x00000027,0x00000027,0x00000027,0x0007000c,0x00000021,0x00000029,0x00000001,
|
||||
0x0000001a,0x00000024,0x00000028,0x00050051,0x00000006,0x0000002b,0x00000029,0x00000000,
|
||||
0x00050051,0x00000006,0x0000002c,0x00000029,0x00000001,0x00050051,0x00000006,0x0000002d,
|
||||
0x00000029,0x00000002,0x00070050,0x00000014,0x0000002e,0x0000002b,0x0000002c,0x0000002d,
|
||||
0x0000002a,0x0003003e,0x00000016,0x0000002e,0x000200f9,0x00000013,0x000200f8,0x0000002f,
|
||||
0x0004003d,0x00000018,0x00000030,0x0000001a,0x0004003d,0x0000001c,0x00000031,0x0000001e,
|
||||
0x00050057,0x00000014,0x00000032,0x00000030,0x00000031,0x0003003e,0x00000016,0x00000032,
|
||||
0x000200f9,0x00000013,0x000200f8,0x00000013,0x000100fd,0x00010038
|
||||
0x6e69616d,0x00000000,0x00060005,0x00000009,0x6f6e6e75,0x65546d72,0x6f6f4378,0x00006472,
|
||||
0x00050005,0x0000000b,0x43786574,0x64726f6f,0x00000000,0x00060005,0x0000000d,0x68737550,
|
||||
0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000d,0x00000000,0x74736f70,0x636f7270,
|
||||
0x00737365,0x00050006,0x0000000d,0x00000001,0x6d6d6167,0x00000061,0x00060006,0x0000000d,
|
||||
0x00000002,0x57726373,0x68746469,0x00000000,0x00060006,0x0000000d,0x00000003,0x48726373,
|
||||
0x68676965,0x00000074,0x00050006,0x0000000d,0x00000004,0x7366666f,0x00587465,0x00050006,
|
||||
0x0000000d,0x00000005,0x7366666f,0x00597465,0x00030005,0x0000000f,0x00006370,0x00060005,
|
||||
0x0000002c,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00050005,0x00000030,0x78655473,
|
||||
0x65727574,0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000000,0x00050048,0x0000000d,
|
||||
0x00000000,0x00000023,0x00000044,0x00050048,0x0000000d,0x00000001,0x00000023,0x00000048,
|
||||
0x00050048,0x0000000d,0x00000002,0x00000023,0x0000004c,0x00050048,0x0000000d,0x00000003,
|
||||
0x00000023,0x00000050,0x00050048,0x0000000d,0x00000004,0x00000023,0x00000054,0x00050048,
|
||||
0x0000000d,0x00000005,0x00000023,0x00000058,0x00030047,0x0000000d,0x00000002,0x00040047,
|
||||
0x0000002c,0x0000001e,0x00000000,0x00040047,0x00000030,0x00000022,0x00000000,0x00040047,
|
||||
0x00000030,0x00000021,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,
|
||||
0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,
|
||||
0x00000008,0x00000007,0x00000007,0x00040020,0x0000000a,0x00000001,0x00000007,0x0004003b,
|
||||
0x0000000a,0x0000000b,0x00000001,0x0008001e,0x0000000d,0x00000006,0x00000006,0x00000006,
|
||||
0x00000006,0x00000006,0x00000006,0x00040020,0x0000000e,0x00000009,0x0000000d,0x0004003b,
|
||||
0x0000000e,0x0000000f,0x00000009,0x00040015,0x00000010,0x00000020,0x00000001,0x0004002b,
|
||||
0x00000010,0x00000011,0x00000002,0x00040020,0x00000012,0x00000009,0x00000006,0x0004002b,
|
||||
0x00000010,0x00000015,0x00000003,0x0004002b,0x00000010,0x0000001a,0x00000004,0x0004002b,
|
||||
0x00000010,0x0000001d,0x00000005,0x0004002b,0x00000010,0x00000022,0x00000000,0x0004002b,
|
||||
0x00000006,0x00000025,0x00000000,0x00020014,0x00000026,0x00040017,0x0000002a,0x00000006,
|
||||
0x00000004,0x00040020,0x0000002b,0x00000003,0x0000002a,0x0004003b,0x0000002b,0x0000002c,
|
||||
0x00000003,0x00090019,0x0000002d,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,
|
||||
0x00000001,0x00000000,0x0003001b,0x0000002e,0x0000002d,0x00040020,0x0000002f,0x00000000,
|
||||
0x0000002e,0x0004003b,0x0000002f,0x00000030,0x00000000,0x00040017,0x00000034,0x00000006,
|
||||
0x00000003,0x0004002b,0x00000006,0x00000036,0x3fc00000,0x0004002b,0x00000010,0x00000038,
|
||||
0x00000001,0x0004002b,0x00000006,0x0000003d,0x3f800000,0x00050036,0x00000002,0x00000004,
|
||||
0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,
|
||||
0x0004003d,0x00000007,0x0000000c,0x0000000b,0x00050041,0x00000012,0x00000013,0x0000000f,
|
||||
0x00000011,0x0004003d,0x00000006,0x00000014,0x00000013,0x00050041,0x00000012,0x00000016,
|
||||
0x0000000f,0x00000015,0x0004003d,0x00000006,0x00000017,0x00000016,0x00050050,0x00000007,
|
||||
0x00000018,0x00000014,0x00000017,0x00050085,0x00000007,0x00000019,0x0000000c,0x00000018,
|
||||
0x00050041,0x00000012,0x0000001b,0x0000000f,0x0000001a,0x0004003d,0x00000006,0x0000001c,
|
||||
0x0000001b,0x00050041,0x00000012,0x0000001e,0x0000000f,0x0000001d,0x0004003d,0x00000006,
|
||||
0x0000001f,0x0000001e,0x00050050,0x00000007,0x00000020,0x0000001c,0x0000001f,0x00050081,
|
||||
0x00000007,0x00000021,0x00000019,0x00000020,0x0003003e,0x00000009,0x00000021,0x00050041,
|
||||
0x00000012,0x00000023,0x0000000f,0x00000022,0x0004003d,0x00000006,0x00000024,0x00000023,
|
||||
0x000500ba,0x00000026,0x00000027,0x00000024,0x00000025,0x000300f7,0x00000029,0x00000000,
|
||||
0x000400fa,0x00000027,0x00000028,0x00000042,0x000200f8,0x00000028,0x0004003d,0x0000002e,
|
||||
0x00000031,0x00000030,0x0004003d,0x00000007,0x00000032,0x00000009,0x00050057,0x0000002a,
|
||||
0x00000033,0x00000031,0x00000032,0x0008004f,0x00000034,0x00000035,0x00000033,0x00000033,
|
||||
0x00000000,0x00000001,0x00000002,0x0005008e,0x00000034,0x00000037,0x00000035,0x00000036,
|
||||
0x00050041,0x00000012,0x00000039,0x0000000f,0x00000038,0x0004003d,0x00000006,0x0000003a,
|
||||
0x00000039,0x00060050,0x00000034,0x0000003b,0x0000003a,0x0000003a,0x0000003a,0x0007000c,
|
||||
0x00000034,0x0000003c,0x00000001,0x0000001a,0x00000037,0x0000003b,0x00050051,0x00000006,
|
||||
0x0000003e,0x0000003c,0x00000000,0x00050051,0x00000006,0x0000003f,0x0000003c,0x00000001,
|
||||
0x00050051,0x00000006,0x00000040,0x0000003c,0x00000002,0x00070050,0x0000002a,0x00000041,
|
||||
0x0000003e,0x0000003f,0x00000040,0x0000003d,0x0003003e,0x0000002c,0x00000041,0x000200f9,
|
||||
0x00000029,0x000200f8,0x00000042,0x0004003d,0x0000002e,0x00000043,0x00000030,0x0004003d,
|
||||
0x00000007,0x00000044,0x00000009,0x00050057,0x0000002a,0x00000045,0x00000043,0x00000044,
|
||||
0x0003003e,0x0000002c,0x00000045,0x000200f9,0x00000029,0x000200f8,0x00000029,0x000100fd,
|
||||
0x00010038
|
||||
};
|
|
@ -1,98 +1,111 @@
|
|||
// 1011.0.0
|
||||
#pragma once
|
||||
const uint32_t world_warp_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000a,0x0000007e,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x07230203,0x00010000,0x0008000a,0x0000008e,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000c,0x00000076,0x00030010,
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000019,0x00000086,0x00030010,
|
||||
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,
|
||||
0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,
|
||||
0x6e69616d,0x00000000,0x00030005,0x00000009,0x00007675,0x00060005,0x0000000c,0x465f6c67,
|
||||
0x43676172,0x64726f6f,0x00000000,0x00060005,0x00000012,0x68737550,0x736e6f43,0x746e6174,
|
||||
0x00000000,0x00050006,0x00000012,0x00000000,0x656d6974,0x00000000,0x00050006,0x00000012,
|
||||
0x00000001,0x6c616373,0x00000065,0x00060006,0x00000012,0x00000002,0x57726373,0x68746469,
|
||||
0x00000000,0x00060006,0x00000012,0x00000003,0x48726373,0x68676965,0x00000074,0x00060006,
|
||||
0x00000012,0x00000004,0x65786970,0x7a69536c,0x00000065,0x00030005,0x00000014,0x00006370,
|
||||
0x00030005,0x0000002c,0x00007873,0x00030005,0x0000003d,0x00007973,0x00040005,0x0000004c,
|
||||
0x69685378,0x00007466,0x00040005,0x00000057,0x69685379,0x00007466,0x00050005,0x00000060,
|
||||
0x74736964,0x6974726f,0x00006e6f,0x00060005,0x00000076,0x67617266,0x746e656d,0x6f6c6f43,
|
||||
0x00000072,0x00050005,0x0000007a,0x78655473,0x65727574,0x00000000,0x00040047,0x0000000c,
|
||||
0x0000000b,0x0000000f,0x00050048,0x00000012,0x00000000,0x00000023,0x00000044,0x00050048,
|
||||
0x00000012,0x00000001,0x00000023,0x00000048,0x00050048,0x00000012,0x00000002,0x00000023,
|
||||
0x0000004c,0x00050048,0x00000012,0x00000003,0x00000023,0x00000050,0x00050048,0x00000012,
|
||||
0x00000004,0x00000023,0x00000054,0x00030047,0x00000012,0x00000002,0x00040047,0x00000076,
|
||||
0x0000001e,0x00000000,0x00040047,0x0000007a,0x00000022,0x00000000,0x00040047,0x0000007a,
|
||||
0x6e69616d,0x00000000,0x00040005,0x00000009,0x53726373,0x00657a69,0x00060005,0x0000000a,
|
||||
0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00050006,0x0000000a,0x00000000,0x656d6974,
|
||||
0x00000000,0x00050006,0x0000000a,0x00000001,0x6c616373,0x00000065,0x00060006,0x0000000a,
|
||||
0x00000002,0x57726373,0x68746469,0x00000000,0x00060006,0x0000000a,0x00000003,0x48726373,
|
||||
0x68676965,0x00000074,0x00050006,0x0000000a,0x00000004,0x7366666f,0x00587465,0x00050006,
|
||||
0x0000000a,0x00000005,0x7366666f,0x00597465,0x00060006,0x0000000a,0x00000006,0x65786970,
|
||||
0x7a69536c,0x00000065,0x00030005,0x0000000c,0x00006370,0x00030005,0x00000016,0x00007675,
|
||||
0x00060005,0x00000019,0x465f6c67,0x43676172,0x64726f6f,0x00000000,0x00030005,0x0000002f,
|
||||
0x00007873,0x00030005,0x00000043,0x00007973,0x00040005,0x00000053,0x69685378,0x00007466,
|
||||
0x00040005,0x0000005e,0x69685379,0x00007466,0x00050005,0x00000067,0x74736964,0x6974726f,
|
||||
0x00006e6f,0x00060005,0x00000086,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00050005,
|
||||
0x0000008a,0x78655473,0x65727574,0x00000000,0x00050048,0x0000000a,0x00000000,0x00000023,
|
||||
0x00000044,0x00050048,0x0000000a,0x00000001,0x00000023,0x00000048,0x00050048,0x0000000a,
|
||||
0x00000002,0x00000023,0x0000004c,0x00050048,0x0000000a,0x00000003,0x00000023,0x00000050,
|
||||
0x00050048,0x0000000a,0x00000004,0x00000023,0x00000054,0x00050048,0x0000000a,0x00000005,
|
||||
0x00000023,0x00000058,0x00050048,0x0000000a,0x00000006,0x00000023,0x0000005c,0x00030047,
|
||||
0x0000000a,0x00000002,0x00040047,0x00000019,0x0000000b,0x0000000f,0x00040047,0x00000086,
|
||||
0x0000001e,0x00000000,0x00040047,0x0000008a,0x00000022,0x00000000,0x00040047,0x0000008a,
|
||||
0x00000021,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
|
||||
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,
|
||||
0x00000007,0x00000007,0x00040017,0x0000000a,0x00000006,0x00000004,0x00040020,0x0000000b,
|
||||
0x00000001,0x0000000a,0x0004003b,0x0000000b,0x0000000c,0x00000001,0x00040015,0x0000000d,
|
||||
0x00000020,0x00000000,0x0004002b,0x0000000d,0x0000000e,0x00000000,0x00040020,0x0000000f,
|
||||
0x00000001,0x00000006,0x0007001e,0x00000012,0x00000006,0x00000006,0x00000006,0x00000006,
|
||||
0x00000006,0x00040020,0x00000013,0x00000009,0x00000012,0x0004003b,0x00000013,0x00000014,
|
||||
0x00000009,0x00040015,0x00000015,0x00000020,0x00000001,0x0004002b,0x00000015,0x00000016,
|
||||
0x00000002,0x00040020,0x00000017,0x00000009,0x00000006,0x0004002b,0x0000000d,0x0000001b,
|
||||
0x00000001,0x0004002b,0x00000015,0x0000001e,0x00000003,0x0004002b,0x00000015,0x00000023,
|
||||
0x00000000,0x0004002b,0x00000006,0x00000026,0x00000000,0x00020014,0x00000027,0x00040020,
|
||||
0x0000002b,0x00000007,0x00000006,0x0004002b,0x00000015,0x0000002d,0x00000001,0x0004002b,
|
||||
0x00000006,0x00000032,0x40000000,0x0004002b,0x00000006,0x00000052,0x40490e56,0x0004002b,
|
||||
0x00000006,0x00000054,0x41200000,0x0004002b,0x00000006,0x0000006a,0x3bda3c21,0x0004002b,
|
||||
0x00000015,0x0000006f,0x00000004,0x00040020,0x00000075,0x00000003,0x0000000a,0x0004003b,
|
||||
0x00000075,0x00000076,0x00000003,0x00090019,0x00000077,0x00000006,0x00000001,0x00000000,
|
||||
0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000078,0x00000077,0x00040020,
|
||||
0x00000079,0x00000000,0x00000078,0x0004003b,0x00000079,0x0000007a,0x00000000,0x00050036,
|
||||
0x00000007,0x00000007,0x0009001e,0x0000000a,0x00000006,0x00000006,0x00000006,0x00000006,
|
||||
0x00000006,0x00000006,0x00000006,0x00040020,0x0000000b,0x00000009,0x0000000a,0x0004003b,
|
||||
0x0000000b,0x0000000c,0x00000009,0x00040015,0x0000000d,0x00000020,0x00000001,0x0004002b,
|
||||
0x0000000d,0x0000000e,0x00000002,0x00040020,0x0000000f,0x00000009,0x00000006,0x0004002b,
|
||||
0x0000000d,0x00000012,0x00000003,0x00040017,0x00000017,0x00000006,0x00000004,0x00040020,
|
||||
0x00000018,0x00000001,0x00000017,0x0004003b,0x00000018,0x00000019,0x00000001,0x0004002b,
|
||||
0x0000000d,0x0000001c,0x00000004,0x0004002b,0x0000000d,0x0000001f,0x00000005,0x0004002b,
|
||||
0x0000000d,0x00000026,0x00000000,0x0004002b,0x00000006,0x00000029,0x00000000,0x00020014,
|
||||
0x0000002a,0x00040020,0x0000002e,0x00000007,0x00000006,0x0004002b,0x0000000d,0x00000030,
|
||||
0x00000001,0x0004002b,0x00000006,0x00000035,0x40000000,0x00040015,0x00000037,0x00000020,
|
||||
0x00000000,0x0004002b,0x00000037,0x00000038,0x00000000,0x00040020,0x00000039,0x00000001,
|
||||
0x00000006,0x0004002b,0x00000037,0x00000049,0x00000001,0x0004002b,0x00000006,0x00000059,
|
||||
0x40490e56,0x0004002b,0x00000006,0x0000005b,0x41200000,0x0004002b,0x00000006,0x00000071,
|
||||
0x3bda3c21,0x0004002b,0x0000000d,0x00000076,0x00000006,0x0005002c,0x00000007,0x0000007f,
|
||||
0x00000029,0x00000029,0x0004002b,0x00000006,0x00000081,0x3f000000,0x0005002c,0x00000007,
|
||||
0x00000082,0x00000081,0x00000081,0x00040020,0x00000085,0x00000003,0x00000017,0x0004003b,
|
||||
0x00000085,0x00000086,0x00000003,0x00090019,0x00000087,0x00000006,0x00000001,0x00000000,
|
||||
0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000088,0x00000087,0x00040020,
|
||||
0x00000089,0x00000000,0x00000088,0x0004003b,0x00000089,0x0000008a,0x00000000,0x00050036,
|
||||
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,
|
||||
0x00000009,0x00000007,0x0004003b,0x0000002b,0x0000002c,0x00000007,0x0004003b,0x0000002b,
|
||||
0x0000003d,0x00000007,0x0004003b,0x0000002b,0x0000004c,0x00000007,0x0004003b,0x0000002b,
|
||||
0x00000057,0x00000007,0x0004003b,0x00000008,0x00000060,0x00000007,0x00050041,0x0000000f,
|
||||
0x00000010,0x0000000c,0x0000000e,0x0004003d,0x00000006,0x00000011,0x00000010,0x00050041,
|
||||
0x00000017,0x00000018,0x00000014,0x00000016,0x0004003d,0x00000006,0x00000019,0x00000018,
|
||||
0x00050088,0x00000006,0x0000001a,0x00000011,0x00000019,0x00050041,0x0000000f,0x0000001c,
|
||||
0x0000000c,0x0000001b,0x0004003d,0x00000006,0x0000001d,0x0000001c,0x00050041,0x00000017,
|
||||
0x0000001f,0x00000014,0x0000001e,0x0004003d,0x00000006,0x00000020,0x0000001f,0x00050088,
|
||||
0x00000006,0x00000021,0x0000001d,0x00000020,0x00050050,0x00000007,0x00000022,0x0000001a,
|
||||
0x00000021,0x0003003e,0x00000009,0x00000022,0x00050041,0x00000017,0x00000024,0x00000014,
|
||||
0x00000023,0x0004003d,0x00000006,0x00000025,0x00000024,0x000500ba,0x00000027,0x00000028,
|
||||
0x00000025,0x00000026,0x000300f7,0x0000002a,0x00000000,0x000400fa,0x00000028,0x00000029,
|
||||
0x0000002a,0x000200f8,0x00000029,0x00050041,0x00000017,0x0000002e,0x00000014,0x0000002d,
|
||||
0x0004003d,0x00000006,0x0000002f,0x0000002e,0x00050041,0x00000017,0x00000030,0x00000014,
|
||||
0x00000016,0x0004003d,0x00000006,0x00000031,0x00000030,0x00050088,0x00000006,0x00000033,
|
||||
0x00000031,0x00000032,0x00050041,0x0000000f,0x00000034,0x0000000c,0x0000000e,0x0004003d,
|
||||
0x00000006,0x00000035,0x00000034,0x00050083,0x00000006,0x00000036,0x00000033,0x00000035,
|
||||
0x0006000c,0x00000006,0x00000037,0x00000001,0x00000004,0x00000036,0x00050085,0x00000006,
|
||||
0x00000038,0x00000037,0x00000032,0x00050041,0x00000017,0x00000039,0x00000014,0x00000016,
|
||||
0x0004003d,0x00000006,0x0000003a,0x00000039,0x00050088,0x00000006,0x0000003b,0x00000038,
|
||||
0x0000003a,0x00050083,0x00000006,0x0000003c,0x0000002f,0x0000003b,0x0003003e,0x0000002c,
|
||||
0x0000003c,0x00050041,0x00000017,0x0000003e,0x00000014,0x0000002d,0x0004003d,0x00000006,
|
||||
0x0000003f,0x0000003e,0x00050041,0x00000017,0x00000040,0x00000014,0x0000001e,0x0004003d,
|
||||
0x00000006,0x00000041,0x00000040,0x00050088,0x00000006,0x00000042,0x00000041,0x00000032,
|
||||
0x00050041,0x0000000f,0x00000043,0x0000000c,0x0000001b,0x0004003d,0x00000006,0x00000044,
|
||||
0x00000043,0x00050083,0x00000006,0x00000045,0x00000042,0x00000044,0x0006000c,0x00000006,
|
||||
0x00000046,0x00000001,0x00000004,0x00000045,0x00050085,0x00000006,0x00000047,0x00000046,
|
||||
0x00000032,0x00050041,0x00000017,0x00000048,0x00000014,0x0000001e,0x0004003d,0x00000006,
|
||||
0x00000049,0x00000048,0x00050088,0x00000006,0x0000004a,0x00000047,0x00000049,0x00050083,
|
||||
0x00000006,0x0000004b,0x0000003f,0x0000004a,0x0003003e,0x0000003d,0x0000004b,0x00050041,
|
||||
0x00000017,0x0000004d,0x00000014,0x00000023,0x0004003d,0x00000006,0x0000004e,0x0000004d,
|
||||
0x00050085,0x00000006,0x0000004f,0x00000032,0x0000004e,0x00050041,0x0000002b,0x00000050,
|
||||
0x00000009,0x0000001b,0x0004003d,0x00000006,0x00000051,0x00000050,0x00050085,0x00000006,
|
||||
0x00000053,0x00000051,0x00000052,0x00050085,0x00000006,0x00000055,0x00000053,0x00000054,
|
||||
0x00050081,0x00000006,0x00000056,0x0000004f,0x00000055,0x0003003e,0x0000004c,0x00000056,
|
||||
0x00050041,0x00000017,0x00000058,0x00000014,0x00000023,0x0004003d,0x00000006,0x00000059,
|
||||
0x00000058,0x00050085,0x00000006,0x0000005a,0x00000032,0x00000059,0x00050041,0x0000002b,
|
||||
0x0000005b,0x00000009,0x0000000e,0x0004003d,0x00000006,0x0000005c,0x0000005b,0x00050085,
|
||||
0x00000006,0x0000005d,0x0000005c,0x00000052,0x00050085,0x00000006,0x0000005e,0x0000005d,
|
||||
0x00000054,0x00050081,0x00000006,0x0000005f,0x0000005a,0x0000005e,0x0003003e,0x00000057,
|
||||
0x0000005f,0x0004003d,0x00000006,0x00000061,0x0000004c,0x0006000c,0x00000006,0x00000062,
|
||||
0x00000001,0x0000000d,0x00000061,0x0004003d,0x00000006,0x00000063,0x0000002c,0x00050085,
|
||||
0x00000006,0x00000064,0x00000062,0x00000063,0x0004003d,0x00000006,0x00000065,0x00000057,
|
||||
0x0006000c,0x00000006,0x00000066,0x00000001,0x0000000d,0x00000065,0x0004003d,0x00000006,
|
||||
0x00000067,0x0000003d,0x00050085,0x00000006,0x00000068,0x00000066,0x00000067,0x00050050,
|
||||
0x00000007,0x00000069,0x00000064,0x00000068,0x0005008e,0x00000007,0x0000006b,0x00000069,
|
||||
0x0000006a,0x0003003e,0x00000060,0x0000006b,0x0004003d,0x00000007,0x0000006c,0x00000060,
|
||||
0x0004003d,0x00000007,0x0000006d,0x00000009,0x00050081,0x00000007,0x0000006e,0x0000006d,
|
||||
0x0000006c,0x0003003e,0x00000009,0x0000006e,0x000200f9,0x0000002a,0x000200f8,0x0000002a,
|
||||
0x00050041,0x00000017,0x00000070,0x00000014,0x0000006f,0x0004003d,0x00000006,0x00000071,
|
||||
0x00000070,0x0004003d,0x00000007,0x00000072,0x00000009,0x00050050,0x00000007,0x00000073,
|
||||
0x00000071,0x00000071,0x00050088,0x00000007,0x00000074,0x00000072,0x00000073,0x0003003e,
|
||||
0x00000009,0x00000074,0x0004003d,0x00000078,0x0000007b,0x0000007a,0x0004003d,0x00000007,
|
||||
0x0000007c,0x00000009,0x00050057,0x0000000a,0x0000007d,0x0000007b,0x0000007c,0x0003003e,
|
||||
0x00000076,0x0000007d,0x000100fd,0x00010038
|
||||
0x00000009,0x00000007,0x0004003b,0x00000008,0x00000016,0x00000007,0x0004003b,0x0000002e,
|
||||
0x0000002f,0x00000007,0x0004003b,0x0000002e,0x00000043,0x00000007,0x0004003b,0x0000002e,
|
||||
0x00000053,0x00000007,0x0004003b,0x0000002e,0x0000005e,0x00000007,0x0004003b,0x00000008,
|
||||
0x00000067,0x00000007,0x00050041,0x0000000f,0x00000010,0x0000000c,0x0000000e,0x0004003d,
|
||||
0x00000006,0x00000011,0x00000010,0x00050041,0x0000000f,0x00000013,0x0000000c,0x00000012,
|
||||
0x0004003d,0x00000006,0x00000014,0x00000013,0x00050050,0x00000007,0x00000015,0x00000011,
|
||||
0x00000014,0x0003003e,0x00000009,0x00000015,0x0004003d,0x00000017,0x0000001a,0x00000019,
|
||||
0x0007004f,0x00000007,0x0000001b,0x0000001a,0x0000001a,0x00000000,0x00000001,0x00050041,
|
||||
0x0000000f,0x0000001d,0x0000000c,0x0000001c,0x0004003d,0x00000006,0x0000001e,0x0000001d,
|
||||
0x00050041,0x0000000f,0x00000020,0x0000000c,0x0000001f,0x0004003d,0x00000006,0x00000021,
|
||||
0x00000020,0x00050050,0x00000007,0x00000022,0x0000001e,0x00000021,0x00050083,0x00000007,
|
||||
0x00000023,0x0000001b,0x00000022,0x0004003d,0x00000007,0x00000024,0x00000009,0x00050088,
|
||||
0x00000007,0x00000025,0x00000023,0x00000024,0x0003003e,0x00000016,0x00000025,0x00050041,
|
||||
0x0000000f,0x00000027,0x0000000c,0x00000026,0x0004003d,0x00000006,0x00000028,0x00000027,
|
||||
0x000500ba,0x0000002a,0x0000002b,0x00000028,0x00000029,0x000300f7,0x0000002d,0x00000000,
|
||||
0x000400fa,0x0000002b,0x0000002c,0x0000002d,0x000200f8,0x0000002c,0x00050041,0x0000000f,
|
||||
0x00000031,0x0000000c,0x00000030,0x0004003d,0x00000006,0x00000032,0x00000031,0x00050041,
|
||||
0x0000000f,0x00000033,0x0000000c,0x0000000e,0x0004003d,0x00000006,0x00000034,0x00000033,
|
||||
0x00050088,0x00000006,0x00000036,0x00000034,0x00000035,0x00050041,0x00000039,0x0000003a,
|
||||
0x00000019,0x00000038,0x0004003d,0x00000006,0x0000003b,0x0000003a,0x00050083,0x00000006,
|
||||
0x0000003c,0x00000036,0x0000003b,0x0006000c,0x00000006,0x0000003d,0x00000001,0x00000004,
|
||||
0x0000003c,0x00050085,0x00000006,0x0000003e,0x0000003d,0x00000035,0x00050041,0x0000000f,
|
||||
0x0000003f,0x0000000c,0x0000000e,0x0004003d,0x00000006,0x00000040,0x0000003f,0x00050088,
|
||||
0x00000006,0x00000041,0x0000003e,0x00000040,0x00050083,0x00000006,0x00000042,0x00000032,
|
||||
0x00000041,0x0003003e,0x0000002f,0x00000042,0x00050041,0x0000000f,0x00000044,0x0000000c,
|
||||
0x00000030,0x0004003d,0x00000006,0x00000045,0x00000044,0x00050041,0x0000000f,0x00000046,
|
||||
0x0000000c,0x00000012,0x0004003d,0x00000006,0x00000047,0x00000046,0x00050088,0x00000006,
|
||||
0x00000048,0x00000047,0x00000035,0x00050041,0x00000039,0x0000004a,0x00000019,0x00000049,
|
||||
0x0004003d,0x00000006,0x0000004b,0x0000004a,0x00050083,0x00000006,0x0000004c,0x00000048,
|
||||
0x0000004b,0x0006000c,0x00000006,0x0000004d,0x00000001,0x00000004,0x0000004c,0x00050085,
|
||||
0x00000006,0x0000004e,0x0000004d,0x00000035,0x00050041,0x0000000f,0x0000004f,0x0000000c,
|
||||
0x00000012,0x0004003d,0x00000006,0x00000050,0x0000004f,0x00050088,0x00000006,0x00000051,
|
||||
0x0000004e,0x00000050,0x00050083,0x00000006,0x00000052,0x00000045,0x00000051,0x0003003e,
|
||||
0x00000043,0x00000052,0x00050041,0x0000000f,0x00000054,0x0000000c,0x00000026,0x0004003d,
|
||||
0x00000006,0x00000055,0x00000054,0x00050085,0x00000006,0x00000056,0x00000035,0x00000055,
|
||||
0x00050041,0x0000002e,0x00000057,0x00000016,0x00000049,0x0004003d,0x00000006,0x00000058,
|
||||
0x00000057,0x00050085,0x00000006,0x0000005a,0x00000058,0x00000059,0x00050085,0x00000006,
|
||||
0x0000005c,0x0000005a,0x0000005b,0x00050081,0x00000006,0x0000005d,0x00000056,0x0000005c,
|
||||
0x0003003e,0x00000053,0x0000005d,0x00050041,0x0000000f,0x0000005f,0x0000000c,0x00000026,
|
||||
0x0004003d,0x00000006,0x00000060,0x0000005f,0x00050085,0x00000006,0x00000061,0x00000035,
|
||||
0x00000060,0x00050041,0x0000002e,0x00000062,0x00000016,0x00000038,0x0004003d,0x00000006,
|
||||
0x00000063,0x00000062,0x00050085,0x00000006,0x00000064,0x00000063,0x00000059,0x00050085,
|
||||
0x00000006,0x00000065,0x00000064,0x0000005b,0x00050081,0x00000006,0x00000066,0x00000061,
|
||||
0x00000065,0x0003003e,0x0000005e,0x00000066,0x0004003d,0x00000006,0x00000068,0x00000053,
|
||||
0x0006000c,0x00000006,0x00000069,0x00000001,0x0000000d,0x00000068,0x0004003d,0x00000006,
|
||||
0x0000006a,0x0000002f,0x00050085,0x00000006,0x0000006b,0x00000069,0x0000006a,0x0004003d,
|
||||
0x00000006,0x0000006c,0x0000005e,0x0006000c,0x00000006,0x0000006d,0x00000001,0x0000000d,
|
||||
0x0000006c,0x0004003d,0x00000006,0x0000006e,0x00000043,0x00050085,0x00000006,0x0000006f,
|
||||
0x0000006d,0x0000006e,0x00050050,0x00000007,0x00000070,0x0000006b,0x0000006f,0x0005008e,
|
||||
0x00000007,0x00000072,0x00000070,0x00000071,0x0003003e,0x00000067,0x00000072,0x0004003d,
|
||||
0x00000007,0x00000073,0x00000067,0x0004003d,0x00000007,0x00000074,0x00000016,0x00050081,
|
||||
0x00000007,0x00000075,0x00000074,0x00000073,0x0003003e,0x00000016,0x00000075,0x000200f9,
|
||||
0x0000002d,0x000200f8,0x0000002d,0x00050041,0x0000000f,0x00000077,0x0000000c,0x00000076,
|
||||
0x0004003d,0x00000006,0x00000078,0x00000077,0x0004003d,0x00000007,0x00000079,0x00000016,
|
||||
0x00050050,0x00000007,0x0000007a,0x00000078,0x00000078,0x00050088,0x00000007,0x0000007b,
|
||||
0x00000079,0x0000007a,0x0003003e,0x00000016,0x0000007b,0x0004003d,0x00000007,0x0000007c,
|
||||
0x00000016,0x0004003d,0x00000007,0x0000007d,0x00000009,0x00050085,0x00000007,0x0000007e,
|
||||
0x0000007c,0x0000007d,0x0004003d,0x00000007,0x00000080,0x00000009,0x00050083,0x00000007,
|
||||
0x00000083,0x00000080,0x00000082,0x0008000c,0x00000007,0x00000084,0x00000001,0x0000002b,
|
||||
0x0000007e,0x0000007f,0x00000083,0x0003003e,0x00000016,0x00000084,0x0004003d,0x00000088,
|
||||
0x0000008b,0x0000008a,0x0004003d,0x00000007,0x0000008c,0x00000016,0x00050057,0x00000017,
|
||||
0x0000008d,0x0000008b,0x0000008c,0x0003003e,0x00000086,0x0000008d,0x000100fd,0x00010038
|
||||
};
|
|
@ -151,7 +151,7 @@ qvkpipeline_t vk_worldWarpPipeline = QVKPIPELINE_INIT;
|
|||
qvkpipeline_t vk_postprocessPipeline = QVKPIPELINE_INIT;
|
||||
|
||||
// samplers
|
||||
static VkSampler vk_samplers[S_SAMPLER_CNT * 2];
|
||||
static VkSampler vk_samplers[NUM_SAMPLERS];
|
||||
|
||||
// Vulkan function pointers
|
||||
PFN_vkCreateDebugUtilsMessengerEXT qvkCreateDebugUtilsMessengerEXT;
|
||||
|
@ -538,7 +538,7 @@ static VkResult CreateRenderpasses()
|
|||
.flags = 0,
|
||||
.format = vk_swapchain.format,
|
||||
.samples = VK_SAMPLE_COUNT_1_BIT,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||
.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
|
||||
|
@ -600,7 +600,7 @@ static VkResult CreateRenderpasses()
|
|||
.flags = 0,
|
||||
.format = vk_swapchain.format,
|
||||
.samples = VK_SAMPLE_COUNT_1_BIT,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||
.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
|
||||
|
@ -859,6 +859,21 @@ static void CreateSamplersHelper(VkSampler *samplers, VkSamplerAddressMode addre
|
|||
VK_VERIFY(vkCreateSampler(vk_device.logical, &samplerInfo, NULL, &samplers[S_NEAREST]));
|
||||
QVk_DebugSetObjectName((uint64_t)samplers[S_NEAREST], VK_OBJECT_TYPE_SAMPLER, "Sampler: S_NEAREST");
|
||||
|
||||
{
|
||||
VkSamplerCreateInfo nuSamplerInfo = samplerInfo;
|
||||
|
||||
// unnormalizedCoordinates set to VK_TRUE forces other parameters to have restricted values.
|
||||
nuSamplerInfo.minLod = 0.f;
|
||||
nuSamplerInfo.maxLod = 0.f;
|
||||
nuSamplerInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
nuSamplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
nuSamplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
nuSamplerInfo.unnormalizedCoordinates = VK_TRUE;
|
||||
|
||||
VK_VERIFY(vkCreateSampler(vk_device.logical, &nuSamplerInfo, NULL, &samplers[S_NEAREST_UNNORMALIZED]));
|
||||
QVk_DebugSetObjectName((uint64_t)samplers[S_NEAREST_UNNORMALIZED], VK_OBJECT_TYPE_SAMPLER, "Sampler: S_NEAREST_UNNORMALIZED");
|
||||
}
|
||||
|
||||
samplerInfo.maxLod = FLT_MAX;
|
||||
VK_VERIFY(vkCreateSampler(vk_device.logical, &samplerInfo, NULL, &samplers[S_MIPMAP_NEAREST]));
|
||||
QVk_DebugSetObjectName((uint64_t)samplers[S_MIPMAP_NEAREST], VK_OBJECT_TYPE_SAMPLER, "Sampler: S_MIPMAP_NEAREST");
|
||||
|
@ -915,7 +930,7 @@ static void CreateSamplers()
|
|||
static void DestroySamplers()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < S_SAMPLER_CNT * 2; ++i)
|
||||
for (i = 0; i < NUM_SAMPLERS; ++i)
|
||||
{
|
||||
if (vk_samplers[i] != VK_NULL_HANDLE)
|
||||
vkDestroySampler(vk_device.logical, vk_samplers[i], NULL);
|
||||
|
@ -1793,8 +1808,8 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
R_Printf(PRINT_ALL, "...created Vulkan swapchain\n");
|
||||
|
||||
// set viewport and scissor
|
||||
vk_viewport.x = 0.f;
|
||||
vk_viewport.y = 0.f;
|
||||
vk_viewport.x = (float)(vk_swapchain.extent.width - (uint32_t)(vid.width)) / 2.0f;
|
||||
vk_viewport.y = (float)(vk_swapchain.extent.height - (uint32_t)(vid.height)) / 2.0f;
|
||||
vk_viewport.minDepth = 0.f;
|
||||
vk_viewport.maxDepth = 1.f;
|
||||
vk_viewport.width = (float)vid.width;
|
||||
|
@ -1944,9 +1959,9 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
};
|
||||
|
||||
VK_VERIFY(vkAllocateDescriptorSets(vk_device.logical, &dsAllocInfo, &vk_colorbuffer.descriptorSet));
|
||||
QVk_UpdateTextureSampler(&vk_colorbuffer, S_NEAREST, false);
|
||||
QVk_UpdateTextureSampler(&vk_colorbuffer, S_NEAREST_UNNORMALIZED, false);
|
||||
VK_VERIFY(vkAllocateDescriptorSets(vk_device.logical, &dsAllocInfo, &vk_colorbufferWarp.descriptorSet));
|
||||
QVk_UpdateTextureSampler(&vk_colorbufferWarp, S_NEAREST, false);
|
||||
QVk_UpdateTextureSampler(&vk_colorbufferWarp, S_NEAREST_UNNORMALIZED, false);
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.descriptorSet,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, "Descriptor Set: World Color Buffer");
|
||||
|
@ -2085,12 +2100,23 @@ VkResult QVk_EndFrame(qboolean force)
|
|||
|
||||
void QVk_BeginRenderpass(qvkrenderpasstype_t rpType)
|
||||
{
|
||||
VkClearValue clearColors[3] = {
|
||||
const VkClearValue clearColors[3] = {
|
||||
{.color = {.float32 = { 1.f, .0f, .5f, 1.f } } },
|
||||
{.depthStencil = { 1.f, 0 } },
|
||||
{.color = {.float32 = { 1.f, .0f, .5f, 1.f } } },
|
||||
};
|
||||
|
||||
const VkClearValue warpClearColors[2] = {
|
||||
clearColors[0],
|
||||
{.color = {.float32 = { 0.f, .0f, .0f, 1.f } } },
|
||||
};
|
||||
|
||||
const VkClearValue uiClearColors[3] = {
|
||||
clearColors[0],
|
||||
clearColors[1],
|
||||
{.color = {.float32 = { 0.f, .0f, .0f, 1.f } } },
|
||||
};
|
||||
|
||||
VkRenderPassBeginInfo renderBeginInfo[] = {
|
||||
// RP_WORLD
|
||||
{
|
||||
|
@ -2109,8 +2135,8 @@ void QVk_BeginRenderpass(qvkrenderpasstype_t rpType)
|
|||
.framebuffer = vk_framebuffers[RP_UI][vk_imageIndex],
|
||||
.renderArea.offset = { 0, 0 },
|
||||
.renderArea.extent = vk_swapchain.extent,
|
||||
.clearValueCount = 2,
|
||||
.pClearValues = clearColors
|
||||
.clearValueCount = 3,
|
||||
.pClearValues = uiClearColors
|
||||
},
|
||||
// RP_WORLD_WARP
|
||||
{
|
||||
|
@ -2119,8 +2145,8 @@ void QVk_BeginRenderpass(qvkrenderpasstype_t rpType)
|
|||
.framebuffer = vk_framebuffers[RP_WORLD_WARP][vk_imageIndex],
|
||||
.renderArea.offset = { 0, 0 },
|
||||
.renderArea.extent = vk_swapchain.extent,
|
||||
.clearValueCount = 1,
|
||||
.pClearValues = clearColors
|
||||
.clearValueCount = 2,
|
||||
.pClearValues = warpClearColors
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -169,6 +169,9 @@ refresh window.
|
|||
*/
|
||||
void RE_Draw_TileClear (int x, int y, int w, int h, char *name)
|
||||
{
|
||||
// This is handled in a special way in the Vulkan renderer. Clearing tiles
|
||||
// are skipped and replaced by black bars during the UI render pass.
|
||||
#if 0
|
||||
image_t *image;
|
||||
|
||||
image = RE_Draw_FindPic(name);
|
||||
|
@ -183,6 +186,7 @@ void RE_Draw_TileClear (int x, int y, int w, int h, char *name)
|
|||
(float)x / 64.0, (float)y / 64.0,
|
||||
(float)w / 64.0, (float)h / 64.0 };
|
||||
QVk_DrawTexRect(imgTransform, sizeof(imgTransform), &image->vk_texture);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ void QVk_CreatePipeline(const VkDescriptorSetLayout *descriptorLayout, const uin
|
|||
{
|
||||
.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||
.offset = 17 * sizeof(float),
|
||||
.size = 5 * sizeof(float)
|
||||
.size = 7 * sizeof(float)
|
||||
}};
|
||||
|
||||
VkPipelineLayoutCreateInfo plCreateInfo = {
|
||||
|
|
|
@ -843,6 +843,47 @@ void Mat_Ortho(float *matrix, float left, float right, float bottom, float top,
|
|||
Mat_Mul(proj, r_vulkan_correction, matrix);
|
||||
}
|
||||
|
||||
static void Scale_Down_World_Scissor (VkRect2D* scissor)
|
||||
{
|
||||
// When rendering the world, scale down scissor proportionally to vk_pixel_size.
|
||||
const float divisor = (vk_pixel_size->value < 1.0f ? 1.0f : vk_pixel_size->value);
|
||||
scissor->offset.x = (int32_t)floorf(scissor->offset.x / divisor);
|
||||
scissor->offset.y = (int32_t)floorf(scissor->offset.y / divisor);
|
||||
scissor->extent.width = (uint32_t)ceilf(scissor->extent.width / divisor);
|
||||
scissor->extent.height = (uint32_t)ceilf(scissor->extent.height / divisor);
|
||||
}
|
||||
|
||||
static void Clear_World_Frame (void)
|
||||
{
|
||||
const VkRect2D clearScissor = {
|
||||
.offset = { 0, 0 },
|
||||
.extent = { vk_swapchain.extent.width, vk_swapchain.extent.height },
|
||||
};
|
||||
|
||||
const VkViewport clearViewport = {
|
||||
.x = 0.f,
|
||||
.y = 0.f,
|
||||
.width = vid.width,
|
||||
.height = vid.height,
|
||||
.minDepth = 0.f,
|
||||
.maxDepth = 1.f,
|
||||
};
|
||||
|
||||
vkCmdSetScissor(vk_activeCmdbuffer, 0u, 1u, &clearScissor);
|
||||
vkCmdSetViewport(vk_activeCmdbuffer, 0u, 1u, &clearViewport);
|
||||
|
||||
float polyTransform[] = { 0.f, 0.f, vid.width, vid.height, 0.f, 0.f, 0.f, 1.f };
|
||||
QVk_DrawColorRect(polyTransform, sizeof(polyTransform), RP_WORLD);
|
||||
|
||||
// Restore world scissor.
|
||||
VkRect2D worldScissor = {
|
||||
.offset = { r_newrefdef.x, r_newrefdef.y },
|
||||
.extent = { r_newrefdef.width, r_newrefdef.height }
|
||||
};
|
||||
|
||||
Scale_Down_World_Scissor(&worldScissor);
|
||||
vkCmdSetScissor(vk_activeCmdbuffer, 0u, 1u, &worldScissor);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -881,6 +922,11 @@ R_SetupVulkan (void)
|
|||
// When rendering the world, reduce viewport size proportionally to vk_pixel_size.
|
||||
if (vk_state.current_renderpass == RP_WORLD)
|
||||
{
|
||||
// If the refdef has changed, clear frame so old contents will not
|
||||
// interfere with postprocessing effects.
|
||||
if (vk_state.refdef_changed)
|
||||
Clear_World_Frame();
|
||||
|
||||
const float divisor = (vk_pixel_size->value < 1.0f ? 1.0f : vk_pixel_size->value);
|
||||
viewport.x /= divisor;
|
||||
viewport.y /= divisor;
|
||||
|
@ -931,6 +977,7 @@ static void RE_RenderView (refdef_t *fd)
|
|||
if (r_norefresh->value)
|
||||
return;
|
||||
|
||||
vk_state.refdef_changed = (r_newrefdef.width != fd->width || r_newrefdef.height != fd->height);
|
||||
r_newrefdef = *fd;
|
||||
|
||||
if (!r_worldmodel && !(r_newrefdef.rdflags & RDF_NOWORLDMODEL))
|
||||
|
@ -949,13 +996,7 @@ static void RE_RenderView (refdef_t *fd)
|
|||
|
||||
// When rendering the world, scale down scissor proportionally to vk_pixel_size.
|
||||
if (vk_state.current_renderpass == RP_WORLD)
|
||||
{
|
||||
const float divisor = (vk_pixel_size->value < 1.0f ? 1.0f : vk_pixel_size->value);
|
||||
scissor.offset.x = (int32_t)floorf(scissor.offset.x / divisor);
|
||||
scissor.offset.y = (int32_t)floorf(scissor.offset.y / divisor);
|
||||
scissor.extent.width = (uint32_t)ceilf(scissor.extent.width / divisor);
|
||||
scissor.extent.height = (uint32_t)ceilf(scissor.extent.height / divisor);
|
||||
}
|
||||
Scale_Down_World_Scissor(&scissor);
|
||||
|
||||
vkCmdSetScissor(vk_activeCmdbuffer, 0, 1, &scissor);
|
||||
|
||||
|
@ -1032,6 +1073,8 @@ qboolean RE_EndWorldRenderpass(void)
|
|||
viewsize->value / 100.0f,
|
||||
vid.width,
|
||||
vid.height,
|
||||
vk_viewport.x,
|
||||
vk_viewport.y,
|
||||
(vk_pixel_size->value < 1.0f ? 1.0f : vk_pixel_size->value),
|
||||
};
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_worldWarpPipeline.layout,
|
||||
|
|
|
@ -5,6 +5,10 @@ layout(push_constant) uniform PushConstant
|
|||
{
|
||||
layout(offset = 68) float postprocess;
|
||||
layout(offset = 72) float gamma;
|
||||
layout(offset = 76) float scrWidth;
|
||||
layout(offset = 80) float scrHeight;
|
||||
layout(offset = 84) float offsetX;
|
||||
layout(offset = 88) float offsetY;
|
||||
} pc;
|
||||
|
||||
layout(set = 0, binding = 0) uniform sampler2D sTexture;
|
||||
|
@ -14,14 +18,16 @@ layout(location = 0) out vec4 fragmentColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec2 unnormTexCoord = texCoord * vec2(pc.scrWidth, pc.scrHeight) + vec2(pc.offsetX, pc.offsetY);
|
||||
|
||||
// apply any additional world-only postprocessing effects here (if enabled)
|
||||
if (pc.postprocess > 0.0)
|
||||
{
|
||||
//gamma + color intensity bump
|
||||
fragmentColor = vec4(pow(texture(sTexture, texCoord).rgb * 1.5, vec3(pc.gamma)), 1.0);
|
||||
fragmentColor = vec4(pow(texture(sTexture, unnormTexCoord).rgb * 1.5, vec3(pc.gamma)), 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
fragmentColor = texture(sTexture, texCoord);
|
||||
fragmentColor = texture(sTexture, unnormTexCoord);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ layout(push_constant) uniform PushConstant
|
|||
layout(offset = 72) float scale;
|
||||
layout(offset = 76) float scrWidth;
|
||||
layout(offset = 80) float scrHeight;
|
||||
layout(offset = 84) float pixelSize;
|
||||
layout(offset = 84) float offsetX;
|
||||
layout(offset = 88) float offsetY;
|
||||
layout(offset = 92) float pixelSize;
|
||||
} pc;
|
||||
|
||||
layout(set = 0, binding = 0) uniform sampler2D sTexture;
|
||||
|
@ -21,7 +23,8 @@ layout(location = 0) out vec4 fragmentColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = vec2(gl_FragCoord.x / pc.scrWidth, gl_FragCoord.y / pc.scrHeight);
|
||||
vec2 scrSize = vec2(pc.scrWidth, pc.scrHeight);
|
||||
vec2 uv = (gl_FragCoord.xy - vec2(pc.offsetX, pc.offsetY)) / scrSize;
|
||||
|
||||
if (pc.time > 0)
|
||||
{
|
||||
|
@ -36,5 +39,7 @@ void main()
|
|||
|
||||
uv /= pc.pixelSize;
|
||||
|
||||
uv = clamp(uv * scrSize, vec2(0.0, 0.0), scrSize - vec2(0.5, 0.5));
|
||||
|
||||
fragmentColor = texture(sTexture, uv);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue