0% found this document useful (0 votes)
16 views3 pages

Bad Ps 0000

The document defines macros and extensions for OpenGL ES shader code. It contains shader code for a pixel shader with one TEV stage that combines color and texture values and outputs to the framebuffer. It also defines a buffer and functions to update bounding box values from the shader.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Bad Ps 0000

The document defines macros and extensions for OpenGL ES shader code. It contains shader code for a pixel shader with one TEV stage that combines color and texture values and outputs to the framebuffer. It also defines a buffer and functions to update bounding box values from the shader.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

#version 320 es

#define FORCE_EARLY_Z layout(early_fragment_tests) in

#define ATTRIBUTE_LOCATION(x)
#define FRAGMENT_OUTPUT_LOCATION(x)
#define FRAGMENT_OUTPUT_LOCATION_INDEXED(x, y)
#define UBO_BINDING(packing, x) layout(packing, binding = x)
#define SAMPLER_BINDING(x) layout(binding = x)
#define TEXEL_BUFFER_BINDING(x) layout(binding = x)
#define SSBO_BINDING(x) layout(binding = x)
#define IMAGE_BINDING(format, x) layout(format, binding = x)

#define VARYING_LOCATION(x)

#extension GL_ANDROID_extension_pack_es31a : enable

#extension GL_EXT_blend_func_extended : enable

#extension GL_EXT_shader_framebuffer_fetch: enable


#define FB_FETCH_VALUE real_ocol0
#define FRAGMENT_INOUT inout

precision highp float;


precision highp int;
precision highp sampler2DArray;
precision highp usamplerBuffer;
precision highp sampler2DMS;
precision highp image2DArray;
#define API_OPENGL 1
#define float2 vec2
#define float3 vec3
#define float4 vec4
#define uint2 uvec2
#define uint3 uvec3
#define uint4 uvec4
#define int2 ivec2
#define int3 ivec3
#define int4 ivec4
#define frac fract
#define lerp mix
//Pixel Shader for TEV stages
//1 TEV stages, 0 texgens, 0 IND stages
int idot(int3 x, int3 y)
{
int3 tmp = x * y;
return tmp.x + tmp.y + tmp.z;
}
int idot(int4 x, int4 y)
{
int4 tmp = x * y;
return tmp.x + tmp.y + tmp.z + tmp.w;
}

int iround(float x) { return int (round(x)); }


int2 iround(float2 x) { return int2(round(x)); }
int3 iround(float3 x) { return int3(round(x)); }
int4 iround(float4 x) { return int4(round(x)); }

SAMPLER_BINDING(0) uniform sampler2DArray samp[8];

UBO_BINDING(std140, 1) uniform PSBlock {


int4 color[4];
int4 k[4];
int4 alphaRef;
float4 texdim[8];
int4 czbias[2];
int4 cindscale[2];
int4 cindmtx[6];
int4 cfogcolor;
int4 cfogi;
float4 cfogf;
float4 cfogrange[3];
float4 czslope;
float2 cefbscale;
};

SSBO_BINDING(0) buffer BBox {


int bbox_left, bbox_right, bbox_top, bbox_bottom;
};

void UpdateBoundingBoxBuffer(float2 min_pos, float2 max_pos) {


if (bbox_left > int(min_pos.x))
atomicMin(bbox_left, int(min_pos.x));
if (bbox_right < int(max_pos.x))
atomicMax(bbox_right, int(max_pos.x));
if (bbox_top > int(min_pos.y))
atomicMin(bbox_top, int(min_pos.y));
if (bbox_bottom < int(max_pos.y))
atomicMax(bbox_bottom, int(max_pos.y));
}

void UpdateBoundingBox(float2 rawpos) {


// The pixel center in the GameCube GPU is 7/12, not 0.5 (see
VertexShaderGen.cpp)
// Adjust for this by unapplying the offset we added in the vertex shader.
const float PIXEL_CENTER_OFFSET = 7.0 / 12.0 - 0.5;
float2 offset = float2(PIXEL_CENTER_OFFSET, PIXEL_CENTER_OFFSET);

// The rightmost shaded pixel is not included in the right bounding box register,
// such that width = right - left + 1. This has been verified on hardware.
int2 pos = iround(rawpos * cefbscale + offset);

#ifdef SUPPORTS_SUBGROUP_REDUCTION
if (CAN_USE_SUBGROUP_REDUCTION) {
int2 min_pos = IS_HELPER_INVOCATION ? int2(2147483647, 2147483647) : pos;
int2 max_pos = IS_HELPER_INVOCATION ? int2(-2147483648, -2147483648) : pos;
SUBGROUP_MIN(min_pos);
SUBGROUP_MAX(max_pos);
if (IS_FIRST_ACTIVE_INVOCATION)
UpdateBoundingBoxBuffer(min_pos, max_pos);
} else {
UpdateBoundingBoxBuffer(pos, pos);
}
#else
UpdateBoundingBoxBuffer(pos, pos);
#endif
}

FRAGMENT_OUTPUT_LOCATION(0) out vec4 ocol0;


VARYING_LOCATION(0) in VertexData {
float4 pos;
float4 colors_0;
float4 colors_1;
float clipDist0;
float clipDist1;
};
void main()
{
float4 rawpos = gl_FragCoord;
int4 c0 = color[1], c1 = color[2], c2 = color[3], prev = color[0];
int4 rastemp, textemp, konsttemp;
int3 comp16 = int3(1, 256, 0), comp24 = int3(1, 256, 256*256);
int alphabump=0;
int3 tevcoord=int3(0);
int2 wrappedcoord, tempcoord;
int4 tevin_a,tevin_b,tevin_c,tevin_d,tevin_temp;

float4 col0 = colors_0;


float4 col1 = colors_1;
int2 fixpoint_uv0 = int2(0);

// TEV stage 0
rastemp = iround(col0 * 255.0).rgba;
textemp = int4(255);
tevin_a = int4(int3(0), 0) & 255;
tevin_b = int4(int3(0), 0) & 255;
tevin_c = int4(int3(0), 0) & 255;
tevin_d = int4(rastemp.rgb, rastemp.a);
tevin_temp = (tevin_a<<8) + (tevin_b-tevin_a) * (tevin_c + (tevin_c>>7));
// tev combine
prev = (((tevin_d.rgba ) ) + ((((tevin_temp.rgba) ) + 128) >> 8)) ;
prev = clamp(prev, int4(0), int4(255));
prev = prev & 255;
ocol0 = float4(prev) / 255.0;
UpdateBoundingBox(rawpos.xy);
}
ERROR: 0:123: 'UpdateBoundingBoxBuffer' : no matching overloaded function found
ERROR: 1 compilation errors. No code generated.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy